CastorFlynn
Member
- Joined
- Aug 29, 2021
- Messages
- 103
- Reaction score
- 18
Post changegold.lua
Then test player:addItem
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?
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.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
What engine is it exactly? TFS 1.4 hasSorry 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?
dropOnGround = true set as default: https://github.com/otland/forgottenserver/blob/master/src/luascript.cpp#L9243That'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?Create with /i to see if it goes to the ground?
What engine is it exactly? TFS 1.4 hasdropOnGround = trueset 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?
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.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.