• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Chest rewards

munch

New Member
Joined
Mar 26, 2010
Messages
143
Reaction score
0
Note: Not really a request, just wondering if it would be possible.
A quick in-depth of it wouldn't hurt either.
:)

Hi there,

is it possible to have a chest where you have 'XX'% chance to loot one of several items, and once you've "used" the chest, you get teleported to another location?

F.ex,
A chest that contains the Dragon Scale set, you have 35% chance to get one of the armors.
Once you've used the chest, you get teleported to the next room, regardless of recieving an item or not.
You can use the chest unlimited times, but to prevent players to use the chest several times within a short time, you get teleported to another location.


Thanks in advance,
Munchie.
 
Last edited:
Code:
local items = {
	--item id, count
		{1234, 1},
		{2345, 1},
		{3456, 1},
	--	{4567, 1},
			}

local newPos = { x = 1234, y = 2345, z = 7 }
local chance = 35

function onUse(cid, item, fromPosition, itemEx, toPosition)
local rand = math.random(1,100)
local r = items[math.random(#items)]

	if item.uid == 1234 then
		if rand <= 35 then
[COLOR="Red"]			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found " .. (r[2] > 1 and r[2] or getItemInfo(r[1]).article) .. " " .. (r[2] > 1 and getItemInfo(r[1]).plural or getItemInfo(r[1]).name) .. ".")
			doPlayerAddItem(cid, r[1], r[2])[/COLOR]
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You couldn't find anything. Maybe next time!")
		end
	doTeleportThing(cid, newPos, FALSE)
	end
return TRUE
end

I don't know if the red things will work properly since I just copied them from one of cykotitans scripts :p but hopefully it will work.
 
I don't understand... Something like this:
Lua:
function onUse(cid, item, frompos, item2, topos)

   	if item.uid == 65531 then
   		queststatus = getPlayerStorageValue(cid,211212)
   		if queststatus == -1 then
                  local prizes = {xxxx, yyyy, zzzz}
                   local prize = prizes[math.random(1, #prizes)]
   			doPlayerSendTextMessage(cid,22,"You have found a " ...(getItemNameByID)... "!")
   			doPlayerAddItem(cid,prize,1)
   			setPlayerStorageValue(cid,211212,1)
   		else
   			doPlayerSendTextMessage(cid,22,"It is empty.")
   		end
end
 
@Wesoly

A chest that contains the Dragon Scale set, you have 35% chance to get one of the armors.
Once you've used the chest, you get teleported to the next room, regardless of recieving an item or not.
You can use the chest unlimited times, but to prevent players to use the chest several times within a short time, you get teleported to another location.
 
Back
Top Bottom