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

[Trigger] Heal over time trigger, overwriting

Status
Not open for further replies.
Level 6
Joined
Jul 22, 2021
Messages
50
Hello,

So I made these triggers which cause the triggering unit to heal +50 hp and then an additional 75 hp over time.
But there's a problem when other unit will use the spell (during HoT duration), then the trigger is kinda "overwritten" onto the latest unit which used the spell.

I was thinking maybe variable arrays will solve this problem, but I'm not really sure how to implement this. Maybe there is another workaround on this?

Below you can find the triggers I made.

  • Well Fed
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(neutralspell))
        • Then - Actions
          • Unit - Order Priest 0263 <gen> to Human Priest - Inner Fire (Triggering unit)
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 50.00)
          • Set VariableSet WellFedUnit = (Triggering unit)
          • Wait 2.00 seconds
          • Trigger - Turn on Well Fed HoT <gen>
        • Else - Actions

  • Well Fed HoT
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Set life of WellFedUnit to ((Life of WellFedUnit) + 15.00)
      • Wait 15.00 seconds
      • Trigger - Turn off Well Fed HoT <gen>
 
Level 39
Joined
Feb 27, 2007
Messages
5,069
Haha, we all make mistakes. The kind of problem that you ran into, for reference, is making a spell (or bit of code) Mult-Unit Instancable (MUI). Your intuition about variable arrays is correct. Here's a good tutorial that explains how to use that method:

 
Status
Not open for further replies.
Top