• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to 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.
 
Level 10
Joined
Jun 26, 2007
Messages
659
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:
Level 21
Joined
Aug 21, 2005
Messages
3,699
[Trigger=Untitled Trigger 001]
Events
An event
Conditions
(Number of units in (Units in (Region 001) matching (((Owner of (Matching unit)) Equal to Player 1 (Red)) and (((Matching unit) is alive) Equal to True)))) Equal to 0
Actions
-------- Do some stuff --------
[/Trigger]
 
Status
Not open for further replies.
Top