• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Number of units in Region trigger

Status
Not open for further replies.
Level 5
Joined
Jan 15, 2018
Messages
128
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>
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
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.
 
Level 5
Joined
Jan 15, 2018
Messages
128
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?
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
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.
 
Level 5
Joined
Jan 15, 2018
Messages
128
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.
Top