Ir para conteúdo
  • Cadastre-se

(Resolvido)[PEDIDO] Spells


Ir para solução Resolvido por PedroSTT,

Posts Recomendados

Bom sou novo no fórum, não sei se pode fazer isto ou estou no local errado.

Mas gostaria de pedir 4 Spells.
 

Como funciona as spells:
 

Uma spell funcionaria assim, o player X teleportaria  para atras do target(player ou monstros)  causando dano ao target.
A segunda spell funcionaria da seguinte maneira, O player X empurra o target (player ou monstros) para longe ,causando dano ao target,e depois surge ao lado dele.

Outra Spell seria uma paralizia que funciona assim o player usa o spell e seu próximo hit(spell ou ataque) paraliza o alvo.
E por último mas não menos importante uma skill que desse um buff ao player X ,assim ele ganha + velocidade de ataque por um certo tempo.

Todas essas spell iriam ter um certo tempo de colldown.

Espero AJUDA!

 

Utilizo um servidor derivado de dbo!

Link para o post
Compartilhar em outros sites
  • Solução

Spell 01

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -3.2, -0 , -2.2, -0)

function onCastSpell(cid, var)

local waittime = 0.5 -- Tempo de exhaustion
local storage = 1000
local efeito = 3 -- efeito da spell

if exhaustion.check(cid, storage) then

    doPlayerSendCancel(cid, "You are exhausted")
    
return false
end


local position1 = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
local target = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
doSendMagicEffect(position1, efeito)
doTeleportThing(cid, target)
exhaustion.set(cid, storage, waittime)
return doCombat(cid, combat, var)
end

Spell 02 -- crédito xWhiteWolf

local function doPushCreature(target, cid)
    if target > 0 then
   if not isNpc(target) then
   local position = getThingPosition(cid)
   local fromPosition = getThingPosition(target)
   local x = ((fromPosition.x - position.x) < 0 and -1 or ((fromPosition.x - position.x) == 0 and 0 or 1))
   local y = ((fromPosition.y - position.y) < 0 and -1 or ((fromPosition.y - position.y) == 0 and 0 or 1))
   local toPosition = {x = fromPosition.x + x, y = fromPosition.y + y, z = fromPosition.z}
   if doTileQueryAdd(target, toPosition) == 1 and getTileInfo(toPosition).house == false then
   doTeleportThing(target, toPosition, true)
   end
   end
    end
end
local spell = {}
spell.config = {
    [3] = {
   damageType = 1,
   areaEffect = 2,
   area = {
{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, 1, 0, 0, 0, 1, 0, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
{0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
{0, 0, 0, 1, 0, 0, 0, 1, 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},
   }   
    },
    [2] = {
   damageType = 1,
   areaEffect = 2,
   area = {
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 1, 0, 0, 0, 1, 0},
   {0, 1, 0, 2, 0, 1, 0},
   {0, 1, 0, 0, 0, 1, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 0, 0, 0, 0, 0, 0}
   }   
    },
    [1] = {
   damageType = 1,
   areaEffect = 2,
   area = {
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 0, 1, 2, 1, 0, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, 0}
   }   
    }
}
  
spell.combats = {}
for _, config in ipairs(spell.config) do
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, config.damageType)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, config.areaEffect)
    setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -4, 0, -4.7, 0)
    function onTargetCreature(cid, target)
   doPushCreature(target, cid)
    end
    setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
    setCombatArea(combat, createCombatArea(config.area))
    table.insert(spell.combats, combat)
end
function onCastSpell(cid, var)
    for n = 1, #spell.combats do
    local alvo = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
   addEvent(doCombat, (n * 120), cid, spell.combats[n], var)
   addEvent(doTeleportThing, 3000, cid, alvo)
    end
    return true
end


Spell 03

Spell script

Spoiler

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 6)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -3.2, -0 , -2.2, -0)

function onCastSpell(cid, var)

local waittime = 0.5 -- Tempo de exhaustion
local storage = 1000
local storage2 = 3352   -- storage do paralize
local efeito = 3 -- efeito da spell
local tempo = 5 -- segundos q ficara paralizado
local time = tempo * 1000

