• 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.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

[Solved] "All units dead for a certain player"-trigger needed.

Status
Not open for further replies.
Level 6
Joined
Aug 25, 2019
Messages
92
I might be going blind or just ordinarily daft, but I for the life of me can't find an Event or Condition along the lines of "Player X has 0 units left", followed by the Action "Defeat!".

I mean, I currently have this, which SORT OF works, but still, it's not really the same. It's for a Hero RPG with revival Altars, and in theory a summoned unit not using Food could head back to the Altar and bring back the Hero, you know? And in that case I'd technically not be at 0 units, just 0 Food.

I seem to remember the Event I'm looking for being a thing, or is my memory also shot?

1635624218175.png
 
Last edited:
Level 20
Joined
Feb 23, 2014
Messages
1,265
There's no event like that, but... a hint: check integer conditions :)

If you just want a solution:

  • Events
    • Unit - A unit owned by <Player> Dies
  • Conditions
  • Actions
    • Custom script: set bj_wantDestroyGroup = true
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of units in (Units owned by <Player> matching (((Matching unit) is alive) Equal to True))) Equal to 0
      • Then - Actions
        • Wait 2.00 game-time seconds
        • Game - Defeat <Player> with the message: Defeat!
      • Else - Actions
If you want to use this for multiple players, use the Generic - Unit Dies event and multiple/appropriate conditions.
The reason why we're putting condition in a separate block rather than under conditions is because it creates a unit group, i.e. causes a leak.
We're checking if the units are alive, because unit groups can also include recently deceased units (that died, but weren't removed yet).
 
Status
Not open for further replies.
Top