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

Status
Not open for further replies.
Level 2
Joined
Jan 27, 2014
Messages
12
Hi, i need a trigger for a victory condition.

If you lose all your heroes you will lose. How do i make it?

/Cajvall
 
Level 4
Joined
Mar 29, 2012
Messages
61
1 step - add all of your heroes to HeroGroup.
2 step - check when any hero die.
3 step - when hero die check number of alive heroes in HeroGroup.
4 step - if all units in heroGroup are Dead. then victory/defeat
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
The easiest solution is a simple integer array. This allows for mpi.
Simply increase integer for that player when that player creates a hero unit. Decrease it when that players hero unit dies. After decreasing check if integer is less than 1. In the then block make that player lose.

Using a unit group with a check to count units in unit group is inefficient. To count units in unit group it loops through every unit and increases an integer.
 
this is deathismyfriend's solution. For every player add +1 if. that's it.
HeroesNumber is integer array 1-12

  • Untitled Trigger 001
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Dying unit)) Equal to Player 1 (Red)
        • Then - Actions
          • Set HeroesNumber[1] = (HeroesNumber[1] - 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HeroesNumber[1] Equal to 0
        • Then - Actions
          • Game - Defeat Player 1 (Red) with the message: Defeat!
        • Else - Actions
 
Last edited:
Level 25
Joined
May 11, 2007
Messages
4,651
Why the need to complicate things? :)
7.PNG
 
Status
Not open for further replies.
Top