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

Ability: Healing Hearth

Status
Not open for further replies.
Level 2
Joined
Oct 17, 2015
Messages
7
The Hearth is an ability that can be applied to farms and houses.

When a unit enters the building's cargo they will begin to slowly heal over time.

I was wondering if I could make a trigger that heals units when they're in cargo.

Sort of like the opposite of Devour.

(I also thought of putting the animation of the Sleeping Spell above rooftops when this ability is active. Just to be cute.)
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
I think there is an event for when unit is loaded into transport - afaik that event fires for all types cargos.
When unit leaves cargo can be detected by "unit enters (playable map area))" event.

So basically what I would do would be the following:
Create a generic unit group.
When the event "unit is loaded into transport" fires and the unit-type of the transporting unit is equal to your structure, then add the triggering unit to your generic unit group.
When unit enters playable map area and that unit is in your generic unit group, remove it from the group.
Create a trigger with periodic event and iterate through each unit inside the unit group and increase their health.

Edit: Something like this:
  • Unit enters house
    • Events
      • Unit - A unit Is loaded into a transport
    • Conditions
      • (Unit-type of (Transporting unit)) Equal to Farm
    • Actions
      • Unit Group - Add (Triggering unit) to HearthingGroup
  • Unit leaves house
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • ((Triggering unit) is in HearthingGroup) Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from HearthingGroup
  • Heal units
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HearthingGroup and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 5.00)
 
Status
Not open for further replies.
Top