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

Why won't this trigger work?

Status
Not open for further replies.
Level 4
Joined
Dec 29, 2009
Messages
69
Hey guys I've just made a trigger to turn off another trigger once the number of a type of unit has reached 30.

This is the trigger i wanna turn off

  • Orc militia spawn
    • Events
      • Unit - A unit enters Attack region 2 <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Unit - Create 5 Orc Militia for Player 2 (Blue) at (Random point in Attack region 2 <gen>) facing Default building facing degrees
      • Unit - Create 5 Orc Militia for Player 2 (Blue) at (Random point in Attack region 2 <gen>) facing Default building facing degrees
      • Unit - Create 5 Orc Militia for Player 2 (Blue) at (Random point in Attack region 2 <gen>) facing Default building facing degrees
      • Unit - Create 5 Orc Militia for Player 2 (Blue) at (Random point in Attack region 2 <gen>) facing Default building facing degrees
      • Unit - Create 5 Orc Militia for Player 2 (Blue) at (Random point in Attack region 2 <gen>) facing Default building facing degrees
      • Unit - Create 5 Orc Militia for Player 2 (Blue) at (Random point in Attack region 2 <gen>) facing Default building facing degrees
This is the trigger i'm going to use to turn the one above off

  • Orc turn off
    • Events
    • Conditions
      • (Number of units in (Units of type Orc Militia)) Equal to 30
    • Actions
      • Trigger - Turn off Orc militia spawn <gen>
And i know it's not working because when one of my units enter the region 30 militias are created, then i teleport out, then into the region again and another 30 militias are created, i've also tried greater or equal to for the condition
 
Level 4
Joined
Dec 29, 2009
Messages
69
Nope, still not working xD

  • Orc militia spawn
    • Events
      • Unit - A unit enters Attack region 2 <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Unit - Create 5 Orc Militia for Player 2 (Blue) at (Random point in Attack region 2 <gen>) facing Default building facing degrees
      • Unit - Create 5 Orc Militia for Player 2 (Blue) at (Random point in Attack region 2 <gen>) facing Default building facing degrees
      • Unit - Create 5 Orc Militia for Player 2 (Blue) at (Random point in Attack region 2 <gen>) facing Default building facing degrees
      • Unit - Create 5 Orc Militia for Player 2 (Blue) at (Random point in Attack region 2 <gen>) facing Default building facing degrees
      • Unit - Create 5 Orc Militia for Player 2 (Blue) at (Random point in Attack region 2 <gen>) facing Default building facing degrees
      • Unit - Create 5 Orc Militia for Player 2 (Blue) at (Random point in Attack region 2 <gen>) facing Default building facing degrees
      • Trigger - Run Turn off <gen> (checking conditions)
 
Level 11
Joined
Jan 25, 2009
Messages
572
Try to do this. Cuz i think you need an interval event to this other trigger that turns of the other trigger.


  • HelpTrigger
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units of type Footman)) Equal to 30
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
 
Level 4
Joined
Dec 29, 2009
Messages
69
Oops :p that's a good point i've changed it to orc turn off now and it's still not working

  • Orc militia spawn
    • Events
      • Unit - A unit enters Attack region 2 <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Unit - Create 5 Orc Militia for Player 2 (Blue) at (Random point in Attack region 2 <gen>) facing Default building facing degrees
      • Unit - Create 5 Orc Militia for Player 2 (Blue) at (Random point in Attack region 2 <gen>) facing Default building facing degrees
      • Unit - Create 5 Orc Militia for Player 2 (Blue) at (Random point in Attack region 2 <gen>) facing Default building facing degrees
      • Unit - Create 5 Orc Militia for Player 2 (Blue) at (Random point in Attack region 2 <gen>) facing Default building facing degrees
      • Unit - Create 5 Orc Militia for Player 2 (Blue) at (Random point in Attack region 2 <gen>) facing Default building facing degrees
      • Unit - Create 5 Orc Militia for Player 2 (Blue) at (Random point in Attack region 2 <gen>) facing Default building facing degrees
      • Trigger - Run Orc turn off <gen> (checking conditions)
 
Level 4
Joined
Dec 29, 2009
Messages
69
I want to make this check so that the game doesn't make 30 Orc militias everytime an enemy unit enters the region.
Basically, what i want to do is, make 30 militias when there are enemy units in the region, then if those 30 die another 30 will spawn
 
Well, like I said, turn the trigger of before you begin with the Unit - Create actions (use Trigger - Turn off (This trigger)) and another trigger which goes like this:
  • Trigger
  • Events
    • Unit - A unit dies
  • Conditions
    • ((Triggering unit) is in OrcMilitiaGroup) Equal to True
  • Actions
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (Number of units in (OrcMilitiaGroup)) Not Equal to 0
      • Then - Actions
        • Unit Group - Remove (Triggering unit) from OrcMilitiaGroup
      • Actions
        • Trigger - Turn on Orc militia spawn <gen>
 
Level 4
Joined
Dec 29, 2009
Messages
69
@Slayer: That was actually my intention but it seemed a bit impractical :p is it possible to do that though? I'm not sure which idea is better though xD
@Pharaoh: You're awesome :p
 
Level 4
Joined
Dec 29, 2009
Messages
69
Doesn't seem to be working Pharaoh :(

  • Orc turn on
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in (Units of type Orc Militia)) Equal to True
    • Actions
      • If ((Number of units in (Units of type Orc Militia)) Not equal to 0) then do (Unit Group - Remove (Triggering unit) from (Units of type Orc Militia)) else do (Trigger - Turn on Orc militia spawn <gen>)
 
Level 5
Joined
May 31, 2009
Messages
122
  • Event
    • Unit - Unit Enters (Region)
  • Conditions
    • (Owner of (Entering Unit)) Equal to (Player 1 (Red))
    • (Number of units in (Units in (OrcMilitiaArea) matching ((Unit type of (Matching Unit)) Equal to (Orc Militia))) Equal to 0
  • Actions
    • For Each (Integer A) from 1 to 6, do (actions)
      • Loop - Actions
        • Unit - Create 5 (Orc Militia) for Player 2 (Blue) at (Random Point in (Orc Militia Spawn))
I think this should work better.
 
Level 4
Joined
Dec 29, 2009
Messages
69
Guys i've got another problem, when the militias are spawned, sometimes they're confused as to where to go when there are too many enemy units in the region. please help xD
 
Status
Not open for further replies.
Top