This code should allow a player to teleport 2 squares forward, if the specified square is not a PZ or House Tile.
There is no error in the server log, but when I cast the spell, it ALWAYS says "You cannot do that." in orange writing.
How can I edit this script to work properly? I also do NOT want players to teleport onto walls, or trees, so if someone could edit it a bit further for me that would be nice.
+++rep for help
The script was made by me. I am using Mystic Spirit 9.6.
There is no error in the server log, but when I cast the spell, it ALWAYS says "You cannot do that." in orange writing.
How can I edit this script to work properly? I also do NOT want players to teleport onto walls, or trees, so if someone could edit it a bit further for me that would be nice.
+++rep for help
The script was made by me. I am using Mystic Spirit 9.6.
Code:
function onCastSpell(cid, var)
local DIREC = getPlayerLookDir(cid)
local PPOS = getPlayerPosition(cid)
local NEWPOS1 = {x = PPOS.x, y = PPOS.y - 2, z = PPOS.z, stackpos = 255}
local NEWPOS2 = {x = PPOS.x + 2, y = PPOS.y, z = PPOS.z, stackpos = 255}
local NEWPOS3 = {x = PPOS.x, y = PPOS.y + 2, z = PPOS.z, stackpos = 255}
local NEWPOS4 = {x = PPOS.x - 2, y = PPOS.y, z = PPOS.z, stackpos = 255}
if DIREC == 0 then
if getTilePzInfo(NEWPOS1) == 0 and getTileHouseInfo(NEWPOS1) == 0 then
doTeleportThing(cid, NEWPOS1, FALSE)
doCreatureSay(cid, "Blink Up!", TALKTYPE_ORANGE_1)
else
doCreatureSay(cid, "You cannot do that.", TALKTYPE_ORANGE_1)
end
end
if DIREC == 1 then
if getTilePzInfo(NEWPOS2) == 0 and getTileHouseInfo(NEWPOS2) == 0 then
doTeleportThing(cid, NEWPOS2, FALSE)
doCreatureSay(cid, "Blink Right!", TALKTYPE_ORANGE_1)
else
doCreatureSay(cid, "You cannot do that.", TALKTYPE_ORANGE_1)
end
end
if DIREC == 2 then
if getTilePzInfo(NEWPOS3) == 0 and getTileHouseInfo(NEWPOS3) == 0 then
doTeleportThing(cid, NEWPOS3, FALSE)
doCreatureSay(cid, "Blink Down!", TALKTYPE_ORANGE_1)
else
doCreatureSay(cid, "You cannot do that.", TALKTYPE_ORANGE_1)
end
end
if DIREC == 3 then
if getTilePzInfo(NEWPOS4) == 0 and getTileHouseInfo(NEWPOS4) == 0 then
doTeleportThing(cid, NEWPOS4, FALSE)
doCreatureSay(cid, "Blink Left!", TALKTYPE_ORANGE_1)
else
doCreatureSay(cid, "You cannot do that.", TALKTYPE_ORANGE_1)
end
end
return TRUE
end
Last edited: