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

Solved Action exhausted

Shackal

Alien Project
Joined
Feb 7, 2009
Messages
211
Reaction score
17
Location
Brazil
How do I add exhausted in my script?
I would like to add 2 seconds in the following script:

TFS Dev 0.4

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = {X=32412, Y=31413, Z=12}
local stone = 1304
local stoneFromPos = getThingfromPos(pos)
    if item.itemid == 1945 then
        doRemoveItem(stoneFromPos.uid, 1)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You removed the Stone.")
        doTransformItem(item.uid, 1946)
    elseif item.itemid == 1946 then
        doCreateItem(stone, 1, pos)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You added the Stone.")
        doTransformItem(item.uid, 1945)
    end
end

Thank you in advance!!
 
Last edited:
i will trying and nothing

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = {X=32412, Y=31413, Z=12}
local stone = 1304
local exhaust = createConditionObject(CONDITION_EXHAUSTED)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 2000)
local stoneFromPos = getThingfromPos(pos)
    if (getCreatureCondition(cid, CONDITION_EXHAUSTED) == FALSE) then
        if item.itemid == 1945 then
            doRemoveItem(stoneFromPos.uid, 1)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You removed the Stone.")
            doTransformItem(item.uid, 1946)
        elseif item.itemid == 1946 then
            doCreateItem(stone, 1, pos)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You added the Stone.")
            doTransformItem(item.uid, 1945)
        end
    end
end
 
i'm not sure you can add exhaust to items.
But you could add the exhaust to player.
If this is not good enough, then You can always use addEvent.
Make a fake lever after use and then replace it with real one in 2 seconds using addEvent.

I only know little about TFS 1.x.
But if it helps then here how i would use addEvent.
addEvent(doCreateItem, time, itemID, 0, position)
time = milliseconds
itemID = the fake item you want to use
0 = i thing the 0 was item count or type or both. Don't remember
I have yet to figure out how to create items with Action or Unique ID's in the addeEvent (prolly need to simply just make function inside the addEvent)

And a little more how i would solve this problem of yours, might not be the best solution.
i would give the lever action id or unique id.
upon using.
lever will transform with addevent.
then on top of the item i create new lever (it doesn't have action/unique id, so it wont work)
after certain time has passed. addevent will transform the previous lever and replace the new lever.

I'm not sure does it work like that right away or you have to start placing some addEvents to remove items too, before you the transformation happens.
 
Back
Top