I am trying to hit the same enemy two times with 500ms interval but i am not sure how I could do that
this code works but it only hits the enemy once and the effect only shows once as well |:
SOLVED and if anyone is still curious here's the solution:
1. Add additional function
2. Update your second function
this code works but it only hits the enemy once and the effect only shows once as well |:
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 29)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -90.2, 1, -95.2, 1)
local combat2 = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -90.2, 1, -95.2, 1)
function onCastSpell(cid, var)
local position1 = {x=getCreaturePosition(getCreatureTarget(cid)).x+2, y=getCreaturePosition(getCreatureTarget(cid)).y, z=getCreaturePosition(getCreatureTarget(cid)).z}
doSendMagicEffect(position1, 5)
doSendMagicEffect(position1, 5)
return doCombat(cid, combat, var)
end
SOLVED and if anyone is still curious here's the solution:
1. Add additional function
Lua:
function effect(cid)
local position1 = {x=getCreaturePosition(getCreatureTarget(cid)).x+2, y=getCreaturePosition(getCreatureTarget(cid)).y, z=getCreaturePosition(getCreatureTarget(cid)).z}
doSendMagicEffect(position1, 5)
end
2. Update your second function
Lua:
function onCastSpell(cid, var)
addEvent(effect, 0, cid)
addEvent(effect, 500, cid)
return doCombat(cid, combat, var)
end
Last edited by a moderator: