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

Solved Movements error

Exoltes

Novia OTserv Developer
Joined
Jul 2, 2009
Messages
563
Reaction score
47
Location
Belgium
I'm working on a 8.54 Open Tibia Server using The Forgotten Server - Version 0.2.7 (Mystic Spirit).

Every time I walk on a sqm with the correct action id i'm getting teleported but also the following error appears in my console.

[01/09/2014 16:12:08] [Error] Call stack overflow. MoveEvent::executeStep

Server\data\movements\movements.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<movements>
    <movevent event="StepIn" fromid="4526" toid="4541" script="others/mountain jump.lua"/>
    <movevent event="StepIn" itemid="7356" script="others/mountain jump.lua"/>
</movements>

Server\data\movements\scripts\others\mountain jump.lua
Code:
function onStepIn(cid, item, position, fromPosition)

    if isPlayer(cid) == TRUE and item.actionid == 55560 then
            position.y = position.y + 3
            doTeleportThing(cid, position)
    elseif isPlayer(cid) == TRUE and item.actionid == 55561 then
            position.y = position.y - 3
            doTeleportThing(cid, position)
end
    return true
end
 
Found the problem. Getting the error because you end up on a sqm which wants to teleport you back to the other side.

Moved it to the next sqm but a fix for this would be great, would make it more realistic.
 
You could check for the itemid of fromPosition and then give the itemids around it different ids than the itemid that teleports the person.
 
Not really sure how to fix it exactly so I figured I'd show the situation a little more clearly.

Getting the following error, in my console, after every time I get teleported.
[02/09/2014 16:20:05] [Error] Call stack overflow. MoveEvent::executeStep

Movements problems.png

1 Teleports to 4
2 Teleports to 5
3 Teleports to 6

4 Teleports to 1
5 Teleports to 2
6 Teleports to 3
Code:
1
Item ID: 4526 to 4541 (randomize)
Action ID: 55560
2
Item ID: 4526 to 4541 (randomize)
Action ID: 55560
3
Item ID: 4526 to 4541 (randomize)
Action ID: 55560
4
Item ID: 7356
Action ID: 55561
5
Item ID: 7356
Action ID: 55561
6
Item ID: 7356
Action ID: 55561

Server\data\movements\scripts\others\mountain jump.lua
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST_HEAL)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 5000)
function onStepIn(cid, item, position, fromPosition)

    if isPlayer(cid) == TRUE and item.actionid == 55560 and getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid == 2195 and getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == FALSE then
            position.y = position.y + 3
            doTeleportThing(cid, position)
        doAddCondition(cid, exhaust)
    elseif isPlayer(cid) == TRUE and item.actionid == 55561 and getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid == 2195 and getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == FALSE then
            position.y = position.y - 3
            doTeleportThing(cid, position)
        doAddCondition(cid, exhaust)
end
    return true
end
 
Also I would like to add:
Code:
          doSendMagicEffect(toPosition, CONST_ME_POFF)

But when I did this, I got the following error:

Code:
[02/09/2014 16:38:35] [Error] Call stack overflow. MoveEvent::executeStep

[02/09/2014 16:38:35] Lua Script Error: [MoveEvents Interface]
[02/09/2014 16:38:35] data/movements/scripts/others/mountain jump.lua:onStepIn

[02/09/2014 16:38:35] attempt to index a nil value
[02/09/2014 16:38:35] stack traceback:
[02/09/2014 16:38:35]     [C]: in function 'doSendMagicEffect'
[02/09/2014 16:38:35]     data/movements/scripts/others/mountain jump.lua:9: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:35]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:35]     data/movements/scripts/others/mountain jump.lua:12: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:35]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:35]     data/movements/scripts/others/mountain jump.lua:7: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:35]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:35]     data/movements/scripts/others/mountain jump.lua:12: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:35]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:35]     data/movements/scripts/others/mountain jump.lua:7: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:35]     ...
[02/09/2014 16:38:35]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:35]     data/movements/scripts/others/mountain jump.lua:7: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:35]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:35]     data/movements/scripts/others/mountain jump.lua:12: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:35]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:35]     data/movements/scripts/others/mountain jump.lua:7: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:35]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:35]     data/movements/scripts/others/mountain jump.lua:12: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:35]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:35]     data/movements/scripts/others/mountain jump.lua:7: in function <data/movements/scripts/others/mountain jump.lua:3>

[02/09/2014 16:38:35] Lua Script Error: [MoveEvents Interface]
[02/09/2014 16:38:35] data/movements/scripts/others/mountain jump.lua:onStepIn

[02/09/2014 16:38:35] attempt to index a nil value
[02/09/2014 16:38:35] stack traceback:
[02/09/2014 16:38:35]     [C]: in function 'doSendMagicEffect'
[02/09/2014 16:38:35]     data/movements/scripts/others/mountain jump.lua:9: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:35]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:35]     data/movements/scripts/others/mountain jump.lua:12: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:35]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:35]     data/movements/scripts/others/mountain jump.lua:7: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:12: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:7: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     ...
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:7: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:12: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:7: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:12: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:7: in function <data/movements/scripts/others/mountain jump.lua:3>

[02/09/2014 16:38:36] Lua Script Error: [MoveEvents Interface]
[02/09/2014 16:38:36] data/movements/scripts/others/mountain jump.lua:onStepIn

[02/09/2014 16:38:36] attempt to index a nil value
[02/09/2014 16:38:36] stack traceback:
[02/09/2014 16:38:36]     [C]: in function 'doSendMagicEffect'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:9: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:12: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:7: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:12: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:7: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     ...
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:7: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:12: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:7: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:12: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:7: in function <data/movements/scripts/others/mountain jump.lua:3>

