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

Teleporting Spell

Syryniss

Member
Joined
Feb 13, 2014
Messages
206
Reaction score
20
Hi! I'm looking for spell which will teleport me and my target to certain location. Additionally it would be awesome if that spell would teleport me and my target back after some peroid of time, but the first part would satisfy me enough. Thanks!
 
I saw this spell only once, and it was in a youtube video promoting a server in developement. it was a war server named "element/elemental something".
 
Code:
local function isWalkable(pos)
     pos.stackpos = 0
     local tile = getThingfromPos(pos, false)
     if tile ~= 0 and not hasProperty(tile.uid, CONST_PROP_BLOCKSOLID) and not isCreature(getTopCreature(pos).uid) then
         return true
     end
end

local function doTeleportBack(cid, target, pos)
     if isPlayer(cid) then
         doTeleportThing(cid, pos, false)
     end
     if isCreature(target) then
         doTeleportThing(target, getClosestFreeTile(cid, pos, false), false)
     end
     doSendMagicEffect(pos, CONST_ME_ENERGYHIT)
     return true
end


function onCastSpell(cid, var)

     local target, pPos = getCreatureTarget(cid), getCreaturePosition(cid)
     if target == 0 then
         doSendMagicEffect(pPos, CONST_ME_POFF)
         doPlayerSendCancel(cid, "First get a target.")
         return false
     end

     local pos = getClosestFreeTile(cid, getCreaturePosition(target), false)
     if not pos or isInArray({pos.x, pos.y}, 0) or getTilePzInfo(pos) or not isWalkable(pos) then
         doSendMagicEffect(pPos, CONST_ME_POFF)
         doPlayerSendCancel(cid, "Destination not reachable.")
         return false
     end
     doTeleportThing(cid, pos, false)
     doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
     addEvent(doTeleportBack, 3 * 1000, cid, target, pPos)
     return true
end
 
Last edited:
Back
Top