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

Lua Question about events

Mindee

Alright, alright, alright....
Joined
Oct 1, 2015
Messages
55
Reaction score
25
Location
Plungė, Lithuania
So, I made a script for sand. When I use shovel on sand, it gets transformed to a hole.
Is there any way to make that hole transform back to sand after 30 seconds?
 
Solution
If you post your script we can give you some more hints;
You need to create a new function that we can put the transform logic in, next you need to use addEvent after the item was transformed to the hole.

Lua:
function revert(itemUid)
    local item = Item(itemUid)
    if item then
        item:transform(NEW_ITEM_ID)
    end
end

function onUse(...)
    item:transform
    addEvent(revert, 30 * 1000, item:getUniqueId())
end
If you post your script we can give you some more hints;
You need to create a new function that we can put the transform logic in, next you need to use addEvent after the item was transformed to the hole.

Lua:
function revert(itemUid)
    local item = Item(itemUid)
    if item then
        item:transform(NEW_ITEM_ID)
    end
end

function onUse(...)
    item:transform
    addEvent(revert, 30 * 1000, item:getUniqueId())
end
 
Solution
If you post your script we can give you some more hints;
You need to create a new function that we can put the transform logic in, next you need to use addEvent after the item was transformed to the hole.

Lua:
function revert(itemUid)
    local item = Item(itemUid)
    if item then
        item:transform(NEW_ITEM_ID)
    end
end

function onUse(...)
    item:transform
    addEvent(revert, 30 * 1000, item:getUniqueId())
end

Thanks! That's what I needed.
 
Back
Top