if exhaustion.check(cid, storage) then

    doPlayerSendCancel(cid, "You are exhausted")
    
return false
end


local position1 = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
doSendMagicEffect(position1, efeito)
exhaustion.set(cid, storage, waittime)
setPlayerStorageValue(cid, storage + os.time + time, 1)
return doCombat(cid, combat, var)
end

 

Agora vá em creaturescripts

Creaturescripts.xml e registre a tag

<event type="think" name="Paralize" event="script" value="paralize.lua"/>

Crie um arquivo.lua na pasta creaturescrips/scripts e cole isso dentro

function onThink(cid, interval)

local storage = 23432  -- deixe a mesma que na script da spell

if getPlayerStorageValue(cid, storage) == 1 then

   doCreatureSetNoMove(cid, true)
   doPlayerSendTextMessage(cid, 22, "voce esta paralisado")
   
return true
end
end

Abra o login.lua na msm pasta e registre a tag.

registerCreatureEvent(cid, "Paralize")

 

giphy.gif

Link para o post
Compartilhar em outros sites
Em 20/07/2017 ás 15:51, PedroSTT disse:

Spell 01


local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -3.2, -0 , -2.2, -0)

function onCastSpell(cid, var)

local waittime = 0.5 -- Tempo de exhaustion
local storage = 1000
local efeito = 3 -- efeito da spell

if exhaustion.check(cid, storage) then

    doPlayerSendCancel(cid, "You are exhausted")
    
return false
end


local position1 = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
local target = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
doSendMagicEffect(position1, efeito)
doTeleportThing(cid, target)
exhaustion.set(cid, storage, waittime)
return doCombat(cid, combat, var)
end

Spell 02 -- crédito xWhiteWolf


local function doPushCreature(target, cid)
    if target > 0 then
   if not isNpc(target) then
   local position = getThingPosition(cid)
   local fromPosition = getThingPosition(target)
   local x = ((fromPosition.x - position.x) < 0 and -1 or ((fromPosition.x - position.x) == 0 and 0 or 1))
   local y = ((fromPosition.y - position.y) < 0 and -1 or ((fromPosition.y - position.y) == 0 and 0 or 1))
   local toPosition = {x = fromPosition.x + x, y = fromPosition.y + y, z = fromPosition.z}
   if doTileQueryAdd(target, toPosition) == 1 and getTileInfo(toPosition).house == false then
   doTeleportThing(target, toPosition, true)
   end
   end
    end
end
local spell = {}
spell.config = {
    [3] = {
   damageType = 1,
   areaEffect = 2,
   area = {
{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, 1, 0, 0, 0, 1, 0, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
{0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
{0, 0, 0, 1, 0, 0, 0, 1, 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},
   }   
    },
    [2] = {
   damageType = 1,
   areaEffect = 2,
   area = {
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 1, 0, 0, 0, 1, 0},
   {0, 1, 0, 2, 0, 1, 0},
   {0, 1, 0, 0, 0, 1, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 0, 0, 0, 0, 0, 0}
   }   
    },
    [1] = {
   damageType = 1,
   areaEffect = 2,
   area = {
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 0, 1, 2, 1, 0, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, 0}
   }   
    }
}
  
spell.combats = {}
for _, config in ipairs(spell.config) do
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, config.damageType)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, config.areaEffect)
    setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -4, 0, -4.7, 0)
    function onTargetCreature(cid, target)
   doPushCreature(target, cid)
    end
    setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
    setCombatArea(combat, createCombatArea(config.area))
    table.insert(spell.combats, combat)
end
function onCastSpell(cid, var)
    for n = 1, #spell.combats do
    local alvo = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
   addEvent(doCombat, (n * 120), cid, spell.combats[n], var)
   addEvent(doTeleportThing, 3000, cid, alvo)
    end
    return true
end


Spell 03

Spell script

  Mostrar conteúdo oculto

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 6)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -3.2, -0 , -2.2, -0)

function onCastSpell(cid, var)

local waittime = 0.5 -- Tempo de exhaustion
local storage = 1000
local storage2 = 3352   -- storage do paralize
local efeito = 3 -- efeito da spell
local tempo = 5 -- segundos q ficara paralizado
local time = tempo * 1000

