-- <movevent type="StepIn" actionid="111111111111111111" event="script" value="aaaaaaaaaaaaaaaaaaaaaaaa.lua"/>
local item_position = {x = 32101, y = 32085, z = 7}
local item_id = 2383
-- my custom function
-- https://otland.net/threads/count-items-on-specific-tile.241788/#post-2341132
local function getItemCountOnPosition(item, pos)
local item_pos = {x = pos.x, y = pos.y, z = pos.z}
local item_count = 0
for i = 1, 255 do
local check_pos = {x = item_pos.x, y = item_pos.y, z = item_pos.z, stackpos = i}
if getThingFromPos(check_pos).itemid <= 0 then
break
elseif getThingFromPos(check_pos).itemid == item then
if isItemStackable(getThingFromPos(check_pos).itemid) == true then
item_count = item_count + getThingFromPos(check_pos).type
else
item_count = item_count + 1
end
end
end
return item_count
end
function onStepIn(cid, item, position, fromPosition)
if not isPlayer(cid) then
return true
end
if getItemCountOnPosition(item_id, item_position) >= 1 then
doRemoveItem(getTileItemById(item_position, item_id).uid, 1)
end
return true
end
local item_position = {x = 32101, y = 32085, z = 7}
local item_id = 2383
-- my custom function
-- https://otland.net/threads/count-items-on-specific-tile.241788/#post-2341132
local function getItemCountOnPosition(item, pos)
local item_pos = {x = pos.x, y = pos.y, z = pos.z}
local item_count = 0
for i = 1, 255 do
local check_pos = {x = item_pos.x, y = item_pos.y, z = item_pos.z, stackpos = i}
if getThingFromPos(check_pos).itemid <= 0 then
break
elseif getThingFromPos(check_pos).itemid == item then
if isItemStackable(getThingFromPos(check_pos).itemid) == true then
item_count = item_count + getThingFromPos(check_pos).type
else
item_count = item_count + 1
end
end
end
return item_count
end
function onStepIn(cid, item, position, fromPosition)
if not isPlayer(cid) then
return true
end
if getItemCountOnPosition(item_id, item_position) >= 1 then
doRemoveItem(getTileItemById(item_position, item_id).uid, 1)
end
return true
end
It means your movements.xml line you added is not correct for your server.:: Loading MoveEvents ...Error: [MoveEvent::configureMoveEvent] No valid event n
ame script
Warning: [BaseEvents::loadFromXml] Can not configure event
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/rookgaard/spikesword.lua:onStepIn
data/movements/scripts/rookgaard/spikesword.lua:11: attempt to call global 'getT
hingFromPos' (a nil value)
stack traceback:
data/movements/scripts/rookgaard/spikesword.lua:11: in function 'getItem
CountOnPosition'
data/movements/scripts/rookgaard/spikesword.lua:28: in function <data/mo
vements/scripts/rookgaard/spikesword.lua:24>