Ir para conteúdo

Spell q empurra


rohfagundes

Posts Recomendados

seguinte eu tava tendando arrumar mas n conseguir

eu queria q essa magia só empurra-se pra frente

 

pq ela ta assim

ex o 2 é o inimigo e o - é a spell

 

2

------

------

2

ela empurra ele pra fora eu só quero q ela empurre pra frente alguem pode me ajudar

=)

 

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) == -1 and 0 or 1))

local y = ((fromPosition.y - position.y) < 0 and -1 or ((fromPosition.y - position.y) == -1 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 = {

[7] = {

damageType = 1,

areaEffect = 5,

area = {

{0, 0, 1, 0, 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, 2, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0}

}

},

[6] = {

damageType = 1,

areaEffect = 5,

area = {

{0, 0, 1, 0, 1, 0, 0},

{0, 0, 1, 0, 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, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0}

}

},

[5] = {

damageType = 1,

areaEffect = 5,

area = {

{0, 0, 1, 0, 1, 0, 0},

{0, 0, 1, 0, 1, 0, 0},

{0, 0, 1, 0, 1, 0, 0},

{0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 2, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0}

}

},

[4] = {

damageType = 1,

areaEffect = 5,

area = {

{0, 0, 0, 0, 0, 0, 0},

{0, 0, 1, 0, 1, 0, 0},

{0, 0, 1, 0, 1, 0, 0},

{0, 0, 1, 0, 1, 0, 0},

{0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 2, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0}

}

},

[3] = {

damageType = 1,

areaEffect = 5,

area = {

{0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0},

{0, 0, 1, 0, 1, 0, 0},

{0, 0, 1, 0, 1, 0, 0},

{0, 0, 1, 0, 1, 0, 0},

{0, 0, 0, 2, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0}

}

},

[2] = {

damageType = 1,

areaEffect = 5,

area = {

{0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0},

{0, 0, 1, 0, 1, 0, 0},

{0, 0, 1, 0, 1, 0, 0},

{0, 0, 1, 2, 1, 0, 0},

{0, 0, 0, 0, 0, 0, 0}

}

},

[1] = {

damageType = 1,

areaEffect = 5,

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, 0, 0},

{0, 0, 1, 0, 1, 0, 0},

{0, 0, 1, 2, 1, 0, 0},

{0, 0, 1, 0, 1, 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_SKILL, 0, -10, 0, -22)

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

addEvent(doCombat, (n * 150) - 150, cid, spell.combats[n], var)

end

return true

end

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...