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

dotransformitem in addevent

Nekiro

Legendary OT User
TFS Developer
Joined
Sep 7, 2015
Messages
2,759
Solutions
127
Reaction score
2,279
Hello, I have problem with addevent. I don't know how to use this...

TFS 0.4.

That's what I tried.
Code:
addEvent(doTransformItem, 20 * 1000, 8786, 2704)

But im getting error: "item not found".

Im using it with onuse action. 8786 should transform to 2704.
 
Hello, I have problem with addevent. I don't know how to use this...

TFS 0.4.

That's what I tried.
Code:
addEvent(doTransformItem, 20 * 1000, 8786, 2704)

But im getting error: "item not found".
the function doTransform Item doesn't know what item your targeting.
Code:
doTransformItem(uid, toitemid[, count/subtype])
In your example you would want to change it like this..
Code:
addEvent(doTransformItem, time, uid, toitemid)

Without viewing your code, I can't give you a specific example how to continue though.
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 2386 and isInArray(trees, itemEx.itemid) then
doTransformItem(itemEx.uid, 8786)
addEvent(doTransformItem, 20 * 1000, itemEx.uid, 2704)
end
end

I think of using toPosition but I dont know where to insert it in addEvent.
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 2386 and isInArray(trees, itemEx.itemid) then
doTransformItem(itemEx.uid, 8786)
addEvent(doTransformItem, 20 * 1000, itemEx.uid, 2704)
end
end

I think of using toPosition but I dont know where to insert it in addEvent.
Yes, this should work.
 
Still im getting exacly same error. Just wtf? I thought same way that it should work but it didnt.
 
cb25117eb89a8d3d77437a0d40d76152.png


Well... Same error everytime.
 
This won't work in 0.4 cause addEvent has it's own environment(I guess, lazy to read 0.4 source) and the uids are not shared between them, you should make a function and get the item by position.
 
cb25117eb89a8d3d77437a0d40d76152.png


Well... Same error everytime.
This won't work in 0.4 cause addEvent has it's own environment(I guess, lazy to read 0.4 source) and the uids are not shared between them, you should make a function and get the item by position.
Exactly what I was doing. xD
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
   if item.itemid == 2386 and isInArray(trees, itemEx.itemid) then
     doTransformItem(itemEx.uid, 8786)
     addEvent (
       function ()
         doTransformItem(getThingfromPos(toPosition).uid, 2704)  
       end, 20 * 1000
     )
   end
end
 
Back
Top