if exhaustion.check(cid, storage) then

    doPlayerSendCancel(cid, "You are exhausted")
    
return false
end


local position1 = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
doSendMagicEffect(position1, efeito)
exhaustion.set(cid, storage, waittime)
setPlayerStorageValue(cid, storage + os.time + time, 1)
return doCombat(cid, combat, var)
end

 

Agora vá em creaturescripts

Creaturescripts.xml e registre a tag


<event type="think" name="Paralize" event="script" value="paralize.lua"/>

Crie um arquivo.lua na pasta creaturescrips/scripts e cole isso dentro


function onThink(cid, interval)

local storage = 23432  -- deixe a mesma que na script da spell

if getPlayerStorageValue(cid, storage) == 1 then

   doCreatureSetNoMove(cid, true)
   doPlayerSendTextMessage(cid, 22, "voce esta paralisado")
   
return true
end
end

Abra o login.lua na msm pasta e registre a tag.


registerCreatureEvent(cid, "Paralize")

 

Vlw Cara Muito Obrigado! REP+

@PedroSTT Para ir para trás do alvo no 1° Spell:

Substitui a linha:

local target = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}

por: 

local target = {x=getThingPosition(getCreatureTarget(cid)).x-0, y=getThingPosition(getCreatureTarget(cid)).y-1, z=getThingPosition(getCreatureTarget(cid)).z}

 

Mas está funcionando perfeitamente! OBRIGADO!

 

O 2° Spell: Esta empurrando para longe,mas depois surge onde estava o target na posição inicial.( antes de ser empurrado)

 

Estou tendo este erro no 2° Spell:

[17:50:36.238] [Error - Spell Interface]
[17:50:36.238] In a callback: data/spells/scripts/Zaion/para longe.lua:onTargetCreature
[17:50:36.238] (Unknown script file)
[17:50:36.238] Description:
[17:50:36.238] (luaDoTileQueryAdd) Tile not found

 

O 3° Spell você pode me explicar como funciona o storage, tem que colocar algum específico? ( não sei sobre storage,se puder explicar)

O 3° Spell da o seguinte error:
[18:22:06.507] [Error - Spell Interface]
[18:22:06.508] data/spells/scripts/Zaion/parado.lua:onCastSpell
[18:22:06.509] Description:
[18:22:06.511] data/spells/scripts/Zaion/parado.lua:21: attempt to perform arithmetic on field 'time' (a function value)
[18:22:06.512] stack traceback:
[18:22:06.513]  data/spells/scripts/Zaion/parado.lua:21: in function <data/spells/scripts/Zaion/parado.lua:5>

 

Namoral tu é mt fera mano já me ajudo bastante!
 

 

Editado por TheKiler
Paralizar error (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 3 months later...
Em 20/07/2017 em 15:51, PedroSTT disse:

Spell 01


local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -3.2, -0 , -2.2, -0)

function onCastSpell(cid, var)

local waittime = 0.5 -- Tempo de exhaustion
local storage = 1000
local efeito = 3 -- efeito da spell

if exhaustion.check(cid, storage) then

    doPlayerSendCancel(cid, "You are exhausted")
    
return false
end


local position1 = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
local target = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
doSendMagicEffect(position1, efeito)
doTeleportThing(cid, target)
exhaustion.set(cid, storage, waittime)
return doCombat(cid, combat, var)
end

Spell 02 -- crédito xWhiteWolf


local function doPushCreature(target, cid)
    if target > 0 then
   if not isNpc(target) then
   local position = getThingPosition(cid)
   local fromPosition = getThingPosition(target)
   local x = ((fromPosition.x - position.x) < 0 and -1 or ((fromPosition.x - position.x) == 0 and 0 or 1))
   local y = ((fromPosition.y - position.y) < 0 and -1 or ((fromPosition.y - position.y) == 0 and 0 or 1))
   local toPosition = {x = fromPosition.x + x, y = fromPosition.y + y, z = fromPosition.z}
   if doTileQueryAdd(target, toPosition) == 1 and getTileInfo(toPosition).house == false then
   doTeleportThing(target, toPosition, true)
   end
   end
    end
