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

Regain HP

Status
Not open for further replies.
Level 11
Joined
Jun 20, 2009
Messages
880
I need "system" for my map.
When ANY unit in the map doesn't take damage for 5 seconds, it will start
regaining its HP like 20 per second. This regeneration will stop again if damage is taken.

And naturally, i want it to be MUI and GUI. So how can i do this? Any hints?
 
Level 16
Joined
Aug 20, 2009
Messages
1,552

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,191
You could use StarCraft II where this is a native field in the data editor.

In WC3 you need to use the damage detection event and a timer localized for every unit. When a unit takes damage remove the regen ability (based on life regen item ability) and start the timer for 5 seconds. If the unit has a timer already started for it, just reset it (ability should already be removed). I advise hashtables for this.

When the timer expires, it means damage was not taken for 5 seconds so give the unit the rehealing ability. You can then remove/recycle the timer. Again, you should probably use hashtables to keep track of which unit the timer refers to.

When a unit enters the map, add the damage event for them and add the fast regen ability (as they have been un damaged for an undifined amount of time).
 
uhm, this:

Dr Super Good said:
In WC3 you need to use the damage detection event and a timer localized for every unit. When a unit takes damage remove the regen ability (based on life regen item ability) and start the timer for 5 seconds. If the unit has a timer already started for it, just reset it (ability should already be removed). I advise hashtables for this.

When the timer expires, it means damage was not taken for 5 seconds so give the unit the rehealing ability. You can then remove/recycle the timer. Again, you should probably use hashtables to keep track of which unit the timer refers to.

When a unit enters the map, add the damage event for them and add the fast regen ability (as they have been un damaged for an undifined amount of time).
 
Status
Not open for further replies.
Top