• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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,554

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,286
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