end
local spell = {}
spell.config = {
    [3] = {
   damageType = 1,
   areaEffect = 2,
   area = {
{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, 1, 0, 0, 0, 1, 0, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
{0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
{0, 0, 0, 1, 0, 0, 0, 1, 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},
   }   
    },
    [2] = {
   damageType = 1,
   areaEffect = 2,
   area = {
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 1, 0, 0, 0, 1, 0},
   {0, 1, 0, 2, 0, 1, 0},
   {0, 1, 0, 0, 0, 1, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 0, 0, 0, 0, 0, 0}
   }   
    },
    [1] = {
   damageType = 1,
   areaEffect = 2,
   area = {
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 0, 1, 2, 1, 0, 0},
   {0, 0, 1, 1, 1, 0, 0},
   {0, 0, 0, 0, 0, 0, 0},
   {0, 0, 0, 0, 0, 0, 0}
   }   
    }
}
  
spell.combats = {}
for _, config in ipairs(spell.config) do
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, config.damageType)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, config.areaEffect)
    setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -4, 0, -4.7, 0)
    function onTargetCreature(cid, target)
   doPushCreature(target, cid)
    end
    setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
    setCombatArea(combat, createCombatArea(config.area))
    table.insert(spell.combats, combat)
end
function onCastSpell(cid, var)
    for n = 1, #spell.combats do
    local alvo = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
   addEvent(doCombat, (n * 120), cid, spell.combats[n], var)
   addEvent(doTeleportThing, 3000, cid, alvo)
    end
    return true
end


Spell 03

Spell script

  Mostrar conteúdo oculto

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 6)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -3.2, -0 , -2.2, -0)

function onCastSpell(cid, var)

local waittime = 0.5 -- Tempo de exhaustion
local storage = 1000
local storage2 = 3352   -- storage do paralize
local efeito = 3 -- efeito da spell
local tempo = 5 -- segundos q ficara paralizado
local time = tempo * 1000

if exhaustion.check(cid, storage) then

    doPlayerSendCancel(cid, "You are exhausted")
    
return false
end


local position1 = {x=getThingPosition(getCreatureTarget(cid)).x, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
doSendMagicEffect(position1, efeito)
exhaustion.set(cid, storage, waittime)
setPlayerStorageValue(cid, storage + os.time + time, 1)
return doCombat(cid, combat, var)
end

 

Agora vá em creaturescripts

Creaturescripts.xml e registre a tag


<event type="think" name="Paralize" event="script" value="paralize.lua"/>

Crie um arquivo.lua na pasta creaturescrips/scripts e cole isso dentro


function onThink(cid, interval)

local storage = 23432  -- deixe a mesma que na script da spell

if getPlayerStorageValue(cid, storage) == 1 then

   doCreatureSetNoMove(cid, true)
   doPlayerSendTextMessage(cid, 22, "voce esta paralisado")
   
return true
end
end

Abra o login.lua na msm pasta e registre a tag.


registerCreatureEvent(cid, "Paralize")

 

@PedroSTT Só 1 erro , no primeiro spell se não houver target selecionado , fica dando muito erro na distro. Seguinte Error:

[21:12:53.403] [Error - Spell Interface]
[21:12:53.403] data/spells/scripts/Teste/investida.lua:onCastSpell
[21:12:53.403] Description:
[21:12:53.403] (luaGetThingPosition) Thing not found

 

Sabe como arrumar?

 

No 2° Spell Teria como que ele só empurrasse todos que estão em volta e não precisa ir até o target.
Ou seja seria uma skill em área que ele iria jogar todos os monstros ou player's em volta para longe e daria dano a esses player's.

Editado por TheKiler (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

@TheKiler 

 

na tag da primeira spell você deixa  needtarget="1"

 

na spell2 deixa isso:

 

Spoiler

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 2)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -9.0, -30, -10.0, 4)

local arr = {
				{1,1,1},
				{1,3,1},
				{1,1,1}
}

local area = createCombatArea(arr)
setCombatArea(combat, area)



function canWalk(pos, creature, pz, proj) -- nord
	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)) and (hasProperty(tile.uid, n) or hasProperty(tile.uid, 7)) then
				return false
		end
	end
	return true
