Ir para conteúdo
  • 0

Guizera123

Pergunta

Salve comunidade, estou com um problema em duas magias que possuem a função addEvent.

Caso algum programador queira me ajudar, ficarei grato.

Versão 10.96, TFS 1.2

 

Spells:

 

Spoiler

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, TRUE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, TRUE)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, -60, 0.8, 0)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_BLOCKARMOR, TRUE)
setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE)
setCombatParam(combat2, COMBAT_PARAM_USECHARGES, TRUE)
setCombatFormula(combat2, COMBAT_FORMULA_SKILL, 0, -60, 0.8, 0)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_BLOCKARMOR, TRUE)
setCombatParam(combat3, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE)
setCombatParam(combat3, COMBAT_PARAM_USECHARGES, TRUE)
setCombatFormula(combat3, COMBAT_FORMULA_SKILL, 0, -60, 0.8, 0)


function onCastSpell(cid, var) 
local parameters = { cid = cid, var = var, combat = combat, combat2 = combat2, combat3 = combat3 }
addEvent(doCombat, 200, cid, combat, var)   -- 600 = é o tempo entre cada hit
addEvent(doCombat, 400, cid, combat2, var)    -- 800 = é o tempo entre cada hit
addEvent(doCombat, 600, cid, combat3, var)    -- 1000 = é o tempo entre cada hit
return TRUE
end

 

Spoiler

local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_AGGRESSIVE, true)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
setCombatParam(combat1, COMBAT_PARAM_CREATEITEM, 1497)


local combat2 = createCombatObject()
function spellCallback2(param)
if param.count > 0 or math.random(0, 1) == 1 then
doSendMagicEffect(param.pos, CONST_ME_EXPLOSIONHIT)
doAreaCombatHealth(param.cid, COMBAT_PHYSICALDAMAGE, param.pos, 0, -300, -1000, CONST_ME_BLOCKHIT)
end

if(param.count < 5) then
param.count = param.count + 1
addEvent(spellCallback2, math.random(1000, 1500), param)
end
end

function onTargetTile(cid, pos)
local param = {}
param.cid = cid
param.pos = pos
param.count = 0
spellCallback2(param)
end

setCombatCallback(combat2, CALLBACK_PARAM_TARGETTILE, "onTargetTile")


local arr1 = {
{ 1, 1, 1, 1, 1, },
{ 1, 0, 0, 0, 1, },
{ 1, 0, 3, 0, 1, },
{ 1, 0, 0, 0, 1, },
{ 1, 1, 1, 1, 1, },
}

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

local area1 = createCombatArea(arr1)
setCombatArea(combat1, area1)

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

local function onCastSpell1(parameters)
doCombat(parameters.cid, parameters.combat1, parameters.var)
end
local function onCastSpell2(parameters)
doCombat(parameters.cid, parameters.combat2, parameters.var)
end

function onCastSpell(cid, var) 
local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2 }
addEvent(doCombat, 0, cid, combat1, var)
addEvent(doCombat, 0, cid, combat2, var)
return TRUE
end

 

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 0
Aqui está...addEvent(doCombat, 200, cid, combat, var)addEvent(doCombat, 400, cid, combat2, var)addEvent(doCombat, 600, cid, combat3, var)Para:addEvent(doCombat, 200, cid.uid, combat, var)addEvent(doCombat, 400, cid.uid, combat2, var)addEvent(doCombat, 600, cid.uid, combat3, var)

 

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...