Ir para conteúdo
  • 0

Spell teleport


narutomaniacos

Pergunta

Bom a script funciona da seguinte forma:

O player usa a spell e é teleportado a nos 4 sqm ao redor do alvo,vai dar 4 hits cada hit em um sqm e depois voltar para o lugar de origem em que usou a spell.

 

 

OBS: SE POSSÍVEL fazer a outfit do player virar um effect durante a spell, ou pelo menos mudar a outfit

e se possível deixar configurável, Meu nível de experiencia é baixo. :(

Protocolo: 8.60

 

 

Link para o comentário
Compartilhar em outros sites

Posts Recomendados

  • 0

Fiz bem corrido aqui, talvez não funcione.

 

local config = {
    effect = xxx,     --Efeito.
    interval = 500    --Intervalo, em milésimos de segundo, entre os teleportes.
}
 
local combat, invisibility, outfit = createCombatObject(), createConditionObject(CONDITION_GAMEMASTER, -1, false, GAMEMASTER_INVISIBLE), createConditionObject(CONDITION_INVISIBLE, -1, false)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
function getDamage(cid, level, magic)
    return -(level * 5 + magic * 12), -(level * 5 + magic * 12 + 55)
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "getDamage")
 
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 false 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 doSpellTeleport(cid, target, positions, original_position)
    if not isPlayer(cid) then 
        return true
    elseif #positions < 1 or not isCreature(target) then
        doTeleportThing(cid, original_position)
        doRemoveCondition(cid, CONDITION_INVISIBLE)
        doRemoveCondition(cid, CONDITION_GAMEMASTER, GAMEMASTER_INVISIBLE)
        doPlayerSetNoMove(cid, false)
        return true
    end
    local index = math.random(#positions)
    local toPos = positions[index]
    if not isWalkable(toPos) then
        repeat
            table.remove(positions, index)
            index = math.random(#positions)
            toPos = positions[index]
            if #positions < 1 then
                doTeleportThing(cid, original_position)
                doRemoveCondition(cid, CONDITION_INVISIBLE)
                doRemoveCondition(cid, CONDITION_GAMEMASTER, GAMEMASTER_INVISIBLE)
                doPlayerSetNoMove(cid, false)
                return true
            end
        until isWalkable(toPos)
    end
    doTeleportThing(cid, toPos)
    doSendMagicEffect(getThingPos(cid), config.effect)
    doCombat(cid, combat, numberToVariant(target))
    table.remove(positions, index)
    addEvent(doSpellTeleport, config.interval, cid, target, positions, original_position)
end
 
function onCastSpell(cid, var)
    local target = variantToNumber(var)
    if not isCreature(target) then
        return doPlayerSendCancel(cid, "You need a target.")
    end
    local pos = getThingPos(target)
    local posis = {
        {x = pos.x + 1, y = pos.y + 1, z = pos.z},
        {x = pos.x + 1, y = pos.y - 1, z = pos.z},
        {x = pos.x - 1, y = pos.y + 1, z = pos.z},
        {x = pos.x - 1, y = pos.y - 1, z = pos.z}
    }
    doAddCondition(cid, invisibility)
    doAddCondition(cid, outfit)
    doPlayerSetNoMove(cid, true)
    doSpellTeleport(cid, target, posis, getThingPos(cid))
    return true
end
Editado por zipter98
Link para o comentário
Compartilhar em outros sites

  • 0

tenta essa (achei no forum):

 

tag:

<instant name="tp attack" words="tp attack" lvl="10" mana="200" aggressive="1" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="tpattack.lua">

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

function getDamage(cid, level, magic)
return -(level * 5 + magic * 12), -(level * 5 + magic * 12 + 55)
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "getDamage")

function onCastSpell(cid, var)

    local target = getCreatureTarget(cid)
    if target <= 1 then
	    doPlayerSendCancel(cid, "You need a target.")
    return false
    end
    
    if not isSightClear(getThingPos(cid), getThingPos(target), false) then
	    doPlayerSendCancel(cid, "You can't reach that place.")
    return false
    end
    
    local targetPos = getThingPos(target)
    local directions = {0, 1, 2, 3, 4, 5, 6, 7}
    local teleportPos = {}
    for _ = 1, #directions do
	    local random = math.random(#directions)
	    local dir = directions[random]
	    table.remove(directions, random)
	    local newPos = getPosByDir(targetPos, dir)
	    if doTileQueryAdd(cid, newPos, 0, false) == 1 then
		    teleportPos = newPos
		    break
	    end
    end
    
    if teleportPos.x and doTileQueryAdd(cid, teleportPos, 0, false) == 1 then
	    doCombat(cid, combat, var)
	    doTeleportThing(cid, teleportPos, false)
    return true
    end
    
    doPlayerSendCancel(cid, "You cannot teleport there.")
return false
end

uma dica já que você é novo, o xtibia tem muito conteúdo, é só procurar um pouco que acha, utiliza a ferramenta search /\ ajuda demais ^.^ fica a dica. se este script não funcionar você me fala.

 

edit: se essa não funcionar eu faço pra você uma.

Editado por Janmix
Link para o comentário
Compartilhar em outros sites

  • 0

Quais seriam as posições de teleporte do usuário da magia? Seriam SQMs relativos aos pontos cardeais do alvo?

Um vídeo ou GIF ajudaria, caso essa spell já exista.

Editado por zipter98
Link para o comentário
Compartilhar em outros sites

  • 0

Quais seriam as posições de teleporte do usuário da magia? Seriam SQMs relativos aos pontos cardeais do alvo?

Um vídeo ou GIF ajudaria, caso essa spell já exista.

 

Achei uma script que faz quase oque eu quero, mas queria fazer com que a outfit do player que usar a spell mude durante os teleports se possível para um effect caso não for possível uma outfit normal mesmo.

os sqm desse scripts parecem ser aleatórios, mas isso não é muito bom porque os sqm podem se repetir, se possivel deixar os hits nas diagonais do alvo sem preferencia de ordem.

 

 

local quant_hit = 4 -- quantidade de hit's que ira dar no target

local timeHit = 0.5 -- segundos de diferença para cada hit
local quant_sqm = 0 -- sqms que ira empurrar o target
local sqmTime = 0.01 -- segundos para empurrar após hitar, exemplo de meio segundo.
local playerEffect1864 = 10 -- efeito no player.
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1, 0, 1, 0)
local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
setConditionParam(condition, CONDITION_PARAM_SPEED, -1450)
setConditionFormula(condition, 0, 0, 0, 0)
setCombatCondition(combat, condition)
function onCastSpell(cid, var)
local target = getCreatureTarget(cid)
if target > 0 then
local position_target = nil
local cont = 0
for i=-1, 1 do
for j=-1,1 do
position_target = {x=getCreaturePosition(target).x+i, y=getCreaturePosition(target).y+j, z=getCreaturePosition(target).z}
if isWalkable(position_target) then
cont = cont+1
break
end
end
if cont > 0 then
break
end
position_target = nil
end
local px = math.random(-1,1)
local py = 0
if px == -1 or px == 1 then
py = 0
elseif px == 0 then
local n = {1,-1}
py = n[math.random(1,#n)]
end
local poscentral = {x=getCreaturePosition(target).x+px, y=getCreaturePosition(target).y+py, z=getCreaturePosition(target).z}
if isWalkable(poscentral) then
position_target = poscentral
end
if getDistanceBetween(getCreaturePosition(cid), getCreaturePosition(target)) <= 1 then
position_target = getCreaturePosition(cid)
end
if position_target ~= nil then
doTeleportThing(cid, position_target)
local tempo = 0
while (tempo ~= quant_hit*(timeHit*1000)) do
addEvent(sendEffect1864, tempo, cid, target)
tempo = tempo + 500
end
tempo = 0
while (tempo ~= quant_hit*(timeHit*1000)) do
addEvent(hitTarget124, tempo, cid, target)
tempo = tempo + (timeHit*1000)
end
local temp = tempo
while (tempo ~= temp+quant_sqm*(sqmTime*1000)) do
addEvent(empurrarTarget, tempo, cid, target, tempo)
tempo = tempo + (sqmTime*1000)
end
doAddCondition(cid, condition)
doAddCondition(target, condition)
return true
else
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end
else
doPlayerSendCancel(cid, "Você precisa de um target!")
end
end
function isWalkable(pos, creature, pz, proj)
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
local creature = getTopCreature(pos)
if creature.type > 0 then return false end
if getTilePzInfo(pos) and not pz then return false end
local n = not proj and 3 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 hitTarget124(cid, target)
if isCreature(target) and isPlayer(cid) then
local effect1864 = 1 -- efeito do hit na creatura.
doAddCondition(target, condition)
doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -getHit124(cid), -getHit124(cid), effect1864)
end
end
function getHit124(cid)
local hit124 = getPlayerLevel(cid)*5 + getPlayerMagLevel(cid)*5 + math.random(21650,21750)
return hit124
end
function empurrarTarget(cid, target, tempo)
if isPlayer(cid) then
doRemoveCondition(cid, CONDITION_PARALYZE)
end
if isCreature(target) and isPlayer(cid) then
local positions = nil
doAddCondition(target, condition)
if getPlayerLookDir(cid) == 0 then
positions = {x=getCreaturePosition(target).x, y=getCreaturePosition(target).y-1, z=getCreaturePosition(target).z}
elseif getPlayerLookDir(cid) == 1 then
positions = {x=getCreaturePosition(target).x+1, y=getCreaturePosition(target).y, z=getCreaturePosition(target).z}
elseif getPlayerLookDir(cid) == 2 then
positions = {x=getCreaturePosition(target).x, y=getCreaturePosition(target).y+1, z=getCreaturePosition(target).z}
elseif getPlayerLookDir(cid) == 3 then
positions = {x=getCreaturePosition(target).x-1, y=getCreaturePosition(target).y, z=getCreaturePosition(target).z}
end
if positions ~= nil and isWalkable(positions) then
doTeleportThing(target, positions)
end
local tp = sqmTime*1000*(quant_sqm-1)+quant_hit*timeHit*1000
if tempo == tp then
doRemoveCondition(target, CONDITION_PARALYZE)
end
end
end
function sendEffect11864(cid, target)
local position1 = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z}
local position2 = {x=getThingPosition(getCreatureTarget(cid)).x+1, y=getThingPosition(getCreatureTarget(cid)).y+1, z=getThingPosition(getCreatureTarget(cid)).z}
if isCreature(target) and isPlayer(cid) then
doSendMagicEffect(position1, 95)
doSendMagicEffect(position2, 197)
end

end

 

Link para o comentário
Compartilhar em outros sites

  • 0

Se possível, teste essa magia novamente, entretanto a observe em outro personagem que não seja o usuário da magia. Apesar de nunca ter visto em prática as condições que usei, se não me engano o jogador fica invisível apenas para outras criaturas.

PS: Certifique-se de ter atualizado o código. Há alguns minutos eu fiz umas pequenas modificações nele.

Editado por zipter98
Link para o comentário
Compartilhar em outros sites

  • 0

Qual seria o segundo efeito? Desculpe, sou meio lerdo.

Mudei o efeito"xxxx" para ficar mais fácil indentificar ficam dois effects no mesmo lugar e o effect"xxx" fica um pouco mais a direita e pra baixo(essas linhas petras são um effeito e o sangue outro)

e7f8cj.png

Editado por narutomaniacos
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...