• 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 Item not Found, [actions.xml], doSetItemActionId

  • Thread starter Thread starter Xikini
  • Start date Start date
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.
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
However if I use this code, it doesn't work, and I get the following error.
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
 
Solution
X
Ended up creating a function inside of the addEvent.
Code:
function onUse(cid, item, frompos, item2, topos)
   local ids = {}
   thing = (getThingFromPos(frompos).itemid)
   table.insert(ids, thing)
   doTransformItem(getThingfromPos(frompos).uid, 0)
   addEvent (
     function ()
       doCreateItem(ids[1], 1, frompos)
       local item = getThingFromPos(frompos).uid
       doSetItemActionId(item, 45557)
     end, 2000
   )
  return true
end
Ended up creating a function inside of the addEvent.
Code:
function onUse(cid, item, frompos, item2, topos)
   local ids = {}
   thing = (getThingFromPos(frompos).itemid)
   table.insert(ids, thing)
   doTransformItem(getThingfromPos(frompos).uid, 0)
   addEvent (
     function ()
       doCreateItem(ids[1], 1, frompos)
       local item = getThingFromPos(frompos).uid
       doSetItemActionId(item, 45557)
     end, 2000
   )
  return true
end
 
Solution
Ended up creating a function inside of the addEvent.
Code:
function onUse(cid, item, frompos, item2, topos)
   local ids = {}
   thing = (getThingFromPos(frompos).itemid)
   table.insert(ids, thing)
   doTransformItem(getThingfromPos(frompos).uid, 0)
   addEvent (
     function ()
       doCreateItem(ids[1], 1, frompos)
       local item = getThingFromPos(frompos).uid
       doSetItemActionId(item, 45557)
     end, 2000
   )
  return true
end
Thats was the solution :)
 
Back
Top