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

How to make trigger that count units

Status
Not open for further replies.
Create a Unit Group variable or Integer variable, both are viable choices.

Integer example:
  • Integer Example
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
      • UnitCount Less than 10
    • Actions
      • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Set VariableSet UnitCount = (UnitCount + 1)

A Unit Group is used to contain units.
You can Pick through a Unit Group to reference the units contained inside and even get information about it like how many units are inside of it, like so:
  • UG Example
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
      • (Number of units in YourUnitGroup) Less than 10
    • Actions
      • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to YourUnitGroup

Next you'll want to manage your Unit Group or Integer if one of the related units dies.
  • UG Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in YourUnitGroup.) Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from YourUnitGroup.
OR
  • Integer Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • Set VariableSet UnitCount = (UnitCount - 1)
 

Attachments

Last edited:
Status
Not open for further replies.
Back
Top