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

[Problem] Event Callback (tile not found)

Zikerus

Nutria Developer
Joined
Mar 13, 2008
Messages
193
Reaction score
0
Location
Poole, UK
Hello everyone, I made script that remove statue, sommon monster on same position and create statue back after x seconds, but it doesn't want to summon this statue back :/ I've got msg:
Code:
[CODE]Lua Script Error: [MoveEvents Interface]
in a timer event called from:
data/movements/scripts/undeadstatue.lua:onStepIn

luaDoCreateItem(). Tile not found

This is my script:

Code:
function onStepIn(cid, item, position, fromPosition)

local statuepos = {x=1024 , y=1020 , z=7, stackpos=1} 
local monster = "Rat" 
local statueid =  3699
local delay =  10

local statue = getThingfromPos(statuepos)

	if statue.itemid ~= 0 then
			doRemoveItem(statue.uid, 1)
			doSummonCreature(monster, statuepos)
			addEvent(doCreateItem, delay * 1000, {statueid, 1, statuepos})
	end
return TRUE
end

Any ideas?
 
I tried that too :p It just summoned statue immidiately and I've got Lua Script Erro:
Code:
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/undeadstatue.lua:onStepIn

luaAddEvent(). callback parameter should be a function.
 
add at the bottom of your script:
Code:
function create(item, position)
    doCreateItem(statueid, 1, statuepos)
end

and now change addEvent to this:
Code:
addEvent(create, delay * 1000, a)
 
As I though, also you have mistake - it should be like that:
Code:
function create(item, position)
	doCreateItem(item, 1, position)
end
In other way you will get msg that you trying to get global value of statueid, etc.

Code:
Lua Script Error: [MoveEvents Interface]
in a timer event called from:
data/movements/scripts/undeadstatue.lua:onStepIn

attempt to index a nil value
stack traceback:
        [C]: in function 'doCreateItem'
        data/movements/scripts/undeadstatue.lua:25: in function <data/movements/
scripts/undeadstatue.lua:24>
 
No, it should be how it was, item and position in function are just parameters.

Move statueid and statuepos at the very top of the script, if it still wont work:

Code:
function create(item, position)
    doCreateItem(3699, 1, {x=1024 , y=1020 , z=7, stackpos=1})
end
 
A importante information!
"delay" is a time global.
each script you add
delay1
delay2
delay3
etc... in sequence.
example:

First Script:
delay = 5000
addEvent(doTransformItem, delay, item.uid, 1945)

Second Script
delay2 = 5000
addEvent(doTransformItem, delay2, item.uid, 1945)

DONT ADD SAME "DELAY" IN EVERY SCRIPTS
"DELAY" IS A TIME GLOBAL
 
Last edited:
A importante information!
"delay" is a time global.
each script you add
delay1
delay2
delay3
etc... in sequence.
example:

First Script:
delay = 5000
addEvent(doTransformItem, delay, item.uid, 1945)

Second Script
delay2 = 5000
addEvent(doTransformItem, delay2, item.uid, 1945)

DONT ADD SAME "DELAY" IN EVERY SCRIPTS
"DELAY" IS A TIME GLOBAL

I don't know why you are posting that, since I have
local delay = x
so it works only for this file and it's local ^.-

@slawkens
You think it would work? I am not using TFS (don't know if it matter anyway)
 
I don't know why you are posting that, since I have
local delay = x
so it works only for this file and it's local ^.-

ok but, i add some delays in my otserv, but have time what stop work, dont know why :(
And now, i addeing delay1, delay2, delay3... And works perfectly...
 
Back
Top