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

[Solved] Unit below %hp gets ability help

Status
Not open for further replies.
Level 4
Joined
Jul 22, 2012
Messages
72
Ok so I have a hero with one unit ability and 5 hero abilities. One of his Hero abilities grants this triggering effect where when he reached a %health lv he gains increased attack speed with a buff showing he is being effected. And upon healing past that % lv he looses the attack speed and buff returning to normal.

And I am sorta new to this trigger thing btw (but get the basics)
So here is my triggers

Enraged
Events
Unit - Learns a skill
Conditions
(Learned Hero Skill) Equal to Enraged
Actions
Trigger - Turn on Enrage ability gain <gen>
Trigger - Turn on Enraged off <gen>
__________________________________________________________________________
Enrage ability gain
Events
Conditions
(Percentage life of unit) Less than or equal to 40.00
Actions
Unit - Add Enraged (Hero Skill) to (Triggering unit)
If ((Level of Enraged for (Triggering unit)) Equal to 2) then do (Unit - Set level of Enraged (Hero Skill) for (Triggering unit) to 2) else do (Do nothing)
If ((Level of Enraged for (Triggering unit)) Equal to 3) then do (Unit - Set level of Enraged (Hero Skill) for (Triggering unit) to 3) else do (Do nothing)

________________________________________________________________________

Enraged off
Events
Conditions
(Percentage life of unit) Greater than 40.00
Actions
Unit - Remove Enraged (Hero Skill) from (Triggering unit)







The spells used are endurance aura for enraged. And for the buff triggered spell Gloves of speed if that matters.
 
Last edited:
Every second check if its life is less than the enable percentage, if so then give the hero the ability. If not then remove the ability from the hero.

That is one of the possible solutions for the problem. The other one would require a lot of refreshing of triggers but it would be instantaneous; without having to use a timer.


Use [trigger][/trigger] tags.


It's like this:

  • Event
    • (Specific unit)
    • Unit's life becomes less than 50% of Unit's max life
  • Condition
    • Unit has (your Abil) equal to true
  • Action
    • ---- This part is the refresh part ----
    • Disable (This trigger)
    • Custom Script: call TriggerRemoveAction(GetTriggeringTrigger(), LoadTriggerActionHandle(SUM_HASH, <int_1>, GetHandleId(GetTriggeringTrigger()))
    • Custom Script: call DestroyTrigger(GetTriggeringTrigger())
    • ---- recreation part ----
    • ---- It's too complex to code in GUI, so just know that it creates a trigger and assigns its' conditions and actions. ----
    • ---- Ignore this, it's for commentary ----
    • Unit - Add (some Abil) to (triggering unit)
    • ---- Activate the other trigger ----
    • Enable (Trigger with unit life event greater than or equal to 50%)
Note that the refreshes require intermediate knowledge in JASS.
 
Status
Not open for further replies.
Top