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

Unit Counter In Region

Status
Not open for further replies.
Level 7
Joined
Feb 6, 2008
Messages
133
How do i make a counter when a unit is in region?
this is what i want..
when 300 gray units or 300 specific unit-type is in region, player 1 is victory

and if possible .. i want a multiboard for the amount of units in the region like
Team 1 | Team 2
193.........227
 
Level 3
Joined
Sep 10, 2005
Messages
23
ans

You can use a trigger like that...

  • Counter
    • Events
      • Unit - A unit enters Rect X
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in Rect X owned by Player 9 (Gray))) Greater than or equal to 300
        • Then - Actions
          • Victory Player X
        • Else - Actions
 
Last edited by a moderator:
Level 15
Joined
Jan 16, 2008
Messages
1,244
do it with a counter variable and a 'pick every unit in region:
Events:
A unit enters (your region)
Conditions: not needed
Actions:
Pick every unit in (your region) and do actions:
if (your condition for unit filter) then set Counter to (counter + 1)
This counts all units in region matching a condition every time a unit enters that region. Is that what you needed?
 
Level 4
Joined
Dec 15, 2007
Messages
108
i had this problem too and i do it so

  • ud boss unbesiegbar
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set units[Owner of matching unit] = (Number of units in (Units in (Playable Map Area) <gen>(((Unit-type of (Matching unit)) Equal to < Your Unit>) and (((Matching unit) is alive) Equal to True))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • Units equal to 300
        • Then - Actions
          • Player - wins
        • Else - Actions
          • Do Nothing
      • Unit Groupe - Remove all units in Unit
variable has to be a array and the array has to be the number of the maximum of active player hope for help u

so better?
 
Last edited:
Status
Not open for further replies.
Top