• 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!

Lua TFS 1.0 | Reward chest system, some advises?

ATT3

Intermediate OT User
Joined
Sep 22, 2010
Messages
512
Reaction score
100
Well, I am trying to make somewhat the say reward chest system as RL tibia has.
If you don't know how the system works, here's something: http://www.tibia.com/news/?subtopic=newsarchive&id=2486


My script/system doesn't work like that at the moment, though the goal is to make it alike ;I
Just by thinking about it, how would you write it?
e.g like me~ (code below) or would you e.g make a table where certain storage value equals certain boss(base storage) then adding x storage value there would equal to x item.

Well, let's not get ahead of ourselves, I am in the "very beginning".

So far I've create a table like this:
Code:
local bosses = {
    ['rat'] = {bestLoot = {
        [1] = {"ferumbras hat", "hat of the mad", "magic plate armor", "golden armor", "golden helmet"},
        [2] = {"dragon shield", "war hammer", "plate armor", "golden shied", "blue robe"},
        [3] = {"gold coin", "crystal coin", "small emerald", "golden legs", "golden boots"}
    }},
    {goodLoot = {
        oneTimeItem = {"ferumbras hat", "hat of the mad"},
        singleItem = {"dragon shield", "war hammer"},
        multiItem = {"gold coin", "crystal coin", "small emerald"}
    }},
    {worseLoot = {
        oneTimeItem = {"ferumbras hat", "hat of the mad"},
        singleItem = {"dragon shield", "war hammer"},
        multiItem = {"gold coin", "crystal coin", "small emerald"}
    }},
    {worstLoot = {
        oneTimeItem = {"ferumbras hat", "hat of the mad"},
        singleItem = {"dragon shield", "war hammer"},
        multiItem = {"gold coin", "crystal coin", "small emerald"}
    }},
   
    ['another monster'] = {bestLoot = {
        [1] = {"ferumbras hat", "hat of the mad", "magic plate armor", "golden armor", "golden helmet"},
        [2] = {"dragon shield", "war hammer", "plate armor", "golden shied", "blue robe"},
        [3] = {"gold coin", "crystal coin", "small emerald", "golden legs", "golden boots"}
    }},
    {goodLoot = {
        oneTimeItem = {"ferumbras hat", "hat of the mad"},
        singleItem = {"dragon shield", "war hammer"},
        multiItem = {"gold coin", "crystal coin", "small emerald"}
    }},
    {worseLoot = {
        oneTimeItem = {"ferumbras hat", "hat of the mad"},
        singleItem = {"dragon shield", "war hammer"},
        multiItem = {"gold coin", "crystal coin", "small emerald"}
    }},
    {worstLoot = {
        oneTimeItem = {"ferumbras hat", "hat of the mad"},
        singleItem = {"dragon shield", "war hammer"},
        multiItem = {"gold coin", "crystal coin", "small emerald"}
    }},
}

Obviously adding multiple bosses with their "full loots" there the file will become very large.
Would you design this table differently? ("clearer")

Also instead of using item names, should I use their id's instead?
Least in that case the it would place the consonants/vowels there.

Problems:
1. I don't want it to get the same item twice e.g:
dragon shield, dragon shield

2. Add items to the corpse AND to the reward chest (adventurer's guild)
I don't know how to add "all the items" which the player will get to the reward container.
Ok, that would only solve the problem briefly.
Should it be like:
Code:
If reward item == "dragon shield" then
           player:setStorageValue(REWARD_RAT_STROAGE+ITEM_NUMBER_ON_ARRAY.. or table)
end

Current script: http://pastebin.com/Mp2ThEFk

If you understood what I am trying to say: great.
If not, please ask and I will clarify and update this post.
 
Isn't the loot supposed to be obtained from what the monster loots or is there a unique loot list for boss reward?
 
Isn't the loot supposed to be obtained from what the monster loots or is there a unique loot list for boss reward?

To keep it simpel.
Boss dies -> Drops loot (same as defined in xml & rareness) ->Calculate who has done most dammage -> Player with the most dammage will get the rarest drops.

In this script the loot is defined in lua..it would be neither to check if monster name is in list, if it's true then drop loot in the reward chest. i think it will be easyer to make a c++ code and add something like boss="true/false" to boss xml.

*Note: I just learned that healers of the "active members" are rewarded to, even if the done 0 dammage to boss. Healing the blocker and such will result in a reward to.

@ATT3 Nice work ;)
 
Last edited:
Back
Top