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

Lua Create Item with ActionID

BBFalcon89

Member
Joined
Jul 1, 2010
Messages
51
Reaction score
10
How do i create an item with an ActionID or UniqueID?

doCreateItem(objectid, 1, randpos)

is for me to create an item, but how do i set an aid or uid for it?
 
Solution
TFS 0.3
actionid
Code:
local item = doCreateItem(1337, 1, {x = 100, y = 100, z = 7})
doItemSetAttribute(item, "aid", 1000)
uniqueid
Code:
local item = doCreateItem(1337, 1, {x = 100, y = 100, z = 7})
doItemSetAttribute(item, "uid", 1000)

TFS 0.2
actionid
Code:
local item = doCreateItem(1337, 1, {x = 100, y = 100, z = 7})
doSetItemActionId(item, 1000)
u can cr8 an item using rme map editor and set action id or unique id for it.

another way is using:
doSetItemActionId(uid, actionid)

after cr8ing the item :)
 
As stated in the thread title i needed to create it in Lua in an actionscript
so according to what you responded i just need to for example

doCreateItem(1337,1,x=1337,y=1337,z=1337)
doSetItemActionId(uid,1337)

for it to give my item an actionid?
 
TFS 0.3
actionid
Code:
local item = doCreateItem(1337, 1, {x = 100, y = 100, z = 7})
doItemSetAttribute(item, "aid", 1000)
uniqueid
Code:
local item = doCreateItem(1337, 1, {x = 100, y = 100, z = 7})
doItemSetAttribute(item, "uid", 1000)

TFS 0.2
actionid
Code:
local item = doCreateItem(1337, 1, {x = 100, y = 100, z = 7})
doSetItemActionId(item, 1000)
 
Solution
TFS 0.3
actionid
Code:
local item = doCreateItem(1337, 1, {x = 100, y = 100, z = 7})
doItemSetAttribute(item, "aid", 1000)
uniqueid
Code:
local item = doCreateItem(1337, 1, {x = 100, y = 100, z = 7})
doItemSetAttribute(item, "uid", 1000)

TFS 0.2
actionid
Code:
local item = doCreateItem(1337, 1, {x = 100, y = 100, z = 7})
doSetItemActionId(item, 1000)

Sorry for bumping, but how'll would be this in TFS 1.X coz I got this:

A129RJI.png

and my code:
Lua:
local function transformStatue()
    if Tile(statuesPosition[1]):getItemById(12383) then
        return false
    else
        local teleportItem = Tile(statuesPosition[1]):getItemById(11753)
        teleportItem:remove()
        local newStatue = Game.createItem(12383, 1, statuesPosition[1])
        doItemSetAttribute(newStatue, "uid", 3193)
        return true
    end
end
 
newStatue:setAttribute(ITEM_ATTRIBUTE_ACTIONID, 3193)
you'll have to use action id since uid is a protected key in 1.x

Oh thanks for the clarification. But I have this code that only works with uid. How I change this?

Lua:
local boss = {
    [3193] = "fury of the emperor",
    [3194] = "wrath of the emperor",
    [3195] = "scorn of the emperor",
    [3196] = "spite of the emperor",
}

local statuesPosition = {
    Position(1029, 895, 15)
}

local function transformStatue()
    if Tile(statuesPosition[1]):getItemById(12383) then
        return false
    else
        local oldStatue = Tile(statuesPosition[1]):getItemById(11753)
        oldStatue:remove()
        local newStatue = Game.createItem(12383, 1, statuesPosition[1])
        newStatue:setAttribute(ITEM_ATTRIBUTE_ACTIONID, 3193)
        return true
    end
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if boss[target.uid] and target.itemid == 12383 then
        target:transform(11753)
        Game.createMonster(boss[target.uid], {x = toPosition.x + 4, y = toPosition.y, z = toPosition.z})
        Game.setStorageValue(target.uid - 4, 1)
...
...
...

I tried to change everything that has ".uid" to ".aid" but didn't work.
 
Back
Top