I
Icy
Guest
Well I'm trying to make a spell, that when cast starts a 10-second timer. After the 10 seconds are up it'll teleport the user back to his/her original location.. but I'm having a few errors with my "custom" function..
After the 10 seconds are up I get these 3 errors (relating to the `teleportBack` function not detecting the caster
Any suggestions on how I can fix the errors? :blink:
Code:
--[[------------------
<<Script by Icy Mage>>
------------------]]--
local inDisplacement = 60000
local function teleportBack(cid, pos)
setPlayerStorageValue(cid, inDisplacement, 0)
doTeleportThing(cid, originalPosition)
doSendMagicEffect(getPlayerPosition(cid),17)
end
function onCastSpell(cid, var)
if getPlayerStorageValue(cid, inDisplacement) < 9000 then
originalPosition = getPlayerPosition(cid)
setPlayerStorageValue(cid, inDisplacement, 9001)
addEvent(teleportBack, 10000)
doSendMagicEffect(getPlayerPosition(cid),17)
else
doPlayerSendTextMessage(cid,27,"You are already in temporal displacement!")
end
return TRUE
end
Code:
[12/09/2009 01:56:19] Lua Script Error: [Spell Interface]
[12/09/2009 01:56:19] in a timer event called from:
[12/09/2009 01:56:19] data/spells/scripts/custom/temporal displacement.lua:onCastSpell
[12/09/2009 01:56:19] luaDoPlayerSetStorageValue(). Player not found
[12/09/2009 01:56:19] Lua Script Error: [Spell Interface]
[12/09/2009 01:56:19] in a timer event called from:
[12/09/2009 01:56:19] data/spells/scripts/custom/temporal displacement.lua:onCastSpell
[12/09/2009 01:56:19] luaDoTeleportThing(). Thing not found
[12/09/2009 01:56:19] Lua Script Error: [Spell Interface]
[12/09/2009 01:56:19] in a timer event called from:
[12/09/2009 01:56:19] data/spells/scripts/custom/temporal displacement.lua:onCastSpell
[12/09/2009 01:56:20] luaGetCreaturePosition(). Creature not found
[12/09/2009 01:56:20] Lua Script Error: [Spell Interface]
[12/09/2009 01:56:20] in a timer event called from:
[12/09/2009 01:56:20] data/spells/scripts/custom/temporal displacement.lua:onCastSpell
[12/09/2009 01:56:20] attempt to index a boolean value
[12/09/2009 01:56:20] stack traceback:
[12/09/2009 01:56:20] [C]: in function 'doSendMagicEffect'
[12/09/2009 01:56:20] data/spells/scripts/custom/temporal displacement.lua:6: in function <data/spells/scripts/custom/temporal displacement.lua:3>
Any suggestions on how I can fix the errors? :blink: