Thorn
Spriting since 2013
Hello guys, i searched in the forums before posting this but no one have the exact problem
this problem seems to be because of not defining the new coins into const.h, but i already did, this is what i have
error:
changegold.lua
and const.h
plz help guys, i don't know what to do :/
this problem seems to be because of not defining the new coins into const.h, but i already did, this is what i have
error:
Code:
Lua Script Error: [Test Interface]
data/actions/scripts/other/changegold.lua
data/actions/scripts/other/changegold.lua:5: table index is nil
stack traceback:
[C]: in function '__newindex'
data/actions/scripts/other/changegold.lua:5: in main chunk
[C]: in function 'reload'
data/talkactions/scripts/reload.lua:75: in function <data/talkactions/scripts/reload.lua:59>
[Warning - Event::checkScript] Can not load script: scripts/other/changegold.lua
changegold.lua
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, changeTo = ITEM_BLOOD_COIN},
[ITEM_BLOOD_COIN] = {changeBack = ITEM_CRYSTAL_COIN, changeTo = ITEM_ULTIMATE_COIN},
[ITEM_ULTIMATE_COIN] = {changeBack = ITEM_BLOOD_COIN}
}
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
local coin = config[item.itemid]
if not coin then
return false
end
if coin.changeTo and item.type == 100 then
item:remove()
player:addItem(coin.changeTo, 1)
elseif coin.changeBack then
item:transform(item.itemid, item.type - 1)
player:addItem(coin.changeBack, 100)
else
return false
end
return true
end
and const.h
Code:
ITEM_GOLD_COIN = 2148,
ITEM_PLATINUM_COIN = 2152,
ITEM_CRYSTAL_COIN = 2160,
ITEM_BLOOD_COIN = 28797,
ITEM_ULTIMATE_COIN = 28838,
plz help guys, i don't know what to do :/