• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

What Triggers Run First?

Level 18
Joined
Mar 16, 2008
Messages
721
I have two triggers and I want one to run first. Maybe this won't work but it's related to detecting if a unit Unloads from transport vs casts un-Defend.

Could I just put one trigger higher than the other in the map script and that one would run first?

They seem to run simultaneously but in digital reality, that must be impossible? Perhaps I'll just use a timer on the second one.
 

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,641
They don't run simultaneously, but they may both execute in the same frame assuming there's no Waits. I'm not sure how the order works though, I'm pretty sure I've tried moving triggers around without anything changing.

But what was wrong with the suggestion from the previous thread about using a Boolean to mark your Unit?

When they load into a transport you set IgnoreNextDefend = True, then check for this Boolean in your un-Defend trigger. If it's True then you Set the boolean to False and Skip the rest of the Actions.
  • Events
    • Unit - A unit issues an order targeting an object
  • Conditions
    • (Issued order) Equal to load
  • Actions
    • Set Variable CV = (Custom value of (Triggering unit))
    • Set Variable IgnoreNextDefend[CV] = True
  • Events
    • Unit - A unit issues an order with no target
  • Conditions
    • (Issued order) Equal to undefend
  • Actions
    • Set Variable CV = (Custom value of (Triggering unit))
    • If then else
      • If - Conditions
        • IgnoreNextDefend[CV] Equal to True
      • Then - Actions
        • Set Variable IgnoreNextDefend[CV] = False
      • Else - Actions
        • // proceed with the normal actions for this trigger
There might be a little bit more to it then that, but I can't imagine much.
 
Last edited:
Level 18
Joined
Mar 16, 2008
Messages
721
ok this is what i did based on your post. and the 'ankh' trigger is before i knew how to make mpi triggers and i haven't fixed it yet.

  • Transported
    • Events
      • Unit - A unit Is loaded into a transport
    • Conditions
      • ((Loading unit) is A Hero) Equal to True
    • Actions
      • Set VariableSet ignore_next_defend[(Player number of (Owner of (Loading unit)))] = True
  • Transported Unloaded
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • ((Entering unit) is A Hero) Equal to True
    • Actions
      • Set VariableSet ignore_next_defend[(Player number of (Owner of (Entering unit)))] = False
  • Blank Ankh Used Yellow
    • Events
      • Unit - A unit owned by Player 5 (Yellow) Is issued an order with no target
    • Conditions
      • (Player 5 (Yellow) is in Black_Group_Var.) Equal to True
      • (Issued order) Equal to (Order(undefend))
      • (Triggering unit) Equal to Yellow_Hero
      • ((Triggering unit) is alive) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ignore_next_defend[5] Equal to True
        • Then - Actions
          • Set VariableSet ignore_next_defend[5] = False
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) is selected by Player 5 (Yellow).) Equal to True
            • Then - Actions
              • Selection - Add (Triggering unit) to selection for Player 5 (Yellow)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item: (Item carried by Yellow_Hero of type Midnight Ankh)'s Integer Field: Number of Charges ('iuse')) Equal to 1
            • Then - Actions
              • Special Effect - Create a special effect attached to the origin of Yellow_Hero using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • Unit - Set life of Yellow_Hero to 100.00%
              • Countdown Timer - Start Black_Ankh_CD_Timer_Yellow as a One-shot timer that will expire in 180.00 seconds
              • Item - Remove (Item carried by Yellow_Hero of type Midnight Ankh)
              • Item - Make (Item carried by Yellow_Hero of type Midnight Ankh) Undroppable
              • Trigger - Turn off (This trigger)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item: (Item carried by Yellow_Hero of type Midnight Ankh)'s Integer Field: Number of Charges ('iuse')) Greater than 1
            • Then - Actions
              • Special Effect - Create a special effect attached to the origin of Yellow_Hero using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • Item - Set charges remaining in (Item carried by Yellow_Hero of type Midnight Ankh) to ((Charges remaining in (Item carried by Yellow_Hero of type Midnight Ankh)) - 1)
              • Countdown Timer - Start Black_Ankh_CD_Timer_Yellow as a One-shot timer that will expire in 180.00 seconds
              • Item - Make (Item carried by Yellow_Hero of type Midnight Ankh) Undroppable
              • Trigger - Turn off (This trigger)
            • Else - Actions
 
Top