Jump to content
×
×
  • Create New...
  • 0

Teleport por SQM


ivonebruno01
 Share

Question

Versão do Servidor: TFS - 0.4
Tipo de Script: spell
Código:
 
local combat1 = createCombatObject()
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -4.1, 1, -4.8, 1)

arr2 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 3, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}

local area2 = createCombatArea(arr2)
setCombatArea(combat2, area2)

local function onCastSpell2(parameters)
    if isPlayer(parameters.cid) then
    doCombat(parameters.cid, parameters.combat2, parameters.var)
end
end

local times = 3       --Quantos SQMs o jogador irá se mover.
 
function isWalkable(pos, creature, proj, pz)-- by Nord
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
    if getTopCreature(pos).uid > 0 and creature then return true end
    if getTileInfo(pos).protection and pz then return false, true end
    local n = not proj and 2 or 2
    for i = 0, 255 do
        pos.stackpos = i
        local tile = getTileThingByPos(pos)
        if tile.itemid ~= 0 and not isCreature(tile.uid) then
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end

function onCastSpell(cid, var)
local playerPos = getThingPos(cid)
	for i = 1, times do
		playerPos = getPosByDir(playerPos, getCreatureLookDirection(cid))    
		if not isWalkable(playerPos, i == times, i == times, i == times) then
			doPlayerSendCancel(cid, "Sorry, destination not possible.")
			return false
		end
    end
local direction = getCreatureLookDirection(cid)
local size = 3

local toPosition = getPositionByDirection(getThingPosition(cid), direction, size)
if isWalkable(toPosition, cid) then
	doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
        addEvent(doTeleportThing,600,cid, toPosition)
	doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
else
	doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end

local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2 }
addEvent(onCastSpell2, 200, parameters)
doCombat(cid, combat1, var)
return true
end

Boa noite, galera! Alguém poderia me ajudar. Bom, essa Spell funciona assim, eu a uso e sou teleportado a 3 Sqm a frente da onde estou olhando. Queria colocar para atravesar obstáculos específicos, tipo: Árvores. Como está ai, ela não atravessa nada, só Monstros e Players. Agradeço desde já.

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.