[02/09/2014 16:38:36] Lua Script Error: [MoveEvents Interface]
[02/09/2014 16:38:36] data/movements/scripts/others/mountain jump.lua:onStepIn

[02/09/2014 16:38:36] attempt to index a nil value
[02/09/2014 16:38:36] stack traceback:
[02/09/2014 16:38:36]     [C]: in function 'doSendMagicEffect'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:9: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:12: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:7: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:12: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:7: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:12: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:36]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:36]     data/movements/scripts/others/mountain jump.lua:7: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:37]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:37]     data/movements/scripts/others/mountain jump.lua:12: in function <data/movements/scripts/others/mountain jump.lua:3>
[02/09/2014 16:38:37]     [C]: in function 'doTeleportThing'
[02/09/2014 16:38:37]     data/movements/scripts/others/mountain jump.lua:7: in function <data/movements/scripts/others/mountain jump.lua:3>

...... and a couple more sets of these.

[02/09/2014 16:38:37] Lua Script Error: [MoveEvents Interface]
[02/09/2014 16:38:37] data/movements/scripts/others/mountain jump.lua:onStepIn

[02/09/2014 16:38:38] attempt to index a nil value
[02/09/2014 16:38:38] stack traceback:
[02/09/2014 16:38:38]     [C]: in function 'doSendMagicEffect'
[02/09/2014 16:38:38]     data/movements/scripts/others/mountain jump.lua:9: in function <data/movements/scripts/others/mountain jump.lua:3>
 
At last I would like to set the look direction of the person after the jump away from the water but it keeps turning north.

was looking for a function to fix this but all I found was this:
Code:
getPlayerLookDir(cid)

So no idea if its possible
 
Add storage onStepIn and remove that storage onStepOut, teleport player only when he has the storage unset.
Check luascript.cpp for the function to change look direction, it might not exist.
 
getting the following error at startup
Code:
[05/09/2014 10:01:24] Warning: [Event::checkScript] Event onStepOut not found. /scripts/others/mountain jump (out).lua
[05/09/2014 10:01:24] Warning: [Event::checkScript] Event onStepOut not found. /scripts/others/mountain jump (out).lua

this error keeps looping from the moment the server is started
Code:
[05/09/2014 10:02:32] Lua Script Error: [MoveEvents Interface] 
[05/09/2014 10:02:32] data/movements/scripts/others/mountain jump (in).lua:onStepIn

[05/09/2014 10:02:32] luaGetPlayerStorageValue(). Player not found

Server\data\movements\movements.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<movements>
    <movevent event="StepIn" fromid="4526" toid="4541" script="others/mountain jump (in).lua"/>
    <movevent event="StepOut" fromid="4526" toid="4541" script="others/mountain jump (out).lua"/>
    <movevent event="StepIn" itemid="7356" script="others/mountain jump (in).lua"/>
    <movevent event="StepOut" itemid="7356" script="others/mountain jump (out).lua"/>
</movements>

Server\data\movements\others/mountain jump (in).lua
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST_HEAL)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 5000)
function onStepIn(cid, item, position, fromPosition)


   queststatus = getPlayerStorageValue(cid,11111)
    if queststatus == -1 and isPlayer(cid) == TRUE and item.actionid == 55560 and getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid == 2195 and getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == FALSE then
            position.y = position.y + 3
            doTeleportThing(cid, position)
        doAddCondition(cid, exhaust)
          setPlayerStorageValue(cid,11111,1)
    elseif queststatus == -1 and isPlayer(cid) == TRUE and item.actionid == 55561 and getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid == 2195 and getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == FALSE then
            position.y = position.y - 3
            doTeleportThing(cid, position)
        doAddCondition(cid, exhaust)
end
    return true
end

Server\data\movements\others/mountain jump (out).lua
Code:
function onStepIn(cid, item, position, fromPosition)

              DoRemovePlayerStorageValue(cid,11111,1)
    return true
end
 
You can add the stepout part to the stepin script, you don't need an extra Lua file for that.
The function for stepout is:
Code:
function onStepOut(cid, item, position, fromPosition)
There is no function to remove storage, you can set it to -1 though, which is similar effect, since without storagevalue it returns -1.
Code:
setPlayerStorageValue(cid, 11111, -1)
 
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST_HEAL)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 5000)
function onStepIn(cid, item, position, fromPosition)


   queststatus = getPlayerStorageValue(cid,11111)
    if queststatus == -1 and isPlayer(cid) == TRUE and item.actionid == 55560 and getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid == 2195 and getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == FALSE then
            position.y = position.y + 3
            doTeleportThing(cid, position)
        doAddCondition(cid, exhaust)
          setPlayerStorageValue(cid,11111,1)
    elseif queststatus == -1 and isPlayer(cid) == TRUE and item.actionid == 55561 and getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid == 2195 and getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == FALSE then
            position.y = position.y - 3
            doTeleportThing(cid, position)
        doAddCondition(cid, exhaust)
          setPlayerStorageValue(cid,11111,1)
end
end

function onStepOut(cid, item, position, fromPosition)
setPlayerStorageValue(cid, 11111, -1)
end

Getting this error in loop after startup
Code:
[05/09/2014 15:32:02] Lua Script Error: [MoveEvents Interface] 
[05/09/2014 15:32:02] data/movements/scripts/others/mountain jump.lua:onStepOut

[05/09/2014 15:32:02] luaSetPlayerStorageValue(). Player not found
 
With stepin/stepout scripts that only work for players (storage, textmessages, etc), always check of cid is a player, else it will give errors when monsters or npcs walk on it.
Code:
function onStepOut(cid, item, position, fromPosition)
    if isPlayer(cid) == TRUE then
        setPlayerStorageValue(cid, 11111, -1)
    end
    return TRUE
end
 
Back
Top