end


function onCastSpell(cid)
	for x=-1,1 do
		for y =-1,1 do
			local pos = getThingPos(cid)
			pos.x = pos.x + x
			pos.y = pos.y + y
			local m = getTopCreature(pos).uid
			if m ~= 0 then
				pos.x = pos.x + x
				pos.y = pos.y + y
				if canWalk(pos) == true then
					doTeleportThing(m,pos)
				end
			end
		end
	end
	doCombat(cid, combat, var)
	return true
end

 

 

Editado por antharaz (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
24 minutos atrás, antharaz disse:

@TheKiler 

 

na tag da primeira spell você deixa  needtarget="1"

 

na spell2 deixa isso:

 

  Ocultar conteúdo


local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 2)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -9.0, -30, -10.0, 4)

local area = {
				{1,1,1},
				{1,3,1},
				{1,1,1}
}

local area = createCombatArea(arr)
setCombatArea(combat, area)



function canWalk(pos, creature, pz, proj) -- nord
	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)) and (hasProperty(tile.uid, n) or hasProperty(tile.uid, 7)) then
				return false
		end
	end
	return true
end


function onCastSpell(cid)
	for x=-1,1 do
		for y =-1,1 do
			local pos = getThingPos(cid)
			pos.x = pos.x + x
			pos.y = pos.y + y
			local m = getTopCreature(pos).uid
			if m ~= 0 then
				pos.x = pos.x + x
				pos.y = pos.y + y
				if canWalk(pos) == true then
					doTeleportThing(m,pos)
				end
			end
		end
	end
	doCombat(cid, combat, var)
	return true
end

 

 

VLW MANO! REP+, Mas aonde está o needtarget?

 

@antharaz

32 minutos atrás, antharaz disse:

@TheKiler 

 

na tag da primeira spell você deixa  needtarget="1"

 

na spell2 deixa isso:

 

  Mostrar conteúdo oculto


local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 2)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -9.0, -30, -10.0, 4)

local area = {
				{1,1,1},
				{1,3,1},
				{1,1,1}
}

local area = createCombatArea(arr)
setCombatArea(combat, area)



function canWalk(pos, creature, pz, proj) -- nord
	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)) and (hasProperty(tile.uid, n) or hasProperty(tile.uid, 7)) then
				return false
		end
	end
	return true
end


function onCastSpell(cid)
	for x=-1,1 do
		for y =-1,1 do
			local pos = getThingPos(cid)
			pos.x = pos.x + x
			pos.y = pos.y + y
			local m = getTopCreature(pos).uid
			if m ~= 0 then
				pos.x = pos.x + x
				pos.y = pos.y + y
				if canWalk(pos) == true then
					doTeleportThing(m,pos)
				end
			end
		end
	end
	doCombat(cid, combat, var)
	return true
end

 

 

Na 2° Spell deu isto:

[Error - Spell Interface]
[15:43:13.030] data/spells/scripts/teste/2spell.lua
[15:43:13.031] Description:
[15:43:13.031] (luaSetCombatArea) Area not found

Editado por TheKiler (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

@TheKiler 

 

Se não tiver, você coloca na tag do xml. na 2º usa esse daqui:

 

Spoiler

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 2)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -9.0, -30, -10.0, 4)

local arr = {
				{1,1,1},
				{1,3,1},
				{1,1,1}
}

local area = createCombatArea(arr)
setCombatArea(combat, area)



function canWalk(pos, creature, pz, proj) -- nord
	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)) and (hasProperty(tile.uid, n) or hasProperty(tile.uid, 7)) then
				return false
		end
	end
	return true
end


function onCastSpell(cid)
	for x=-1,1 do
		for y =-1,1 do
			local pos = getThingPos(cid)
			pos.x = pos.x + x
			pos.y = pos.y + y
			local m = getTopCreature(pos).uid
			if m ~= 0 then
				pos.x = pos.x + x
				pos.y = pos.y + y
				if canWalk(pos) == true then
					doTeleportThing(m,pos)
				end
			end
		end
	end
	doCombat(cid, combat, var)
	return true
end

 

 

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo