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

TFS 1.X+ Increased loot with rate at 1?

Unknown Soldier

Mapping a map
Joined
Oct 30, 2010
Messages
291
Solutions
11
Reaction score
660
Hi,

so I am having that problem since I moved from TFS 1.2 to TFS 1.3. Sometimes creatures drop much more loot than it is specified in xml file, like 6 pieces of something, instead of max 3 that is specified (for stackable items), or two identical items in two separate corpse slots, instead of 1, which is in xml. They are not doubled in xml, neither rateLoot in config isn't, it is at 1. I've searched through files in data folder looking for something suspicious, but no result.

What could be causing this problem?

TFS 1.3 from AppVeyor (Compiled on Dec 14 2020 21:45:15 for platform x64)

An example, take a look at knight armor(s), platinum coins, silver tokens, great spirit potion, red piece of cloth and so on...
loot.png
And xml looks like this:
XML:
    <loot>
        <item name="platinum coin" countmax="22" chance="100000" />
        <item name="silver token" countmax="1" chance="25000" />
        <item name="death toll" countmax="3" chance="80000" />
        <item name="green gem" countmax="1" chance="15000" />
        <item name="violet gem" countmax="1" chance="5000" />
        <item name="white gem" countmax="1" chance="15000" />
        <item name="red crystal fragment" countmax="1" chance="40000" />
        <item name="cyan crystal fragment" countmax="2" chance="41000" />
        <item name="small ruby" countmax="4" chance="42000" />
        <item name="great mana potion" countmax="4" chance="75000" />
        <item name="great spirit potion" countmax="2" chance="75000" />
        <item name="great health potion" countmax="1" chance="66000" />
        <item name="yellow piece of cloth" countmax="2" chance="40000" />
        <item name="white piece of cloth" countmax="2" chance="28000" />
        <item name="red piece of cloth" countmax="2" chance="28000" />
        <item name="focus cape" chance="8000" />
        <item name="knight armor" chance="19000" />
        <item name="fur armor" chance="10000" />
        <item name="warrior's axe" chance="8000" />
        <item id="26187" chance="9000" />         <!-- ring of green plasma -->
        <item id="26199" chance="8000" />         <!-- collar of green plasma -->
        <item name="hailstorm rod" chance="18000" />
    </loot>
 
Last edited:
Solution
In Talkactions => reload.lua change if param:lower() == "scripts" then to if param:lower() == "scripts" or param:lower() == "all" then
Would be kind if you could open an issue at github aswell, so I can link a pr to it aswell
they shouldn't be, red means removed, green means added

Ye, I know that, but I did nothing and here's how those parts of files I have look like:

global.lua
Lua:
math.randomseed(os.time())
dofile('data/lib/lib.lua')

STORAGEVALUE_PROMOTION = 30018

ropeSpots = {384, 418, 8278, 8592, 13189, 14435, 14436, 14857, 15635, 19518, 24621, 24622, 24623, 24624, 26019, 27014, 31640}

Lua:
function getLootRandom()
    return math.random(0, MAX_LOOTCHANCE) / configManager.getNumber(configKeys.RATE_LOOT)
end

startup.lua
Lua:
function onStartup()

    db.query("TRUNCATE TABLE `players_online`")
    db.asyncQuery("DELETE FROM `guild_wars` WHERE `status` = 0")

No other part of the code has red lines.

And I've noticed, that probably this problem does not occur always, as if it only happened once in a while, maybe one in several TFS launches (or maybe after /reload all command?). It looks a bit like the function adding loot was launched twice. But that's just my guess. I will be checking this...

@edit
So my suspicion was correct. The problem occurs after /reload all command, it must be executing "default_onDropLoot.lua" too many times (in data\scripts\eventcallbacks\monster\). So after using /reload all 10 times, it will generate much more loot than using it 1 time, so it will run the script 1+10=11 times, giving insane loot.
 
Last edited:
In Talkactions => reload.lua change if param:lower() == "scripts" then to if param:lower() == "scripts" or param:lower() == "all" then
Would be kind if you could open an issue at github aswell, so I can link a pr to it aswell
 
Solution
In Talkactions => reload.lua change if param:lower() == "scripts" then to if param:lower() == "scripts" or param:lower() == "all" then
Would be kind if you could open an issue at github aswell, so I can link a pr to it aswell
Thanks! I've tested this, seems to be solved.
Issue on github opened.
 
Back
Top