• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Mind-bending Trigger Logic Issue: Boolean ignored / Trigger running after being turned off

Level 3
Joined
Mar 8, 2020
Messages
20
Hello everyone! I'm building a custom Warcraft 3 campaign and I've encountered a logic bug that defies everything I know about the World Editor.

The Context:This is a "race" map between Mal'Ganis (Undead) and Peasants (Humans). There are 3 Granaries in total:

  1. Silo 1: Owned by Humans by default from the start (SCORE_FAIL starts at 1).
  2. Silo 2 & 3: These are the objectives. If Humans secure one more (Silo 2 OR 3), SCORE_FAIL becomes 2 and the player gets Mission Failed (Defeat).
The Setup:I am using a Boolean variable SILOS_2_CLAIMED (Initial: False) to track who got to the second siloz first.

THE ISSUE:I play the map, I move Mal'Ganis to Silo 2. His trigger runs perfectly (score goes 1/3, animations play). BUT, when the Peasants arrive a few seconds later, they STILL enter the Then block of the IF statement.

  • They ignore the SILOS_2_CLAIMED == True set by Mal'Ganis.
  • They ignore the Trigger - Turn off command sent by Mal'Ganis.
  • The SCORE_FAIL jumps from 1 to 2, and I get Mission Failed immediately, even though Mal'Ganis "won" that siloz.
Things I've verified:

  1. Variables: They are non-array, simple Booleans. No overlapping names.
  2. Ghost Triggers: I've deleted all old/copy-pasted triggers. I used Ctrl+F to ensure no other trigger is modifying SCORE_FAIL.
  3. Timing: Mal'Ganis sets the variable to True way before the Peasants arrive.
  4. Events: I tried Unit Enters Region and Unit Comes Within Range. Same result.
How can a trigger run after being Turned Off, and how can an IF statement read a Boolean as False when it was clearly set to True by another trigger seconds ago? Is there some hardcoded behavior with Peasants or "Grain Warehouse" units that overrides custom triggers?

Any help would be greatly appreciated!


  • MISSION VICTORY MALGANIS
    • Events
    • Conditions
      • SCORE_WIN Equal to 2
    • Actions
      • Trigger - Turn off (This trigger)
      • Trigger - Turn off MISSION VICTORY HUMANS <gen>
      • Quest - Mark QUEST_MAIN as Completed
      • Cinematic - Send transmission to (All players) from MALGANIS named Mal`Ganis: Play Malganis_1 <gen> and display The plague is compl.... Modify duration: Add 15.20 seconds and Don't wait
      • Wait 5.00 seconds
      • Game - Display to (All players) the text: |cffd45e19Main Ques...
      • Animation - Play Gate (Horizontal) 0070 <gen>'s Death Alternate 1 animation

  • MISSION VICTORY HUMANS
    • Events
    • Conditions
      • SCORE_FAIL Equal to 2
    • Actions
      • Trigger - Turn off (This trigger)
      • Trigger - Turn off MISSION VICTORY MALGANIS <gen>
      • Quest - Mark QUEST_MAIN as Incomplete
      • Cinematic - Send transmission to (All players) from MALGANIS named Mal`Ganis: Play No sound and display Impossibile! The hu.... Modify duration: Add 5.00 seconds and Don't wait
      • Wait 5.00 seconds
      • Game - Display to (All players) the text: |cffd45e19Main Ques...
      • Game - Defeat Player 7 (Green) with the message: The humans have sec...

  • CHECK SILO WINNER 1 MALGANIS
    • Events
      • Unit - A unit enters GRAIN REGION2 <gen>
    • Conditions
      • (Unit-type of (Entering unit)) Equal to Mal'Ganis
      • SILOS_3_CLAIMED Equal to False
    • Actions
      • Trigger - Turn off CHECK SILO WINNER 3 HUMANS <gen>
      • Set VariableSet SCORE_WIN = (SCORE_WIN + 1)
      • Set VariableSet SILOS_3_CLAIMED = True
      • Unit - Move MALGANIS instantly to (Center of GRAIN REGION2 <gen>), facing (Position of Grain Warehouse 0108 <gen>)
      • Unit - Change ownership of MALGANIS to Player 23 (Emerald) and Retain color
      • Animation - Play MALGANIS's spell slam 1 animation
      • Trigger - Turn on MALGANIS SPELL LOOP <gen>
      • Wait 6.00 seconds
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 13 Copy <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 13 Copy 2 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 13 Copy 3 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 13 Copy 4 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 13 Copy 5 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 13 Copy 6 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 13 Copy 7 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 13 Copy 8 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 13 Copy 9 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 13 Copy 10 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 13 Copy 12 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 13 Copy 11 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 13 Copy 13 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Unit - Change ownership of MALGANIS to Player 7 (Green) and Retain color
      • Trigger - Turn off MALGANIS SPELL LOOP <gen>
      • Animation - Change MALGANIS's animation speed to 100.00% of its original speed
      • Animation - Reset MALGANIS's animation
      • Game - Display to Player Group - Player 7 (Green) the text: |cffd45e19MAIN QUES...
      • Sound - Play AchievementEarned <gen>
      • Quest - Change the description of QUEST_MAIN to (Infect the 3 Granary Silos ( + ((String(SCORE_WIN)) + /3)))
      • Trigger - Run MISSION VICTORY MALGANIS <gen> (checking conditions)
  • CHECK SILO WINNER 2 MALGANIS
    • Events
      • Unit - A unit enters GRAIN REGION1 <gen>
    • Conditions
      • (Unit-type of (Entering unit)) Equal to Mal'Ganis
      • SILOS_2_CLAIMED Equal to False
    • Actions
      • Trigger - Turn off CHECK SILO WINNER 2 HUMANS <gen>
      • Set VariableSet SCORE_WIN = (SCORE_WIN + 1)
      • Set VariableSet SILOS_2_CLAIMED = True
      • Unit - Move MALGANIS instantly to (Center of GRAIN REGION1 <gen>), facing (Position of Grain Warehouse 0107 <gen>)
      • Unit - Change ownership of MALGANIS to Player 23 (Emerald) and Retain color
      • Animation - Play MALGANIS's spell slam 1 animation
      • Trigger - Turn on MALGANIS SPELL LOOP <gen>
      • Wait 6.00 seconds
      • Special Effect - Create a special effect at (Center of INFECTED AREA <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 2 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 3 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 4 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 5 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 6 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 7 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 8 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 9 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 10 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 12 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Special Effect - Create a special effect at (Center of INFECTED AREA Copy 11 <gen>) using Units\Undead\PlagueCloud\PlagueCloudtarget.mdl
      • Unit - Change ownership of MALGANIS to Player 7 (Green) and Retain color
      • Trigger - Turn off MALGANIS SPELL LOOP <gen>
      • Animation - Reset MALGANIS's animation
      • Animation - Change MALGANIS's animation speed to 100.00% of its original speed
      • Game - Display to Player Group - Player 7 (Green) the text: |cffd45e19MAIN QUES...
      • Sound - Play AchievementEarned <gen>
      • Quest - Change the description of QUEST_MAIN to (Infect the 3 Granary Silos ( + ((String(SCORE_WIN)) + /3)))
      • Trigger - Run MISSION VICTORY MALGANIS <gen> (checking conditions)
  • CHECK SILO WINNER 1 HUMANS
    • Events
      • Unit - A unit enters PEASANT MOVE 1 <gen>
    • Conditions
      • (Unit-type of (Entering unit)) Equal to Peasant
      • SILOS_1_CLAIMED Equal to False
    • Actions
      • Set VariableSet SCORE_FAIL = (SCORE_FAIL + 1)
      • Set VariableSet SILOS_1_CLAIMED = True
      • Wait 6.00 seconds
      • Game - Display to Player Group - Player 7 (Green) the text: |cffd45e19MAIN QUES...
      • Sound - Play AchievementEarned <gen>
      • Trigger - Run MISSION VICTORY HUMANS <gen> (checking conditions)

  • CHECK SILO WINNER 2 HUMANS
    • Events
      • Unit - A unit enters PEASANT 1 MOVE 2 <gen>
    • Conditions
    • Actions
      • Trigger - Turn off CHECK SILO WINNER 2 MALGANIS <gen>
      • Trigger - Turn off (This trigger)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Peasant
          • SILOS_2_CLAIMED Equal to False
        • Then - Actions
          • Set VariableSet SCORE_FAIL = (SCORE_FAIL + 1)
          • Set VariableSet SILOS_2_CLAIMED = True
          • Wait 6.00 seconds
          • Sound - Play AchievementEarned <gen>
          • Game - Display to Player Group - Player 7 (Green) the text: |cffd45e19MAIN QUES...
          • Trigger - Run MISSION VICTORY HUMANS <gen> (checking conditions)
        • Else - Actions
          • Game - Display to Player Group - Player 7 (Green) the text: |cffd45e19MAIN QUES...

  • CHECK SILO WINNER 3 HUMANS
    • Events
      • Unit - A unit enters PEASANT 2 MOVE 3 <gen>
    • Conditions
      • (Unit-type of (Entering unit)) Equal to Peasant
      • SILOS_3_CLAIMED Equal to False
    • Actions
      • Trigger - Turn off CHECK SILO WINNER 1 MALGANIS <gen>
      • Set VariableSet SCORE_FAIL = (SCORE_FAIL + 1)
      • Set VariableSet SILOS_3_CLAIMED = True
      • Wait 6.00 seconds
      • Game - Display to Player Group - Player 7 (Green) the text: |cffd45e19MAIN QUES...
      • Sound - Play AchievementEarned <gen>
      • Trigger - Run MISSION VICTORY HUMANS <gen> (checking conditions)
 
But let’s notice this first:

your regions, variables, and trigger names are completely mismatched from what I can see.



When Mal'Ganis walks into grain region 2, he triggers CHECK SILO WINNER 1 MALGANIS.

Look closely at what that trigger actually does:

it sets SILOS_3_CLAIMED = True

and turns off the Silo 3 Human trigger.

Because of this mix-up,

SILOS_2_CLAIMED is still False,

and the Silo 2 Human trigger is still completely turned ON.


When the Peasants finally arrive at Silo 2, they trigger the defeat condition perfectly.

And also a critical issue here:

Look at your CHECK SILO WINNER 2 HUMANS trigger.

The main Conditions block before firing actions is completely empty.

Because the Peasant check is buried down in the If/Then Actions block, ANY unit (a critter, a ghoul, a dummy unit etc.) that touches that region will run the trigger.

It will instantly and permanently turn off Mal'Ganis's trigger, fail the If statement, and leave that silo completely unclaimable by anyone.

Avoid the use of wait, it causes the trigger to pause and allows other triggers to run while it’s waiting.

If multiple peasants enter the region within that 6‑second window, each peasant’s trigger fires immediately. But because the Wait is placed before the boolean check (or before the critical actions), all those peasant triggers are queued up and execute in parallel.


By the time Mal’ganis sets SILOS_2_CLAIMED = True (in his own trigger), the peasants’ triggers have already been queued with the old value of the variable. They then all increment SCORE_FAIL one after the other; turning a single silo capture into multiple failure.

Using waits in your case will turn tge single event into a pile‑up of delayed executions, making a race condition inevitable.
 
Last edited:
But let’s notice this first:

your regions, variables, and trigger names are completely mismatched from what I can see.



When Mal'Ganis walks into grain region 2, he triggers CHECK SILO WINNER 1 MALGANIS.

Look closely at what that trigger actually does:

it sets SILOS_3_CLAIMED = True

and turns off the Silo 3 Human trigger.

Because of this mix-up,

SILOS_2_CLAIMED is still False,

and the Silo 2 Human trigger is still completely turned ON.


When the Peasants finally arrive at Silo 2, they trigger the defeat condition perfectly.

And also a critical issue here:

Look at your CHECK SILO WINNER 2 HUMANS trigger.

The main Conditions block before firing actions is completely empty.

Because the Peasant check is buried down in the If/Then Actions block, ANY unit (a critter, a ghoul, a dummy unit etc.) that touches that region will run the trigger.

It will instantly and permanently turn off Mal'Ganis's trigger, fail the If statement, and leave that silo completely unclaimable by anyone.
Hello! thanks for reaching up,i was really losing my mind with this problemits been already 3 days since im stuck here ,so the things looks like this: There are 3 silos ,the first one SILOS_1_CLAIMED , is made with intention of beign capturated by humans,there is no possible way for malganis to ever take that silo.So logicaly speaking malganis only has 2 possible regions to gain points "GRAIN REGION1" which is logicaly speaking the first silo for him BUT...second for humans and "GRAIN REGION2" which is the second silo for him and THIRD one for humans,So the battle is for SILOS_2_CLAIMED, and SILOS_3_CLAIMED,

What i will try is this,and i hope it will work (SORRY I POST IT UNDER TEXT DORMAT BUT NOW I`M AT WORK AND I ONLY HAVE THIS TEXT FORMAT AS REFFERENCE 🤣😅

TRIGGER: UNIVERSAL SILO MANAGER​

Events

  • Unit - A unit enters GRAIN REGION 1 <gen> (Siloz 2 - Mal'Ganis)
  • Unit - A unit enters PEASANT 1 MOVE 2 <gen> (Siloz 2 - Oameni)
  • Unit - A unit enters GRAIN REGION 2 <gen> (Siloz 3 - Mal'Ganis)
  • Unit - A unit enters PEASANT 2 MOVE 3 <gen> (Siloz 3 - Oameni)
Conditions

  • Or - Any (Conditions) are true
    • (Unit-type of (Triggering unit)) Equal to Mal'Ganis
    • (Unit-type of (Triggering unit)) Equal to Peasant
Actions


-------- BLOCUL 1: SILOZUL 2 --------

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Entered Region) Equal to GRAIN REGION 1 <gen>
      • (Unit-type of (Triggering unit)) Equal to Mal'Ganis
      • SILOS_2_CLAIMED Equal to False
    • Then - Actions
      • Set VariableSet SILOS_2_CLAIMED = True
      • Set VariableSet SCORE_WIN = (SCORE_WIN + 1)
      • Trigger - Run EFECTE_MALGANIS_SILO_2 <gen> (ignoring conditions)
    • Else - Actions
      • (Nimic)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Entered Region) Equal to PEASANT 1 MOVE 2 <gen>
      • (Unit-type of (Triggering unit)) Equal to Peasant
      • SILOS_2_CLAIMED Equal to False
    • Then - Actions
      • Set VariableSet SILOS_2_CLAIMED = True
      • Set VariableSet SCORE_FAIL = (SCORE_FAIL + 1)
      • Sound - Play AchievementEarned <gen>
      • Game - Display to (All players) the text: The humans have secured Silo 2!
    • Else - Actions
      • (Nimic)

-------- BLOCUL 2: SILOZUL 3 --------

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Entered Region) Equal to GRAIN REGION 2 <gen>
      • (Unit-type of (Triggering unit)) Equal to Mal'Ganis
      • SILOS_3_CLAIMED Equal to False
    • Then - Actions
      • Set VariableSet SILOS_3_CLAIMED = True
      • Set VariableSet SCORE_WIN = (SCORE_WIN + 1)
      • Trigger - Run EFECTE_MALGANIS_SILO_3 <gen> (ignoring conditions)
    • Else - Actions
      • (Nimic)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Entered Region) Equal to PEASANT 2 MOVE 3 <gen>
      • (Unit-type of (Triggering unit)) Equal to Peasant
      • SILOS_3_CLAIMED Equal to False
    • Then - Actions
      • Set VariableSet SILOS_3_CLAIMED = True
      • Set VariableSet SCORE_FAIL = (SCORE_FAIL + 1)
      • Sound - Play AchievementEarned <gen>
      • Game - Display to (All players) the text: The humans have secured Silo 3!
    • Else - Actions
      • (Nimic)

-------- BLOCUL 3: VERIFICARE SCOR FINAL --------

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • SCORE_WIN Equal to 2
    • Then - Actions
      • Trigger - Turn off (This trigger)
      • Quest - Mark QUEST_MAIN as Completed
      • Game - Victory Player 23 (Emerald) (Show dialogs, Show scores)
    • Else - Actions
      • (Nimic)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • SCORE_FAIL Equal to 2
    • Then - Actions
      • Trigger - Turn off (This trigger)
      • Quest - Mark QUEST_MAIN as Failed
      • Game - Defeat Player 7 (Green) with the message: Defeat!
    • Else - Actions
      • (Nimic)
 
Back
Top