local function isWalkable(pos, creatures)
local tile = Tile(pos)
if (creatures and tile:getCreatureCount() > 0) or tile:hasFlag(TILESTATE_BLOCKSOLID) then
return false
end
return true
end
function onCastSpell(creature, var)
local steps = math.random(2, 4)
for x = 1, steps do
position = creature:getPosition()
position:getNextPosition(creature:getDirection(), x)
position = creature:getClosestFreePosition(position, false)
if position.x == 0 or not isWalkable(position, x == steps and true or false) then
creature:sendCancelMessage("You cannot teleport there.")
return false
end
end
creature:teleportTo(position)
return true
end
local function isWalkable(pos, creatures)
local tile = Tile(pos)
if (creatures and tile:getCreatureCount() > 0) or tile:hasFlag(TILESTATE_BLOCKSOLID) then
return false
end
return true
end
function onCastSpell(creature, var)
local steps, pos = math.random(2, 4), creature:getPosition()
pos:sendMagicEffect(CONST_ME_POFF)
for x = 1, steps do
position = creature:getPosition()
position:getNextPosition(creature:getDirection(), x)
position = creature:getClosestFreePosition(position, false)
if position.x == 0 or not isWalkable(position, x == steps and true or false) then
creature:sendCancelMessage("You failed to jump, there is something blocking.")
position:sendMagicEffect(CONST_ME_POFF)
return false
end
end
creature:teleportTo(position)
pos:sendMagicEffect(CONST_ME_POFF)
position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
return true
end
local effects = {
[0] = 1,
[1] = 3,
[2] = 2,
[3] = 4
}
position:sendMagicEffect(effects[creature:getDirection()])
local effects = {
[0] = 83,
[1] = 84,
[2] = 85,
[3] = 86
}
local posx = creature:getPosition()
posx:sendMagicEffect(effects[creature:getDirection()])
local effects = {
[0] = 83,
[1] = 84,
[2] = 85,
[3] = 86
}
if effects == 83 then
local Pos = creature:getPosition()
local position = Position(Pos.x + 1, Pos.y, Pos.z):sendMagicEffect(86)
end
local t = {}
table.insert(t, position)
for pos = 1, #t do
t[pos]:sendMagicEffect(effects[creature:getDirection()])
end
position = creature:getClosestFreePosition(position, false)