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

transforming item

theduck

Member
Joined
Dec 6, 2018
Messages
246
Reaction score
20
I'm trying to make this function work
when clicking on the item it turns another and then returns to the original item
 
Solution
I'm trying to make this function work
when clicking on the item it turns another and then returns to the original item
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.
I'm trying to make this function work
when clicking on the item it turns another and then returns to the original item
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.
 
Solution
Here this if he wants it to stay and transform back on use again. His wording was a little confusing.
Code:
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
 
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.
I forgot to change in item.xml --' tksss!
 
Back
Top