• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] How to Preventing Damage Looping

Status
Not open for further replies.
Level 13
Joined
Jan 30, 2012
Messages
1,298
someone know how to prevent damage looping?
[TRIGGER=Elemental Wave Loop]Elemental Wave Loop
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
For each (Integer Current_Index) from 1 to Max_Index, do (Actions)
Loop - Actions
Set TempPoint = (Position of EW_Dummy[Current_Index])
Set TempPoint2 = (TempPoint offset by (EW_Speed[Current_Index] x 0.03) towards EW_Angle[Current_Index] degrees)
Unit - Move EW_Dummy[Current_Index] instantly to TempPoint2
Special Effect - Create a special effect at TempPoint using EW_SFX[1]
Special Effect - Destroy (Last created special effect)
Set DamageGroup[Current_Index] = (Units within EW_AoE[EW_Level[Current_Index]] of TempPoint matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of EW_Caster[Current_Index])) Equal to True) and ((((Matching unit) is A structure) Not equal
Unit Group - Pick every unit in DamageGroup[Current_Index] and do (Actions)
Loop - Actions
Set TempUnit = (Picked unit)
Unit - Cause EW_Caster[Current_Index] to damage TempUnit, dealing Damage[(Level of EW_Ability for EW_Caster[Current_Index])] damage of attack type Spells and damage type Normal
Special Effect - Create a special effect attached to the chest of TempUnit using EW_SFX[2]
Special Effect - Destroy (Last created special effect)
Unit Group - Add TempUnit to UndamageGroup[Current_Index]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
EW_DestroyTree Equal to True
Then - Actions
Destructible - Pick every destructible within EW_AoE[EW_Level[Current_Index]] of TempPoint and do (Actions)
Loop - Actions
Destructible - Kill (Picked destructible)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(EW_Dummy[Current_Index] is dead) Equal to True
Then - Actions
Custom script: call DestroyGroup(udg_UndamageGroup[udg_Current_Index])
Unit - Remove EW_Dummy[Current_Index] from the game
Set EW_Dummy[Current_Index] = EW_Dummy[Max_Index]
Set EW_Dummy[Max_Index] = No unit
Set EW_Caster[Current_Index] = EW_Caster[Max_Index]
Set EW_Caster[Max_Index] = No unit
Set EW_Angle[Current_Index] = EW_Angle[Max_Index]
Set EW_Angle[Max_Index] = 0.00
Set Current_Index = (Current_Index - 1)
Set Max_Index = (Max_Index - 1)
Else - Actions
Custom script: call DestroyGroup(udg_DamageGroup[udg_Current_Index])
Custom script: call RemoveLocation(udg_TempPoint)
Custom script: call RemoveLocation(udg_TempPoint2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Max_Index Equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
[/TRIGGER]
 
Status
Not open for further replies.
Top