• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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
 
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,650
Why the need to complicate things? :)
7.PNG
 
Status
Not open for further replies.
Top