X
Xikini
Guest
After I remove the item initially, I can't find the UID of the new item created to set the new aid attribute, it always comes back nil.
If I use this code, it works fine.
However if I use this code, it doesn't work, and I get the following error.
Anybody know what I'm doing wrong?
Thanks,
Xikini
If I use this code, it works fine.
Code:
function onUse(cid, item, frompos, item2, topos)
-- check what item is there and add to table
local ids = {}
thing = (getThingFromPos(frompos).itemid)
table.insert(ids, thing)
-- remove item that was used.
doTransformItem(getThingfromPos(frompos).uid, 0)
-- replace item that was removed
local item = doCreateItem(ids[1], 1, frompos)
-- add actionID back to object
doSetItemActionId(item, 45557)
return true
end
Code:
function onUse(cid, item, frompos, item2, topos)
-- check what item is there and add to table
local ids = {}
thing = (getThingFromPos(frompos).itemid)
table.insert(ids, thing)
-- remove item that was used.
doTransformItem(getThingfromPos(frompos).uid, 0)
-- replace item that was removed
local item = addEvent(doCreateItem, 1000, ids[1], 1, frompos)
-- add actionID back to object // NOT WORKING
addEvent(doSetItemActionId, 2000, getThingFromPos(frompos).uid, 45557)
return true
end
Code:
[9:52:31.781] [Error - Action Interface]
[9:52:31.781] In a timer event called from:
[9:52:31.781] data/actions/scripts/aaCarlExampleScripts/RemoveAddObjects.lua:onUse
[9:52:31.781] Description:
[9:52:31.781] (luaDoItemSetAttribute) Item not found
Anybody know what I'm doing wrong?
Thanks,
Xikini