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

remove ability when buff ends?

Status
Not open for further replies.

311

311

Level 4
Joined
May 12, 2019
Messages
73
So I am trying to have an ability that is like thorns, but instead of an aura its castable so it has a duration.
I thought of an idea to add it, but removing it is the hard part.
So to add it I basically just have an autocast ability like inner fire that does technically nothing, but a trigger that says when you finish casting the ability add my "Thorns abilty" to the unit. The problem is how would I remove it when my "fake inner fire" buff ends
(I don't think it matters but it is still an aura for the duration, and its technically thorns and elunes grace)

  • Untitled Trigger 004
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
      • ((Triggering unit) has buff Dummy Reflect ) Equal to False
    • Actions
      • Unit - Remove Reflect from (Triggering unit)
I know the above wont wont as there is no triggering unit, so that's the part I need help with, also the trigger going off every .1 seconds, wont that cause lag?

I am trying to create a buff you place on yourself, that gives an aura to reflect melee/ranged/spell dmg for a short period of time
 
Level 39
Joined
Feb 27, 2007
Messages
5,023
the trigger going off every .1 seconds, wont that cause lag?
In general, no. If you do some stupid stuff, write leaky triggers, or do something very computationally expensive then yes it can be a drag. 0.03 timers are perfectly acceptable most of the time, though in a situation like this I think you could reasonably get away with 0.2 or 0.25 without there being a noticeable delay between losing the buff and losing the ability.
I know the above wont wont as there is no triggering unit, so that's the part I need help with
You can use a unit variable to track the triggering unit, but that solution will not be MUI. The best option is to use a unit group: when the unit casts add it to a unit group, then check units in that group to see if they have the buff.

  • Untitled Trigger 004
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit ion THORNS_GROUP and do (Actions)
        • Loop - Actions
          • If (All conditions are true) then do (then actions) else do (else actions)
            • If - Conditions
              • ((Picked unit) has buff Dummy Reflect ) Equal to False
            • Then - Actions
              • Unit - Remove Reflect from (Picked unit)
              • Unit Group - Remove (Picked Unit) from THORNS_GROUP
            • Else - Actions
 

311

311

Level 4
Joined
May 12, 2019
Messages
73
In general, no. If you do some stupid stuff, write leaky triggers, or do something very computationally expensive then yes it can be a drag. 0.03 timers are perfectly acceptable most of the time, though in a situation like this I think you could reasonably get away with 0.2 or 0.25 without there being a noticeable delay between losing the buff and losing the ability.

You can use a unit variable to track the triggering unit, but that solution will not be MUI. The best option is to use a unit group: when the unit casts add it to a unit group, then check units in that group to see if they have the buff.

  • Untitled Trigger 004
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit ion THORNS_GROUP and do (Actions)
        • Loop - Actions
          • If (All conditions are true) then do (then actions) else do (else actions)
            • If - Conditions
              • ((Picked unit) has buff Dummy Reflect ) Equal to False
            • Then - Actions
              • Unit - Remove Reflect from (Picked unit)
              • Unit Group - Remove (Picked Unit) from THORNS_GROUP
            • Else - Actions


hmm I have no idea why I know when I tested elunes grace before it was doing what I wanted, but now none of the fields seem to be working correctly, chance to deflect is what now makes attack take damage, but only if I put it over 100, which always makes them take 100% no matter the # I put, and me take MORE damage(I am still not changing any other field), the other fields do nothing, even when putting extreme #s like 99999.
Hopefully its a beta issue, as I have been doing everything in reforged editor.
I will go ahead and try your trigger though thanks :)
 
Status
Not open for further replies.
Top