• 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 Poi remove stone script not working

MxSoft

Leave Tibia, Live Life.
Joined
Dec 22, 2009
Messages
1,804
Solutions
1
Reaction score
43
Location
Mexico
Hi i got this error log when i try to use the leverl y poi to remove a stone.
Code:
[22:30:38.244] [Error - MoveEvents Interface]
[22:30:38.244] data/movements/scripts/pitsofinferno/sqmpoi.lua:onStepIn
[22:30:38.244] Description:
[22:30:38.244] data/movements/scripts/pitsofinferno/sqmpoi.lua:16: attempt to call global 'doSetItemActionId' (a nil value)
[22:30:38.244] stack traceback:
[22:30:38.245]  data/movements/scripts/pitsofinferno/sqmpoi.lua:16: in function <data/movements/scripts/pitsofinferno/sqmpoi.lua:1>

Script:
Code:
  function onStepIn(cid, item, position, fromPosition)
 
local stonePos = { x=32849, y=32282, z=10, stackpos=1 }
local getItem = getThingFromPos(stonePos)
local stoneId = 1304
local leverPos = { x=32850, y=32268, z=10, stackpos=1 } -- change to the lever id
local getLever = getThingFromPos(leverPos)
local LeverId = 1945

                if(isPlayer(cid) == TRUE and getItem.itemid == stoneId) then
                else
                        doPlayerSendTextMessage(cid,22, "You hear a rumbling from far away.")
                        doCreateItem(stoneId, 1, stonePos)
						doRemoveItem(getThingfromPos(leverPos).uid, 1)
						local cer = doCreateItem(LeverId, 1, leverPos)
						doSetItemActionId(cer, 42880)
						doSendMagicEffect(stonePos,2)
						stonePos.stackpos = 253
		if getThingFromPos(stonePos).itemid > 0 then
		doMoveCreature(getThingFromPos(stonePos).uid, EAST)
		end
                return TRUE
        end 
		end
The script just works for 1 use, if another one wants to use it nothing happens and that error log is showed in screen.
 
replace
Lua:
local cer = doCreateItem(LeverId, 1, leverPos)
						doSetItemActionId(cer, 42880)
with
Lua:
doItemSetAttribute(doCreateItem(LeverId, 1, LeverPos), 'aid', 42880)
 
When this activates"21:30 You hear a rumbling from far away.", lever disapears
Error log:

Code:
[3:31:42.698] [Error - MoveEvents Interface]
[3:31:42.698] data/movements/scripts/pitsofinferno/sqmpoi.lua:onStepIn
[3:31:42.698] Description:
[3:31:42.698] attempt to index a nil value
[3:31:42.698] stack traceback:
[3:31:42.698]   [C]: in function 'doCreateItem'
[3:31:42.698]   data/movements/scripts/pitsofinferno/sqmpoi.lua:15: in function <data/movements/scripts/pitsofinferno/sqmpoi.lua:1>
 
I don't know what is that script supposed to do but,
Lua:
local t = {
	a = {
		{x=32849, y=32282, z=10}, -- Stone Pos
		{x=32850, y=32268, z=10} -- Lever Pos
		},
	b = {
		1304, -- Stone Id
		1945 -- Lever Id
		}
	}
function onStepIn(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(cid) then 
		if not (getTileItemById(t.a[1], t.b[1])) then
			doPlayerSendTextMessage(cid, 22, "You hear a rumbling from far away.")
			doCreateItem(t.a[1], 1, t.b[1])
			doRemoveItem(getTileItemById(t.a[2], t.b[2]).uid, 1)
			doItemSetAttribute(doCreateItem(t.b[2], 1, t.a[2]), 'aid', 42880)
			doSendMagicEffect(t.a[2], 2)
				if getTileItemById(t.a[1], t.b[1]) then
					doMoveCreature(getThingFromPos(t.a[1]).uid, EAST)
				end
		end
	end
end
 
Solution for this error: "The command was changed from doSetItemActionId -> doItemSetAttribute(ItemID, "aid", ActionID)"
 
Last edited:
^ could you post the whole script? Since im getting the same error.. And I dont understand what I sould change? : doItemSetAttribute(1945, 'aid', 42880) still causing errors in the console
 
try this
Lua:
function onStepIn(cid, item, position, fromPosition)
 
local stonePos = { x=32849, y=32282, z=10, stackpos=1 }
local getItem = getThingFromPos(stonePos)
local stoneId = 1304
local leverPos = { x=32850, y=32268, z=10, stackpos=1 } -- change to the lever id
local getLever = getThingFromPos(leverPos)
local LeverId = 1945

                if(isPlayer(cid) == TRUE and getItem.itemid == stoneId) then
                else
                        doPlayerSendTextMessage(cid,22, "You hear a rumbling from far away.")
                        doCreateItem(stoneId, 1, stonePos)
						doRemoveItem(getThingfromPos(leverPos).uid, 1)
						local cer = doCreateItem(LeverId, 1, leverPos)
						doSetItemActionId(uid, 42880)
						doSendMagicEffect(stonePos,2)
						stonePos.stackpos = 253
		if getThingFromPos(stonePos).itemid > 0 then
		doMoveCreature(getThingFromPos(stonePos).uid, EAST)
		end
                return TRUE
        end 
		end
 
Back
Top