• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Action when no units left in region

Status
Not open for further replies.
Level 17
Joined
Apr 24, 2005
Messages
762
I want to do a trigger which gives a cinematic when there are no units alive owned by a specific player in a region. I tried the count units in unit group condition but it didnt work. And doing conditions which check if a specific unit is alive would be a pain in the *** since there are lots of units in that region.
 
You may use a variable array to count in real time the number of units int the region for each player:

Map init > for every unit in region { if (unit owned by player x) unit_count[x] = unit_count[x]+1 }
Unit enters region (owned by player x) > unit_count[x] = unit_count[x]+1
Unit leaves region (owned by player x) > unit_count[x] = unit_count[x]-1
Unit dies (owned by player x, unit is in region) > unit_count[x] = unit_count[x]-1

or something like this

and after, you'll only have to check the variable value to lauch your cinematic

(and with this, you can also display a sort of countdown for each player)
 
Last edited:
Status
Not open for further replies.
Back
Top