• 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 With Random Rewards

ant

Member
Joined
Jan 30, 2009
Messages
59
Reaction score
14
hello people
I'm quite new to ot but I need to know how to make such script
like when you use the chest you have 50% chance of getting one thing and 50% the other
thanks in advance for helping me ^_^
 
This is just a basic script, it is up to you to mix with it to achieve the performance you wish.
PHP:
local rewards = {
    { item = ITEM_ID_1, count = 1 },
    { item = ITEM_ID_2, count = 5 },
    { item = ITEM_ID_3, count = 1 }
}
local random = math.random(1, #rewards)
doPlayerAddItem(cid, rewards[random].item, rewards[random].count)
 
if I want for example a pile of hundred items that can be looted from chest at random I shall just add them all under the ones already there and it will work like one from this hundred picked at random yeah?
 
Yeah, exactly. Although I didn't add any storage ids or nothing so they could just use the quest like as much as they want.
 
would this be possible to do with an npc?

Ima explain myself,
Player: special bag
NPC: oh, I got some special bag full of random item I dont want anymore. Do you want to buy it for 50,000 gold coins?
Player: yes
NPC: Here you are, dear player!

(player open the bag) there is 8 items, could be some cash too or stuff like shields, armors, etc. But it would be always random so a 2 player wouldnt get the same things

I didnt wanted to make a new thread since this one was almost what I was looking for
I hope you get my point,
Timax25
 
Last edited:
Back
Top