• 🏆 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] Multiple Pick Every Units?

Status
Not open for further replies.
Level 6
Joined
Aug 12, 2007
Messages
201
This is my Watch Tower trigger

  • Watch Tower Alert Copy
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Watch Post
              • (Owner of (Picked unit)) Equal to Player 1 (Red)
            • Then - Actions
              • Set TempTowerPoint = (Position of (Picked unit))
              • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) belongs to an ally of Player 1 (Red)) Equal to False
                      • ((Picked unit) is in WatchedUnitsRed) Equal to False
                    • Then - Actions
                      • Set TempPingPosition = (Position of (Picked unit))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Distance between TempTowerPoint and TempPingPosition) Less than or equal to 1800.00
                        • Then - Actions
                          • Unit Group - Add (Picked unit) to WatchedUnitsRed
                          • Cinematic - Ping minimap for (All allies of Player 1 (Red)) at TempPingPosition for 1.00 seconds
                          • Custom script: call RemoveLocation(udg_TempPingPosition)
                          • Custom script: call RemoveLocation(udg_TempTowerPoint)
                        • Else - Actions
                    • Else - Actions
            • Else - Actions
It sorta works as intended, only it pings each new unit in range one at a time. Ping, ping, ping, ping, one new ping each second for each unit. I wanted it to ping all units entering the range of a tower. 50 pings all at once for all the new units. How do I modify it for this?
 
Last edited:
Unless the watch towers are not pre-set, you can do this:
  • Map Initialization
  • Events
    • Time - Every 0.1 seconds of game-time
  • Conditions
  • Actions
    • Set WatchTowerGroup = (Units in (Playable Map Area) matching ((Unit-type of (Matching unit) Equal to Watch Tower)
    • Unit Group - Pick up every unit in (WatchTowerGroup) and do (Actions)
      • Loop - Actions
        • Set Point1 = (Position of (Picked unit))
        • Trigger - Add to Trigger2 <gen> the event (Unit - A unit comes within 1800.00 of (Point1))
    • Custom script: call DestroyGroup (udg_WatchTowerGroup)
  • Trigger2
  • Events
  • Conditions
    • ((Triggering unit) belongs to an ally of (Player 1 (Red))) Equal to False
    • ((Triggering unit) is in WatchedUnitsRed) Equal to False
  • Actions
    • Set Point2 = (Position of (Triggering unit))
    • Unit - Add (Triggering unit) to WatchedUnitsRed
    • Cinematic - Ping minimap for (All allies of Player 1 (Red)) at Point1 for 1.00 seconds
    • Custom script: call RemoveLocation (udg_Point2)
 
Level 6
Joined
Aug 12, 2007
Messages
201
The towers are not preset, players can build them at any time anywhere. I also expanded on my original trigger to a more functioning version if you'd like to take a look at that one.
 
Status
Not open for further replies.
Top