• 🏆 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!

[Solved] How do I loop Actions for a Trigger?

Status
Not open for further replies.
Level 4
Joined
Nov 6, 2011
Messages
44
I've started working with triggers about a month, working up slowly from basic triggers, so excuse me if there are any obvious mistakes :)

This doesn't work:
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit - Create 5 Footman for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
      • Unit - Create 2 Rifleman for Player 2 (Blue) at (Center of Region 000 <gen>) facing Default building facing degrees
      • Unit Group - Pick every unit in (Units in Region 000 <gen> owned by Player 2 (Blue)) and do (Unit - Order (Picked unit) to Attack-Move To (Center of Region 001 <gen>))
(Excuse me if there are any more-efficient methods for spawning those units)

Basically, I can't find an action that would loop all these actions every 15 seconds. Help would be appreciated :)
 
Last edited:
Level 33
Joined
Mar 27, 2008
Messages
8,035
  • Events
    • Time - Every 15.00 seconds of game time
It's under Time - Periodic Event

You can however use Loop to create something that is repeated (like creating 5 Footman and 2 Rifleman)
But in your case, it's better to just create 5 Footman instantly, rather than to loop it, because you doesn't set any variable to each of the Footman, therefore in your case, your trigger works fine

Except, above the Unit Group action, just add this:

  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units in Region 000 <gen> owned by Player 2 (Blue)) and do (Unit - Order (Picked unit) to Attack-Move To (Center of Region 001 <gen>))
It clears the leak made by your Unit Group action
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Actually, this is a another way:


  • Untitled Trigger 003
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set point = (Center of (Playable map area))
      • Set point2 = (Center of Region 001 <gen>)
      • -------- ------------------------------------------------ --------
      • Unit - Create 3 Footman for Player 1 (Red) at point2 facing Default building facing degrees
      • Unit Group - Pick every unit in (Last created unit group) and do (Unit - Order (Picked unit) to Attack-Move To point)
      • -------- ------------------------------------------------ --------
      • Unit - Create 1 Knight for Player 1 (Red) at point2 facing Default building facing degrees
      • Unit Group - Pick every unit in (Last created unit group) and do (Unit - Order (Picked unit) to Attack-Move To point)
      • -------- ------------------------------------------------ --------
      • Custom script: call RemoveLocation(udg_point)
      • Custom script: call RemoveLocation(udg_point2)


Unit - create n units saves the created unit(s) into last created unit group. So you can use that.

About leaks: http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
 
Status
Not open for further replies.
Top