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

Level 2
Joined
Sep 29, 2024
Messages
1
I have a map right now that features a custom made hero on the blue team and a few human soldiers on the red team.

I am playing as the blue team the computer controls the red team.

When I use the enforce victory/defeat conditions for all players action and run the map, the game immediately says that both red and blue teams were defeated. Mind you, there is no peons/peasants/resources etc.

Basically, I am wanting to change the victory conditions. When either team wipes out the other team, I want the match to be over. So if my hero takes out the human soldiers on the red team, I want the match to be over. Could someone please tell me the code for this?

IT's part of a school project so any help you could offer would be much appreciated. Thanks!
 
Level 30
Joined
Aug 29, 2012
Messages
1,384
There are multiple ways to achieve that, here's a simple one. First delete the default melee init trigger since this is not a standard map.

  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet UnitGroup[1] = (Units owned by Player 1 (Red).)
      • Set VariableSet UnitGroup[2] = (Units owned by Player 2 (Blue).)
  • Defeat Red
    • Events
      • Unit - A unit owned by Player 1 (Red) Dies
    • Conditions
      • (All units of UnitGroup[1] are dead) Equal to True
    • Actions
      • Game - Defeat Player 1 (Red) with the message: Defeat!
      • Game - Victory Player 2 (Blue) (Show dialogs, Show scores)
  • Defeat Blue
    • Events
      • Unit - A unit owned by Player 2 (Blue) Dies
    • Conditions
      • (All units of UnitGroup[2] are dead) Equal to True
    • Actions
      • Game - Defeat Player 2 (Blue) with the message: Defeat!
      • Game - Victory Player 1 (Red) (Show dialogs, Show scores)

You could probably mix the defeat triggers into a single one and clear out leaks but since it's a school project that'll be your homework :p
 
When I use the enforce victory/defeat conditions for all players action and run the map, the game immediately says that both red and blue teams were defeated.
This is the "Warcraft 3 melee default victory condition" (destroy all enemy buildings). Because you have no buildings, you'll need a custom one that goes into more details (such as the one @Chaosium provided)
 
Top