[Trigger] Trouble With Using Defend to Track Ankh Use/Transport/Mirror Image Casts

Level 21
Joined
Mar 16, 2008
Messages
952
Trying to use defend to track ankh use. Trouble is units cast defend on some other events too such as being loaded into transport or casting mirror image.
  • TEST
    • Events
      • Player - Player 5 (Yellow) types a chat message containing 1 as An exact match
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Mark of Black Knights for Knight_Hero_Var[5]) Equal to 1
        • Then - Actions
          • Game - Display to (All players) the text: Mark of Black lv.1
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Mark of Black Knights for Knight_Hero_Var[5]) Equal to 2
        • Then - Actions
          • Game - Display to (All players) the text: Mark of Black lv.2
        • Else - Actions
  • Transported
    • Events
      • Unit - A unit Is loaded into a transport
    • Conditions
      • (Level of Mark of Black Knights for (Loading unit)) Equal to 2
      • ((Loading unit) is A Hero) Equal to True
    • Actions
      • Game - Display to (All players) the text: black knight loaded
      • Set VariableSet ignore_next_defend[(Player number of (Owner of (Loading unit)))] = True
  • Transported Unloaded
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Level of Mark of Black Knights for (Entering unit)) Equal to 2
      • ((Entering unit) is A Hero) Equal to True
    • Actions
      • Game - Display to (All players) the text: black knight un-loa...
      • Set VariableSet ignore_next_defend[(Player number of (Owner of (Entering unit)))] = False
  • Universal Blank Ankh Used
    • Events
      • Unit - A unit owned by Player 5 (Yellow) Is issued an order with no target
      • Unit - A unit owned by Player 6 (Orange) Is issued an order with no target
      • Unit - A unit owned by Player 7 (Green) Is issued an order with no target
      • Unit - A unit owned by Player 8 (Pink) Is issued an order with no target
      • Unit - A unit owned by Player 9 (Gray) Is issued an order with no target
      • Unit - A unit owned by Player 10 (Light Blue) Is issued an order with no target
      • Unit - A unit owned by Player 11 (Dark Green) Is issued an order with no target
      • Unit - A unit owned by Player 12 (Brown) Is issued an order with no target
      • Unit - A unit owned by Player 17 (Wheat) Is issued an order with no target
      • Unit - A unit owned by Player 18 (Peach) Is issued an order with no target
      • Unit - A unit owned by Player 19 (Mint) Is issued an order with no target
      • Unit - A unit owned by Player 20 (Lavender) Is issued an order with no target
    • Conditions
      • (Level of Mark of Black Knights for (Triggering unit)) Equal to 2
      • (Issued order) Equal to (Order(undefend))
      • ((Triggering unit) is alive) Equal to True
    • Actions
      • Game - Display to (All players) the text: Ankh used trigger a...
      • Set VariableSet PN_black_ankh = (Player number of (Owner of (Triggering unit)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ignore_next_defend[PN_black_ankh] Equal to False
        • Then - Actions
          • Game - Display to (All players) the text: Ankh used trigger b...
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Charges remaining in (Item carried by Knight_Hero_Var[PN_black_ankh] of type Midnight Ankh)) Greater than 0
            • Then - Actions
              • Special Effect - Create a special effect attached to the origin of Knight_Hero_Var[PN_black_ankh] using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • Unit - Set life of Knight_Hero_Var[PN_black_ankh] to BK_ankh_hp_restore
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Knight_Hero_Var[PN_black_ankh] is selected by Player_array_var[PN_black_ankh].) Equal to True
                • Then - Actions
                  • Selection - Add Knight_Hero_Var[PN_black_ankh] to selection for Player_array_var[PN_black_ankh]
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Charges remaining in (Item carried by Knight_Hero_Var[PN_black_ankh] of type Midnight Ankh)) Equal to 1
                • Then - Actions
                  • Item - Remove (Item carried by Knight_Hero_Var[PN_black_ankh] of type Midnight Ankh)
                • Else - Actions
                  • Item - Set charges remaining in (Item carried by Knight_Hero_Var[PN_black_ankh] of type Midnight Ankh) to ((Charges remaining in (Item carried by Knight_Hero_Var[PN_black_ankh] of type Midnight Ankh)) - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • BK_ankh_cd Greater than 0.00
                • Then - Actions
                  • Countdown Timer - Pause Black_Ankh_CD_Timers[PN_black_ankh]
                  • Countdown Timer - Start Black_Ankh_CD_Timers[PN_black_ankh] as a One-shot timer that will expire in BK_ankh_cd seconds
                  • Unit - For Unit Knight_Hero_Var[PN_black_ankh], start cooldown of ability Black Reincarnation (item ability based on Cairne rez) " over "BK_ankh_cd seconds.
                  • Item - Make (Item carried by Knight_Hero_Var[PN_black_ankh] of type Midnight Ankh) Undroppable
                • Else - Actions
            • Else - Actions
        • Else - Actions

1745387951824.png

No debug message appears when unloading the hero from a transport/boat.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,860
Check to see how Bribe handled it in his GUI Events system.

But one solution that comes to mind is to detect when a Lethal damage event occurs, mark the "dying" hero for a moment, and check for this marking when the undefend Order is issued. If it's unmarked then you know it didn't actually die and the Order is from something unrelated.

Ideally there's a Condition that solves it.
 
Level 21
Joined
Mar 16, 2008
Messages
952
Adding this seems to work. But, another problem, ankhs seem to not work for amphibious units.

  • ...
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Knight_Hero_Var[PN_black_ankh] is being transported) Equal to True
    • Then - Actions
      • Game - Display to (All players) the text: transported
      • Skip remaining actions
    • Else - Actions
  • ...
 
Top