Best way is to do something like this:I'm trying to make this function work
when clicking on the item it turns another and then returns to the original item
local transform_id = 2659
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
item:transform(transform_id)
item:decay()
return true
end
Best way is to do something like this:I'm trying to make this function work
when clicking on the item it turns another and then returns to the original item
local transform_id = 2659
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
item:transform(transform_id)
item:decay()
return true
end
local config = {
[2050] = {changeTo = 2051},
[2051] = {changeTo = 2050}
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local itemTransform = config[item:getId()]
item:remove()
player:addItem(itemTransform.changeTo, 1)
return true
end
I forgot to change in item.xml --' tksss!Best way is to do something like this:
LUA:local transform_id = 2659 function onUse(player, item, fromPosition, target, toPosition, isHotkey) item:transform(transform_id) item:decay() return true end
Then in items.xml you set a decayTo and duration on the item it transformed into that reverts it back to original id.