Lua Container not found

Joined
Feb 18, 2019
Messages
24
Best answers
0
Reaction score
21
Greetings, community!
A few moments ago I was writing a script for which I needed to get the uid of a container.
Lua:
function addGps(cid)
    local gps = doPlayerAddItem(cid, 12897)
    for i = 12901, 12898, -1 do
        doItemSetActionId(doAddContainerItem(gps, i), gps)
    end
    return true   
end
Here, its assumed that each item inside the container must have the container uid as actionid, am I wrong?

Well, now I'm trying to get that container through the actionid, as an example:
Lua:
getContainerSize(item.actionid)
In an action where the item used has the actionid that the function above gave us, but what happens is that the console throws this error:
[18/2/2019 7:41:51] (LuaInterface::luaGetContainerSize) Container not found
WTF !? That was my reaction, what is my mistake? Please help!

Thank you in advance, regards!​
 
OP
Return Of Tibia
Joined
Feb 18, 2019
Messages
24
Best answers
0
Reaction score
21
Solved: For those who have a similar error, the UniqueID generated by the server, are dynamic. You can set a static UID to the item when creating it with doItemSetAttribute (uid, 'uid', newuid).
 
Top