Antes de tudo vou explicar o que tentei fazer: A ideia da spell é de que quando o Player usa ela, ele corre 4sqm pa frente e então, se tiver algum telhado na frente, ele "pula" e fica lá encima, o problema é: ela até funciona do jeito que eu queria mas se tiver um muro acima dele ele o atravessa, fica dentro da parede, algem sabe o que preciso fazer na script para que ela funcione normalmente sem entrar em paredes e outras coisas?
ta ai a spell:
local combat = createCombatObject() local function onCastSpell1(parameters) if getPlayerLookDir(parameters.cid) == 0 then --NORTH olhapos = getCreaturePosition(parameters.cid) vaipos = {x = olhapos.x, y = olhapos.y-1, z = olhapos.z} uppos = {x = olhapos.x, y = olhapos.y, z = olhapos.z-1} sobpos = {x = olhapos.x, y = olhapos.y-1, z = olhapos.z-1} if getTileThingByPos(parameters.cid, uppos).itemid == 0 then doTeleportThing(parameters.cid,sobpos) else doPlayerSay(parameters.cid,"funfando",19) end elseif getPlayerLookDir(parameters.cid) == 2 then --SOUTH olhapos = getCreaturePosition(parameters.cid) vaipos = {x = olhapos.x, y = olhapos.y+1, z = olhapos.z} uppos = {x = olhapos.x, y = olhapos.y, z = olhapos.z-1} sobpos = {x = olhapos.x, y = olhapos.y+1, z = olhapos.z-1} if getTileThingByPos(parameters.cid, uppos).itemid == 0 then doTeleportThing(parameters.cid,sobpos) else doPlayerSay(parameters.cid,"funfando",19) end elseif getPlayerLookDir(parameters.cid) == 1 then --EAST olhapos = getCreaturePosition(parameters.cid) vaipos = {x = olhapos.x+1, y = olhapos.y, z = olhapos.z} uppos = {x = olhapos.x, y = olhapos.y, z = olhapos.z-1} sobpos = {x = olhapos.x+1, y = olhapos.y, z = olhapos.z-1} if getTileThingByPos(parameters.cid, uppos).itemid == 0 then doTeleportThing(parameters.cid,sobpos) else doPlayerSay(parameters.cid,"funfando",19) end elseif getPlayerLookDir(parameters.cid) == 3 then --WEAST olhapos = getCreaturePosition(parameters.cid) vaipos = {x = olhapos.x-1, y = olhapos.y, z = olhapos.z} uppos = {x = olhapos.x, y = olhapos.y, z = olhapos.z-1} sobpos = {x = olhapos.x-1, y = olhapos.y, z = olhapos.z-1} if getTileThingByPos(parameters.cid, uppos).itemid == 0 then doTeleportThing(parameters.cid,sobpos) else doPlayerSay(parameters.cid,"funfando",19) end end end local function onCastSpell2(parameters) if getPlayerLookDir(parameters.cid) == 0 then --NORTH doMoveCreature2(parameters.cid, 0) elseif getPlayerLookDir(parameters.cid) == 2 then --SOUTH doMoveCreature2(parameters.cid, 2) elseif getPlayerLookDir(parameters.cid) == 1 then --EAST doMoveCreature2(parameters.cid, 1) elseif getPlayerLookDir(parameters.cid) == 3 then --WEAST doMoveCreature2(parameters.cid, 3) end end function onCastSpell(cid, var) local parameters = { cid = cid, var = var} addEvent(onCastSpell2, 100, parameters) addEvent(onCastSpell2, 300, parameters) addEvent(onCastSpell2, 500, parameters) addEvent(onCastSpell2, 600, parameters) addEvent(onCastSpell1, 800, parameters) return doCombat(cid, combat, var) end
OBS: Os "doPlayerSay(parameters.cid,"funfando",19)" que ta na script eu so botei aí pra poder visualizar quando funciona e quando não funciona :biggrin: