- Joined
- Aug 3, 2005
- Messages
- 150
Hi, I want to make a spell that casts an immolation on any unit and damages all nearby units over time. I've started using jass so I could use local variables, since at one of the levels the duration of the spell will be higher than the cooldown. The problem is that it only half works, both instances of the spell work for a few seconds then both finish at the same time (earlier than at least one of them should).
Level_SETONFIRE = Level of the ability
Target_SETONFIRE = Target of the ability
Caster_SETONFIRE = Caster of the ability
Wait before loop for animation and buff purposes (this is fine tuned)
Loop: Damages area near target, waits 1 second, repeat if target isn't dead or has removed buff
edit: note that it works perfectly fine if i have just one instance of the spell running at a time
Code:
function Trig_SET_ON_FIRE_Actions takes nothing returns nothing
local integer Level_SETONFIRE
local unit Target_SETONFIRE
local unit Caster_SETONFIRE
set Level_SETONFIRE = GetUnitAbilityLevelSwapped('A000', GetSpellAbilityUnit())
set Target_SETONFIRE = GetSpellTargetUnit()
set Caster_SETONFIRE = GetSpellAbilityUnit()
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = ( 6 + ( 2 * Level_SETONFIRE ) )
call PolledWait( 0.51 )
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if ( GetBooleanAnd( IsUnitAliveBJ(Target_SETONFIRE), UnitHasBuffBJ(Target_SETONFIRE, 'B000') ) )then
call UnitDamagePointLoc( Caster_SETONFIRE, 0, ( 145.00 + ( 15.00 * Level_SETONFIRE ) ), GetUnitLoc(Target_SETONFIRE), (6 + (5 * Level_SETONFIRE) ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
call PolledWait( 1.00 )
else
call DoNothing( )
set bj_forLoopAIndex = bj_forLoopAIndexEnd + 1
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
Target_SETONFIRE = Target of the ability
Caster_SETONFIRE = Caster of the ability
Wait before loop for animation and buff purposes (this is fine tuned)
Loop: Damages area near target, waits 1 second, repeat if target isn't dead or has removed buff
edit: note that it works perfectly fine if i have just one instance of the spell running at a time