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

Feature Reward Chest & Boss Reward [TFS 1.2]

Status
Not open for further replies.
There I added a base64 coding for the serialized rewards, on the creaturescript of both versions.

Getting this using TFS 1.0:

Code:
Lua Script Error: [Main Interface]
in a timer event called from:
data/global.lua
data/creaturescripts/scripts/reward_chest.lua:116: attempt to index a nil value
stack traceback:
        [C]: in function '__index'
        data/creaturescripts/scripts/prisionboss/bossdeath.lua:116: in function <data/creaturescripts/scripts/reward_chest.lua:114>

I used the alternative version for older tfs 1.x btw
Start from scratch and check 4th post, then let me know.

clever way to create virtual depot.

But the sourceCode part seems irrelevant.
Couldn't you just use existing depot with fake Town ID?
and do the query function in LUA?

But what do I know, haven't even read entire post of yours and little do I know about sourceCodes xD
I don't know if you mean to use a normal depot rather than the reward chest itself, because that'd make this less realistic. What I wanted is that it sends the player to inside (inbox) of the virtual depot, but all my tries resulted into debug. I actually wanted some function like Player.openDepot(self, id) but then, it requires a parent container to work.
 
Code:
Error    1    error C2039: 'internalAddThing' : is not a member of 'DepotLocker'    C:\Users\Azleh\Desktop\Source\src\player.cpp    1072    1    theforgottenserver
 
Please post the TFS 1.x version and the protocol if you get an error.
 
No console errors, but it seems like it doesn't check the monsters name or something because it still droping loot.

IpGKkL9HC.png


edit:
Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/reward_chest.lua:onKill
data/creaturescripts/scripts/reward_chest.lua:289: attempt to index local 'target' (a number value)
stack traceback:
        [C]: in function '__index'
        data/creaturescripts/scripts/reward_chest.lua:289: in function <data/creaturescripts/scripts/reward_chest.lua:288>
 
Last edited:
No console errors, but it seems like it doesn't check the monsters name or something because it still droping loot.

IpGKkL9HC.png


edit:
Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/reward_chest.lua:onKill
data/creaturescripts/scripts/reward_chest.lua:289: attempt to index local 'target' (a number value)
stack traceback:
        [C]: in function '__index'
        data/creaturescripts/scripts/reward_chest.lua:289: in function <data/creaturescripts/scripts/reward_chest.lua:288>
On creaturescript change:
Code:
if (Monster(target) ~= nil) and isInArray(REWARD_CHEST.BOSSES, target:getName()) then
to:
Code:
target = Monster(target)
if (target ~= nil) and isInArray(REWARD_CHEST.BOSSES, target:getName()) then

I updated the creaturescript to make server warn you if there's corpses with infinite decay time, in order to avoid the server freeze on startup.
On the version for older TFS 1.x revs, make sure you don't get infinite loot bags, I left a note in the action script for that.
 
On creaturescript change:
Code:
if (Monster(target) ~= nil) and isInArray(REWARD_CHEST.BOSSES, target:getName()) then
to:
Code:
target = Monster(target)
if (target ~= nil) and isInArray(REWARD_CHEST.BOSSES, target:getName()) then

I updated the creaturescript to make server warn you if there's corpses with infinite decay time, in order to avoid the server freeze on startup.
On the version for older TFS 1.x revs, make sure you don't get infinite loot bags, I left a note in the action script for that.

No errors, but when I killed a Ferumbras got Segmentation fault. I tried again then I opened the corpse and got segmentation fault as well.
 
Please post the TFS 1.x version and the protocol if you get an error.
Using TFS 1.0, i fixed the bug just adding ___ after the internalAddThing, now the script are working but i can't pick the loot of the boss, it are saying "Not enough room" and when i'm looking for the Reward Chest, the items aren't there.
 
Using TFS 1.0, i fixed the bug just adding ___ after the internalAddThing, now the script are working but i can't pick the loot of the boss, it are saying "Not enough room" and when i'm looking for the Reward Chest, the items aren't there.
Go here and try with the two scripts of reward-chest-scripts-104x that I recently updated, otherwise use reward-chest-original.
 
Go here and try with the two scripts of reward-chest-scripts-104x that I recently updated, otherwise use reward-chest-original.
I'm looting now at the Boss, but it doesn't appear at the Reward Chest (I'm not picking the boss loot first obviusly, im just letting it decay).
 
I hope that brazilians are not selling this on black market kkkkkkkkkkkkk other than that, great release (as beautiful as paulo torres mapping)
 
I hope that brazilians are not selling this on black market kkkkkkkkkkkkk other than that, great release (as beautiful as paulo torres mapping)
you are not selling yet? ahahaha we know from where you come XD
 
I'm looting now at the Boss, but it doesn't appear at the Reward Chest (I'm not picking the boss loot first obviusly, im just letting it decay).
Which scripts are you using of the old version for that? It sounds like your TFS didn't support global variables between scripts.
Don't pick up the loot from boss, stay logged out and let it rot until it disappears, then check if the table player_rewardchest from your db gets filled with new data.
 
Which scripts are you using of the old version for that? It sounds like your TFS didn't support global variables between scripts.
Don't pick up the loot from boss, stay logged out and let it rot until it disappears, then check if the table player_rewardchest from your db gets filled with new data.
Both of them, the first script are giving me this at DTB:
14jme6o.png


And the second script are giving me this error at console:
11mbz9i.png
 
wen kill 1 boss get this error.
Code:
Lua Script Error: [Main Interface] 
in a timer event called from: 
(Unknown scriptfile) 
data/creaturescripts/scripts/starwands/reward_chest.lua:214: bad argument #1 to 'pairs' (table expected, got nil) 
stack traceback: 
 [C]: in ? 
 [C]: in function 'pairs' 
 data/creaturescripts/scripts/starwands/reward_chest.lua:214: in function <data/creaturescripts/scripts/starwands/reward_chest. 
lua:213>

I used TFS 1.2
 
Not appears consoler errors, but when i click in the monsters loot show this message "there is not enough room" but i have slots free in my backpack and i have cap... i'm using tfs 1.0, can someone help me?? i will open my server tomorrow...
 
Both of them, the first script are giving me this at DTB:
14jme6o.png
Change id of default container (21518) in creaturescript to a backpack of holding, your TFS doesn't seem to add the reward bag to the depot.

wen kill 1 boss get this error.
Code:
Lua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
data/creaturescripts/scripts/starwands/reward_chest.lua:214: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
[C]: in ?
[C]: in function 'pairs'
data/creaturescripts/scripts/starwands/reward_chest.lua:214: in function <data/creaturescripts/scripts/starwands/reward_chest.
lua:213>

I used TFS 1.2
Yeah, I got it too on a new copy of github's TFS. Though it only appeared once and never again, started to work normal.
Gotta see later how to fix it, still makes the system usable.

Can I get feedback from the ones where this system is working please?
I'm thinking on forking two separate versions for the TFS 1.0 and 1.1 that can be downloaded from otland github.
 
wen kill 1 boss get this error.
Code:
Lua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
data/creaturescripts/scripts/starwands/reward_chest.lua:214: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
[C]: in ?
[C]: in function 'pairs'
data/creaturescripts/scripts/starwands/reward_chest.lua:214: in function <data/creaturescripts/scripts/starwands/reward_chest.
lua:213>

I used TFS 1.2

Give this a try:
Code:
function doBossReward(monster, corpse)
    REWARD_CHEST.LOOT[corpse:getUniqueId()] = {}
    corpse:setAttribute('aid', 21584)
    corpse:setAttribute('text', corpse:getUniqueId())
    for killer, damage in pairs(monster:getDamageMap()) do
        local player, str = Player(killer), 'Loot of ' .. MonsterType(monster:getName()):getNameDescription() .. ': '
        if player ~= nil then
            local rewardBag = doCreateItemEx(REWARD_CHEST.CONTAINER)
            if player:getStamina() > 840 then
                local loot = MonsterType(monster:getName()):getBossReward(damage.total/monster:getMaxHealth())
                if #loot > 0 then
                    addContainerItems(Container(rewardBag), loot)
                    REWARD_CHEST.LOOT[corpse:getUniqueId()][player:getGuid()] = loot
                    str = str .. Container(rewardBag):getContentDescription()
                else
                    str = str .. 'nothing'
                end
            else
                str = str .. 'nothing (due to low stamina)'
            end
            player:sendTextMessage(MESSAGE_INFO_DESCR, str .. '.')
        end
    end
  
    if(REWARD_CHEST.LOOT ~= nil) then
        addEvent(doSaveReward, REWARD_CHEST.DECAY[monster:getName():lower()]*1000, corpse:getUniqueId(), MonsterType(monster:getName()):getNameDescription())
    end
end

Change id of default container (21518) in creaturescript to a backpack of holding, your TFS doesn't seem to add the reward bag to the depot.


Yeah, I got it too on a new copy of github's TFS. Though it only appeared once and never again, started to work normal.
Gotta see later how to fix it, still makes the system usable.

Can I get feedback from the ones where this system is working please?
I'm thinking on forking two separate versions for the TFS 1.0 and 1.1 that can be downloaded from otland github.

Cool release, but the code is just a mess haha...
IMO skip 1.0(Maybe even 1.1).
Open a PR at the github page and work on it there, ppl only have themselves to blame if they use old things.
Once you are done you can squash your commits and get it merged.

Other users will also point out problems insted of having it written here "in one of the scripts much bug yes?".
 
Last edited:
Cool release, but the code is just a mess haha...
IMO skip 1.0(Maybe even 1.1).
Open a PR at the github page and work on it there, ppl only have themselves to blame if they use old things.
Once you are done you can squash your commits and get it merged.

Other users will also point out problems insted of having it written here "in one of the scripts much bug yes?".
I guess that's the best for now, I stress too much myself with old and current code at the same time. I feel this code would be worth as a pull request if it gets written like Mark'd like it, such as sending those two lua scripts to sources and storing the rewards in player_depotitems or a new table similar to it.
 
I guess that's the best for now, I stress too much myself with old and current code at the same time. I feel this code would be worth as a pull request if it gets written like Mark'd like it, such as sending those two lua scripts to sources and storing the rewards in player_depotitems or a new table similar to it.

Ye it will require some clean up thats for sure.
But if you do upload it to even a fork of TFS we can help out on it :p
 
Status
Not open for further replies.
Back
Top