• 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+ Gold change bug

CastorFlynn

Member
Joined
Aug 29, 2021
Messages
90
Reaction score
9
When there is no more space available in the inventory, instead of the remaining amount going to the ground when use the gold, it basically disappears.

ezgif.com-gif-maker (2).gif
ezgif.com-gif-maker (1).gif

TFS 1.3 Downgrade
 
Post changegold.lua

Then test player:addItem
Lua:
local config = {
    [ITEM_GOLD_COIN] = {changeTo = ITEM_PLATINUM_COIN, effect = COLOR_YELLOW},
    [ITEM_PLATINUM_COIN] = {changeBack = ITEM_GOLD_COIN, changeTo = ITEM_CRYSTAL_COIN, effect = COLOR_LIGHTBLUE},
    [ITEM_CRYSTAL_COIN] = {changeBack = ITEM_PLATINUM_COIN, changeTo = 17100, effect = COLOR_TEAL},
    [17100] = {changeBack = ITEM_CRYSTAL_COIN, effect = COLOR_DARKYELLOW},
}


function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local coin = config[item:getId()]
    if coin.changeTo and item.type == 100 then
        item:remove()
        player:addItem(coin.changeTo, 1)
        player:say("$$$", TALKTYPE_MONSTER_SAY)
    elseif coin.changeBack then
        item:remove(1)
        player:addItem(coin.changeBack, 100)
        player:say("$$$", TALKTYPE_MONSTER_SAY)
    else
        return false
    end
    return true
end
 
So test player:addItem, does it do the same thing?
Post automatically merged:

So test player:addItem, does it do the same thing?
Lua:
local config = {
    [ITEM_GOLD_COIN] = {changeTo = ITEM_PLATINUM_COIN},
    [ITEM_PLATINUM_COIN] = {changeBack = ITEM_GOLD_COIN, changeTo = ITEM_CRYSTAL_COIN},
    [ITEM_CRYSTAL_COIN] = {changeBack = ITEM_PLATINUM_COIN}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local coin = config[item:getId()]
    if coin.changeTo and item.type == 100 then
        item:remove()
        player:addItem(coin.changeTo, 1)
    elseif coin.changeBack then
        item:remove(1)
        player:addItem(coin.changeBack, 100)
    else
        return false
    end
    return true
end
 
So test player:addItem, does it do the same thing?
Post automatically merged:


Lua:
local config = {
    [ITEM_GOLD_COIN] = {changeTo = ITEM_PLATINUM_COIN},
    [ITEM_PLATINUM_COIN] = {changeBack = ITEM_GOLD_COIN, changeTo = ITEM_CRYSTAL_COIN},
    [ITEM_CRYSTAL_COIN] = {changeBack = ITEM_PLATINUM_COIN}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local coin = config[item:getId()]
    if coin.changeTo and item.type == 100 then
        item:remove()
        player:addItem(coin.changeTo, 1)
    elseif coin.changeBack then
        item:remove(1)
        player:addItem(coin.changeBack, 100)
    else
        return false
    end
    return true
end
Sorry I do not understand.

When you say to test this player:addItem, what do you mean? Create with /i to see if it goes to the ground?
 
Sorry I do not understand.

When you say to test this player:addItem, what do you mean? Create with /i to see if it goes to the ground?
What engine is it exactly? TFS 1.4 has dropOnGround = true set as default: https://github.com/otland/forgottenserver/blob/master/src/luascript.cpp#L9243
so it should drop items on ground.
Create with /i to see if it goes to the ground?
That's good idea. Try to add 100 gold coins by /i , when you wear 46 gold coins and no slot for items. Does it drop 46 coins on ground?
 
What engine is it exactly? TFS 1.4 has dropOnGround = true set as default: https://github.com/otland/forgottenserver/blob/master/src/luascript.cpp#L9243
so it should drop items on ground.

That's good idea. Try to add 100 gold coins by /i , when you wear 46 gold coins and no slot for items. Does it drop 46 coins on ground?

I tried using /i but the same problem occurs, in this case, the change disappears, it doesn't go to the ground.

It's a downgrade 1.3 version, probably from 1 year ago.

I looked for dropOnGround in my base, but it didn't find anything.
 
I tried using /i but the same problem occurs, in this case, the change disappears, it doesn't go to the ground.

It's a downgrade 1.3 version, probably from 1 year ago.

I looked for dropOnGround in my base, but it didn't find anything.
So your problem is with the addItem function. Compare the function and related source to 1.4 latest. These downgrades have many bugs, you could contact Nekiro, however he receives errors like this very often, and he already the majority of the work downgrading it for free.
 
Back
Top