• 🏆 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] Critical strike only when hp low

Status
Not open for further replies.
Level 11
Joined
Mar 28, 2015
Messages
632
Now I came up with 2 triggers that allow a unit to use critical strike only when it's hp is low (when it has learned a certain hero ability) but it can only be used by a single unit at a time because of the way the triggers work, can anything be done to make it work when the ability is given to multiple units? Nevermind the Garithos condition, it's there for testing purposes

--- = Hero ability which enables this

++++-Critical Stike+++ = Critical strike ability (x3)

  • Untitled Trigger 12
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of (Attacked unit)) Equal to Lord Garithos
          • (Level of --- for (Triggering unit)) Greater than or equal to 1
    • Actions
      • Set ECSUnit = (Attacked unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Level of --- for (Triggering unit)) Equal to 1
              • (Level of ++++-Critical Stike+++ (Neutral Hostile) for ECSUnit) Equal to 0
              • (Life of (Attacked unit)) Less than or equal to ((Max life of (Attacked unit)) / 5.00)
        • Then - Actions
          • Unit - Add ++++-Critical Stike+++ (Neutral Hostile) to ECSUnit
          • Trigger - Turn on Remove Critical Strike <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Level of --- for (Triggering unit)) Equal to 2
              • (Level of ++++-Critical Stike+++ (Neutral Hostile) for ECSUnit) Equal to 0
              • (Life of (Attacked unit)) Less than or equal to ((Max life of (Attacked unit)) / 4.00)
        • Then - Actions
          • Unit - Add ++++-Critical Stike+++ (Neutral Hostile) to ECSUnit
          • Trigger - Turn on Remove Critical Strike <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Level of --- for (Triggering unit)) Equal to 3
              • (Level of ++++-Critical Stike+++ (Neutral Hostile) for ECSUnit) Equal to 0
              • (Life of (Attacked unit)) Less than or equal to ((Max life of (Attacked unit)) / 3.00)
        • Then - Actions
          • Unit - Add ++++-Critical Stike+++ (Neutral Hostile) to ECSUnit
          • Trigger - Turn on Remove Critical Strike <gen>
        • Else - Actions
  • (the ability below is not initially on)
  • Remove Critical Strike
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (ECSUnit is alive) Equal to False
          • And - All (Conditions) are true
            • Conditions
              • (Level of --- for ECSUnit) Equal to 1
              • (Life of ECSUnit) Greater than ((Max life of ECSUnit) / 5.00)
          • And - All (Conditions) are true
            • Conditions
              • (Level of --- for ECSUnit) Equal to 2
              • (Life of ECSUnit) Greater than ((Max life of ECSUnit) / 4.00)
          • And - All (Conditions) are true
            • Conditions
              • (Level of --- for ECSUnit) Equal to 3
              • (Life of ECSUnit) Greater than ((Max life of ECSUnit) / 3.00)
    • Actions
      • Unit - Remove ++++-Critical Stike+++ (Neutral Hostile) from ECSUnit
      • Trigger - Turn off (This trigger)
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
The same trigger that adds critical strike can be used to remove it and thus the system becomes fully MUI. If the health is above the critical strike cuton then if the unit has critical strike remove critical strike (possibly just remove it if one can confirm it is safe to remove abilities a unit does not have).
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
Ull have to add dynamic indexting. Cause the ECSunit variable is overwritten evrery time a new unit gets low enough hp.

Search dynamic indexting here on the hive there are several tutorials regarding it

Ideally you will want to use a damage detection system and trigger the critical strike ability its self in stead of adding/removing when low enough.
 
Level 11
Joined
Mar 28, 2015
Messages
632
I got it working with just one trigger, how is this? Can it be made better?

  • Untitled Trigger 14
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of --- for (Attacking unit)) Greater than or equal to 1
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Level of --- for (Attacking unit)) Equal to 1
              • (Level of ++++-Critical Stike+++ (Neutral Hostile) for (Attacking unit)) Equal to 0
              • (Life of (Attacking unit)) Less than or equal to ((Max life of (Attacking unit)) / 5.00)
        • Then - Actions
          • Unit - Add ++++-Critical Stike+++ (Neutral Hostile) to (Attacking unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Level of --- for (Attacking unit)) Equal to 1
                  • (Level of ++++-Critical Stike+++ (Neutral Hostile) for (Attacking unit)) Equal to 1
                  • (Life of (Attacking unit)) Greater than ((Max life of (Attacking unit)) / 5.00)
            • Then - Actions
              • Unit - Remove ++++-Critical Stike+++ (Neutral Hostile) from (Attacking unit)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Level of --- for (Attacking unit)) Equal to 2
              • (Level of ++++-Critical Stike+++ (Neutral Hostile) for (Attacking unit)) Equal to 0
              • (Life of (Attacking unit)) Less than or equal to ((Max life of (Attacking unit)) / 4.00)
        • Then - Actions
          • Unit - Add ++++-Critical Stike+++ (Neutral Hostile) to (Attacking unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Level of --- for (Attacking unit)) Equal to 2
                  • (Level of ++++-Critical Stike+++ (Neutral Hostile) for (Attacking unit)) Equal to 1
                  • (Life of (Attacking unit)) Greater than ((Max life of (Attacking unit)) / 4.00)
            • Then - Actions
              • Unit - Remove ++++-Critical Stike+++ (Neutral Hostile) from (Attacking unit)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Level of --- for (Attacking unit)) Equal to 3
              • (Level of ++++-Critical Stike+++ (Neutral Hostile) for (Attacking unit)) Equal to 0
              • (Life of (Attacking unit)) Less than or equal to ((Max life of (Attacking unit)) / 3.00)
        • Then - Actions
          • Unit - Add ++++-Critical Stike+++ (Neutral Hostile) to (Attacking unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Level of --- for (Attacking unit)) Equal to 3
                  • (Level of ++++-Critical Stike+++ (Neutral Hostile) for (Attacking unit)) Equal to 1
                  • (Life of (Attacking unit)) Greater than ((Max life of (Attacking unit)) / 3.00)
            • Then - Actions
              • Unit - Remove ++++-Critical Stike+++ (Neutral Hostile) from (Attacking unit)
            • Else - Actions
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
so your basicly using a bunch of if then else for each level

you can change it to this
  • Untitled Trigger 14
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of --- for (Attacking unit)) Greater than or equal to 1
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Level of ++++-Critical Stike+++ (Neutral Hostile) for (Attacking unit)) Equal to 0
              • (Life of (Attacking unit)) Less than or equal to ((Max life of (Attacking unit)) / 6.00 - Level of --- for (Attacking unit)))
        • Then - Actions
          • Unit - Add ++++-Critical Stike+++ (Neutral Hostile) to (Attacking unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Level of ++++-Critical Stike+++ (Neutral Hostile) for (Attacking unit)) Equal to 1
                  • (Life of (Attacking unit)) Greater than ((Max life of (Attacking unit)) / 6.00 - Level of --- for (Attacking unit)))
            • Then - Actions
              • Unit - Remove ++++-Critical Stike+++ (Neutral Hostile) from (Attacking unit)
            • Else - Actions
i believe that math is right
 
Status
Not open for further replies.
Top