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

[Trigger] Why isn't this Trigger firing?

I've got two triggers, one adds the events to the second trigger as I want it to use the unit variable. When the enemy Hero approaches the capture point, as long as there are no player structures or heroes in the surrounding area, it will flip to the Troll/Enemy Hero's side. However, it isn't working the hero approaches the capture point but this trigger doesn't seem to be firing.

Any and all help appreciated.
 

Attachments

  • Screenshot 2024-02-14 220604.png
    Screenshot 2024-02-14 220604.png
    90.8 KB · Views: 17
  • Screenshot 2024-02-14 220612.png
    Screenshot 2024-02-14 220612.png
    235.4 KB · Views: 15

deepstrasz

Map Reviewer
Level 69
Joined
Jun 4, 2009
Messages
18,883
Make sure the referred to units are variables so they would be found by the triggers that they in fact exist.
Also, add some debug game text messages before, after conditions and in between triggers just so you know something not broken somewhere on the way.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,550
Can you please post the triggers instead of using screenshots:

Anyway, it's safe to assume that your Unit Group condition is failing, since I imagine you're certain that the other two Conditions are definitely being met.

You shouldn't use a Unit Group like that in the first place, instead do something like this:
  • Ojinba Takes It 01 Example
    • Events
    • Conditions
      • GameOver Equal to False
      • (Triggering unit) Equal to Ojinba
    • Actions
      • Set VariableSet Oji_Failed = False
      • Set VariableSet Oji_Group = (Units within 700.00 of STABLES_POINT.)
      • -------- --------
      • Unit Group - Pick every unit in Oji_Group and do (Actions)
        • Loop - Actions
          • Set VariableSet Oji_Unit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Oji_Failed Equal to False
              • (Owner of Oji_Unit) Equal to AP1_Player
              • (Oji_Unit is alive) Equal to True
              • Or - Any (Conditions) are true
                • Conditions
                  • (Oji_Unit is A structure) Equal to True
                  • (Oji_Unit is A Hero) Equal to True
            • Then - Actions
              • Set VariableSet Oji_Failed = True
            • Else - Actions
      • -------- --------
      • Custom script: call DestroyGroup( udg_Oji_Group )
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Oji_Failed Equal to True
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
      • -------- --------
      • -------- Run the rest of your actions --------
(Triggering unit) refers to the unit that "came within range" of the STABLE. I'm using a Point variable called STABLES_POINT which would be Set once to the position of your STABLE at the start of the game (or whenever the STABLE comes into play). I assume that the STABLE never moves so it's useful to have this "constant" variable to keep track of it.

In my example there are no memory leaks. In your current trigger, you leak a Unit Group and many Points every time the trigger runs. Not the end of the world but worth fixing if you can.
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,016
I don’t see anywhere your STABLES etc. variables are set. They needy to be set before you add the events.

Events CANNOT be assigned to variables such that changing the variable will change the unit the event is for. You can use a variable in the event, but it will grab the current value of that variable at the time the event is added and then only ‘work’ for that specific unit (whatever the variable value is). The same behavior applies to expressions like “Time - Every (Random real between 1.00 and 30.00) seconds of game-time” which gets baked in as a single value when the map initializes.
 
Can you please post the triggers instead of using screenshots:

Anyway, it's safe to assume that your Unit Group condition is failing, since I imagine you're certain that the other two Conditions are definitely being met.

You shouldn't use a Unit Group like that in the first place, instead do something like this:
  • Ojinba Takes It 01 Example
    • Events
    • Conditions
      • GameOver Equal to False
      • (Triggering unit) Equal to Ojinba
    • Actions
      • Set VariableSet Oji_Failed = False
      • Set VariableSet Oji_Group = (Units within 700.00 of STABLES_POINT.)
      • -------- --------
      • Unit Group - Pick every unit in Oji_Group and do (Actions)
        • Loop - Actions
          • Set VariableSet Oji_Unit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Oji_Failed Equal to False
              • (Owner of Oji_Unit) Equal to AP1_Player
              • (Oji_Unit is alive) Equal to True
              • Or - Any (Conditions) are true
                • Conditions
                  • (Oji_Unit is A structure) Equal to True
                  • (Oji_Unit is A Hero) Equal to True
            • Then - Actions
              • Set VariableSet Oji_Failed = True
            • Else - Actions
      • -------- --------
      • Custom script: call DestroyGroup( udg_Oji_Group )
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Oji_Failed Equal to True
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
      • -------- --------
      • -------- Run the rest of your actions --------
(Triggering unit) refers to the unit that "came within range" of the STABLE. I'm using a Point variable called STABLES_POINT which would be Set once to the position of your STABLE at the start of the game (or whenever the STABLE comes into play). I assume that the STABLE never moves so it's useful to have this "constant" variable to keep track of it.

In my example there are no memory leaks. In your current trigger, you leak a Unit Group and many Points every time the trigger runs. Not the end of the world but worth fixing if you can.

I've changed the trigger to what you have there and as can be seen in the spoiler still no joy :/

1708022664539.png


Here's the trigger as it stands now:

[hidden = New Trigger]
  • COP 01 Ojinba Takes It
    • Events
    • Conditions
      • GameOver Equal to False
      • (Triggering unit) Equal to Ojinba
      • (Owner of STABLES) Equal to AP5_StromgardeControl
    • Actions
      • Set VariableSet CaptureFailed = False
      • Set VariableSet CaptureCheckGroup = (Units within 700.00 of (Position of STABLES).)
      • -------- --------------------- --------
      • Unit Group - Pick every unit in CaptureCheckGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet CaptureCheckUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CaptureFailed Equal to False
              • (Owner of CaptureCheckUnit) Equal to AP1_Player
              • (CaptureCheckUnit is alive) Equal to True
              • Or - Any (Conditions) are true
                • Conditions
                  • (CaptureCheckUnit is A structure) Equal to True
                  • (CaptureCheckUnit is A Hero) Equal to True
            • Then - Actions
              • Set VariableSet CaptureFailed = True
            • Else - Actions
      • -------- --------------------- --------
      • Custom script: call DestroyGroup( udg_CaptureCheckGroup)
      • -------- --------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CaptureFailed Equal to True
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
      • Unit - Order Ojinba to Stop.
      • Set VariableSet COPTROLLCount = (COPTROLLCount + 1)
      • -------- Decrement --------
      • If (COP01StromOwned Equal to True) then do (Set VariableSet COPSTROMCount = (COPSTROMCount - 1)) else do (Do nothing)
      • -------- Send AI signal --------
      • Trigger - Run AI COP 01 Gained <gen> (checking conditions)
      • -------- Set variables --------
      • Set VariableSet COP01TrollOwned = True
      • Set VariableSet COP01StromOwned = False
      • -------- Change color of COP and Obelisk --------
      • Unit - Change ownership of STABLES to AP11_TrollControl and Change color
      • Unit - Change color of STABLES to Dark Green
      • -------- Run update leaderboard --------
      • Trigger - Run gg_trg_Leaderboard_Update (checking conditions)
      • -------- Dialogue --------
      • -------- Special Effect --------
      • -------- Spawn Slaves --------
      • Unit - Create 1 Slave for AP15_COP_STABLES at PointCOP01SpawnSlave facing (Position of STABLES)
      • Unit - Order (Last created unit) to build a Watch Tower (Forest Troll) at (Center of COP01 TowerA <gen>)
      • Unit - Create 1 Slave for AP15_COP_STABLES at PointCOP01SpawnSlave facing (Position of STABLES)
      • Unit - Order (Last created unit) to build a Watch Tower (Forest Troll) at (Center of COP01 TowerB <gen>)
      • Unit - Create 1 Slave for AP15_COP_STABLES at PointCOP01SpawnSlave facing (Position of STABLES)
      • Unit - Order (Last created unit) to build a Watch Tower (Forest Troll) at (Center of COP01 TowerC <gen>)
[/hidden]
I don’t see anywhere your STABLES etc. variables are set. They needy to be set before you add the events.

Events CANNOT be assigned to variables such that changing the variable will change the unit the event is for. You can use a variable in the event, but it will grab the current value of that variable at the time the event is added and then only ‘work’ for that specific unit (whatever the variable value is). The same behavior applies to expressions like “Time - Every (Random real between 1.00 and 30.00) seconds of game-time” which gets baked in as a single value when the map initializes.
I'm not that bad triggering :p

  • Set VariableSet STABLES = Stables (Control Point) 0009 <gen>
  • Set VariableSet GOLDMINE = Gold Mine (Control Point) 0013 <gen>
  • Set VariableSet BLACKSMITH = Blacksmith (Control Point) 0010 <gen>
  • Set VariableSet LUMBERMILL = Lumber Mill (Control Point) 0012 <gen>
  • Set VariableSet FARM = Farm (Control Point) 0022 <gen>
The variables are set before the Events are added and the units in those variables does not change as the units only ever change owner and are invulnerable.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,550
Add text messages throughout the trigger as others have suggested. You want to know if you're even making it past the Conditions. Then you need to check if CaptureFailed is set to True or False. If it's True then the ownership won't change, so double check to see why it would be set to True when you expected it to be False.
  • Actions
    • Game - Display to (All players) the text: "Actions started!"
  • Then - Actions
    • Set VariableSet CaptureFailed = True
    • Game - Display to (All players) the text: "CaptureFailed -> Skip actions!"
 

deepstrasz

Map Reviewer
Level 69
Joined
Jun 4, 2009
Messages
18,883
Yeah, just make sure you convert variables (be they boleans or integers/reals) to text.

Just a sec though. Are you using 1.31.1? Might it also be something related to the load game bug that breaks events?
Do the triggers work right from the start of the map/test map or they break later?
 
You guys are quick was about to Edit my post to say I've added text messages and the trigger isn't firing at all. Maybe adding the events like that isn't working for some reason.

I'm on the latest patch, and I've used variables for the units to avoid Save/Loading breaking it, also there's no saving or loading the test is at map start :)

The events are added at elapsed Game Time = 0.0, but that should be fine right?
 

deepstrasz

Map Reviewer
Level 69
Joined
Jun 4, 2009
Messages
18,883
Just try with a unit comes within range of any of those variabled units.
Don't add the event as an action. Make it yourself as an event from the start. For testing purposes I mean.
The events are added at elapsed Game Time = 0.0, but that should be fine right?
Add them via a run trigger (just one with all those actions to add those events) from the map initialization trigger.
 
Just try with a unit comes within range of any of those variabled units.
Don't add the event as an action. Make it yourself as an event from the start. For testing purposes I mean.

Add them via a run trigger (just one with all those actions to add those events) from the map initialization trigger.
Yeah I changed the event to this:
1708024222166.png


And still nothing, that message doesn't appear.

Wait nevermind, I'm an idiot, the original trigger where I set Ojinba = the pre-placed unit got deleted. Feel like I've wasted all your guys time with something so basic.
 
Top