• 🏆 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 simplify a trigger with player bumber

Status
Not open for further replies.
Level 1
Joined
May 22, 2010
Messages
2
Hello everyone. I’d like to ask for help about how to simplify my trigger.

When activates, this ability adds a number of units into a group for a duration, separated by their respective player numbers.
(Assuming 2 or more players playing the same type of Hero)
These groups will be cleared when their respective duration expires.

So I set my trigger up like this:

trigger.jpg

and so on…

Is there any way to simplify it?
I just wonder; if there are more actions involving player numbers, this trigger would be extremely long and complicated to edit after.

Thank you so much for help.
 
Level 25
Joined
Sep 26, 2009
Messages
2,381
Yes, there is an easier way: use loops.

  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • For each (Integer Loop_var) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for Abil_Timer[Loop_var]) Equal to 0.00
            • Then - Actions
              • Unit Group - Remove all units from UnitGroup[Loop_var]
            • Else - Actions
Loop_var is integer variable.

Also, do not use "Do nothing" unless necessary. That function really does nothing but take your PCs resources.

However this will also fire for timers which already finished expiration. I had similar problem regarding multiple timers firing one trigger and we solved it by using hashtable. Check this thread: http://www.hiveworkshop.com/forums/world-editor-help-zone-98/finding-out-timer-fired-trigger-246239/
 
Status
Not open for further replies.
Top