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

Victory Condition Help

Status
Not open for further replies.
Level 2
Joined
Feb 24, 2012
Messages
8
How do I create a trigger that checks every 1 second how many Heroes are in the Region, and if the number of heroes drops to 1, then gives the Victory.

Can someone please help me?
 
Level 38
Joined
Feb 27, 2007
Messages
4,951
In general the trigger editor does exactly what you want it to do with the words you used. Literally try doing the steps you just wrote in the above post.

  • Events
    • Time - Every 1.00 seconds of game-time
  • Conditions
  • Actions
    • Set TempGroup = (Units in YOUR REGION <gen> matching (((Matching unit) is a hero) equal to true))
    • If (All conditions are true) then do (Then actions) else do (Else actions)
      • If - Conditions
        • (Number of units in TempGroup) less than or equal to 1
      • Then - Actions
        • Unit Group - Pick every unit in TempGroup and do (Actions)
          • Loop - Actions
            • Game - Victory (Owner of (Picked Unit))
      • Else - Actions
    • Custom script: call DestroyGroup(udg_TempGroup) //Change the name to match your group variable but keep the udg_ prefix. This line cleans a leak; see the thread I linked below for an explanation
Memory Leaks
Things That Leak
 
Level 8
Joined
May 21, 2019
Messages
435
How do I create a trigger that checks every 1 second how many Heroes are in the Region, and if the number of heroes drops to 1, then gives the Victory.

Can someone please help me?
What Pyrogasm wrote, but also, you may wanna give the players who die a defeat as well.
 
Status
Not open for further replies.
Top