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

Number of units in Region trigger

Status
Not open for further replies.
Level 5
Joined
Jan 15, 2018
Messages
130
Something is off in the conditions of this trigger and it doesnt work. Does the Units in Region Equal to not work so well for this?

The goal is to recreate the scene in the movie when the Easterlings march to the Black Gate.

  • BlackgateEast
    • Events
      • Unit - A unit enters Blackgate <gen>
    • Conditions
      • ((Unit-type of (Triggering unit)) Equal to Khundolar Soldier (Easterling)) and ((Number of units in (Units in Blackgate <gen>)) Equal to 12)
      • (Current research level of Followers of Flame (sauron) for Player 24 (Peanut)) Equal to 1
    • Actions
      • Game - Display to Player Group - Player 24 (Peanut) for 15.00 seconds the text: The Easterlings hav...
      • Hero - Create Tome of Power and give it to Ruzaur 0154 <gen>
      • Set VariableSet EasterTP3 = (Center of Grond <gen>)
      • Set VariableSet EasterTP4 = (EasterTP3 offset by (-704.00, 192.00))
      • Unit - Create 1 Hall of the Golden Host for Player 24 (Peanut) at EasterTP4 facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_EasterTP4)
      • Set VariableSet EasterTP4 = (EasterTP3 offset by (-1472.00, -1782.00))
      • Unit - Create 1 Hall of the Golden Host for Player 24 (Peanut) at EasterTP4 facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_EasterTP4)
      • Set VariableSet EasterTP4 = (EasterTP3 offset by (-1472.00, 1782.00))
      • Unit - Create 1 Fuinur III for Player 24 (Peanut) at EasterTP4 facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_EasterTP4)
      • Custom script: call RemoveLocation(udg_EasterTP3)
      • Trigger - Turn off BlackgateEast <gen>
 
it should work, though you leak a unit group each time a unit enters the region.
Perhaps try removing the condition for number of units and check if the trigger fires.
If not, then the issue should not be in the removed conditions. Then try to remove research level condition and check again.
 
Ok i removed the number of units and it worked. Probably just gonna stick with that.

It doesnt leak with just the one unit right?
 
In this condition:
  • ((Number of units in (Units in Blackgate <gen>)) Equal to 12)
the part "(Units in Blackgate <gen>)" creates a unit group. If the unit group is not destroyed, then it leaks, no matter how many units are in the unit group

Edit: You could also try something else - you already removed the condition, but you could still print number of units as a message - that may give you an idea on what is going on.
Something like this:
  • Untitled Trigger 001
    • Events
      • Unit - A unit enters Blackgate <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to XYZ
      • ... your other conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Set VariableSet unitCount = (Number of units in (Units in Blackgate <gen>))
      • Game - Display to (All players) the text: (Number of units in Blackgate: + (String(unitCount)))
      • ... the remainder of your trigger
 
Last edited:
Something is off in the conditions of this trigger and it doesnt work. Does the Units in Region Equal to not work so well for this?

The goal is to recreate the scene in the movie when the Easterlings march to the Black Gate.

  • BlackgateEast
    • Events
      • Unit - A unit enters Blackgate <gen>
    • Conditions
      • ((Unit-type of (Triggering unit)) Equal to Khundolar Soldier (Easterling)) and ((Number of units in (Units in Blackgate <gen>)) Equal to 12)
      • (Current research level of Followers of Flame (sauron) for Player 24 (Peanut)) Equal to 1
    • Actions
      • Game - Display to Player Group - Player 24 (Peanut) for 15.00 seconds the text: The Easterlings hav...
      • Hero - Create Tome of Power and give it to Ruzaur 0154 <gen>
      • Set VariableSet EasterTP3 = (Center of Grond <gen>)
      • Set VariableSet EasterTP4 = (EasterTP3 offset by (-704.00, 192.00))
      • Unit - Create 1 Hall of the Golden Host for Player 24 (Peanut) at EasterTP4 facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_EasterTP4)
      • Set VariableSet EasterTP4 = (EasterTP3 offset by (-1472.00, -1782.00))
      • Unit - Create 1 Hall of the Golden Host for Player 24 (Peanut) at EasterTP4 facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_EasterTP4)
      • Set VariableSet EasterTP4 = (EasterTP3 offset by (-1472.00, 1782.00))
      • Unit - Create 1 Fuinur III for Player 24 (Peanut) at EasterTP4 facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_EasterTP4)
      • Custom script: call RemoveLocation(udg_EasterTP3)
      • Trigger - Turn off BlackgateEast <gen>
If the unit that enters exactly as the 12th if not the 13th unit is not Khundolar Soldier (Easterling), then the trigger will not run. This is due to how your logic is set-up. I assume you have the research as 1 by this point.
 
Yes the the research was done.
Was just doing some experimenting with the trigger.
Couldnt get the trigger from Nichilus to work. The program couldnt understand the custom script.
Ended up just using the 'unit enters region' and making do with one Khundolar Soldier.
 
Status
Not open for further replies.
Back
Top