• 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 lua error (waterfall jump down + effect)

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).

What I'm trying to make is a movements script which will teleport my character a floor down when walked on and adds the 'watersplash' effect. So far I have placed a blank item behind my waterfall, item id: 4329' edited it with the otm.itemeditor so it can be walked on. Further i tried to make the script below but ran into some problems.

Code:
    <movevent event="StepIn" itemid="4329" script="others/waterfall.lua"/>

Code:
function onStepIn(cid, item, Position)

    if item.actionid == 55556 then
        doTeleportThing(cid,{x = toPosition.x, y = toPosition.y, z = toPosition.z - 1})
        doSendMagicEffect({x = toPosition.x, y = toPosition.y, z = toPosition.z - 1}, CONST_ME_WATERSPLASH)
end
    return true
end
If possible the action id can be removed since it's quite useless.


I get this error when I walk on the sqm placed behind the waterfall.
Code:
[14/08/2014 22:09:23] Lua Script Error: [MoveEvents Interface]
[14/08/2014 22:09:23] data/movements/scripts/others/waterfall.lua:onStepIn

[14/08/2014 22:09:23] data/movements/scripts/others/waterfall.lua:4: attempt to index global 'toPosition' (a nil value)
[14/08/2014 22:09:23] stack traceback:
[14/08/2014 22:09:23]     data/movements/scripts/others/waterfall.lua:4: in function <data/movements/scripts/others/waterfall.lua:1>

Any help is welcome.

Thanks in advance.
 
Code:
function onStepIn(cid, item, position, fromPosition)
    if not isPlayer(cid) then
        return true
    end
   
    position.z = position.z + 1

    doTeleportThing(cid, position)
    doSendMagicEffect(position, CONST_ME_WATERSPLASH)
    return true
end
 
Back
Top Bottom