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

[Solved] Get a life regen bonus when acquiring an item

Status
Not open for further replies.
Level 3
Joined
Jan 29, 2017
Messages
29
Hello, straight to the point, i have an idea of creating an item which has an ability to grants bonus life regen once we own it (having it in our inventory), but that life regen bonus are disabled temporarily if we taking damage (direct attack or spell damage) from any enemy heroes, and after few seconds if we no longer taking damage from enemy heroes, we have that life regen bonus again.

The question is, how to do that? any suggest?
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
You will probably need to use a DDS (Damage Detection System), to detect when damage is dealt. You can either add/remove a regen ability accordingly or trigger the regeneration.
You need to store a real variable for each unit, to know how long it has not been damaged.
 
Level 11
Joined
May 16, 2016
Messages
730
Hello, straight to the point, i have an idea of creating an item which has an ability to grants bonus life regen once we own it (having it in our inventory), but that life regen bonus are disabled temporarily if we taking damage (direct attack or spell damage) from any enemy heroes, and after few seconds if we no longer taking damage from enemy heroes, we have that life regen bonus again.

The question is, how to do that? any suggest?
 

Attachments

  • Item Life.w3x
    27.7 KB · Views: 28
Level 3
Joined
Jan 29, 2017
Messages
29
Solved! found it my self, i used a unit is attacked event, then check if the attacked unit has that specific item, then i add negated regeneration to the attacked unit. Thanks for the replies though :D
 
Level 3
Joined
Jan 29, 2017
Messages
29
At first, i use the fountain regeneration aura which regenerate health by percentage, but since it was an aura, it has delayed timing when added and removed from the attacked unit, so i think it was unreliable. so then i use normal life regen which regenerate by fixed number (i.e. ring of health)
 
Level 11
Joined
May 16, 2016
Messages
730
Solved! found it my self, i used a unit is attacked event, then check if the attacked unit has that specific item, then i add negated regeneration to the attacked unit. Thanks for the replies though :D
Attack event doesn't mean hit event. Also attack unit doesn't react on damage caused by spells.
Also Also adding/removing negative regeneration is kinda complicated.
 
Can I also submit my solution at the problem? It's quite similar to Fruit Forest's and most likely Dota's Heart of Tarrasque.

- Wolverine dies in Logan
- Just kidding about the spoiler, though it's true. The script is written in vJass and you'll need either JNGP or WEX to make it work correctly.
 

Attachments

  • Life Event Change.w3x
    41 KB · Views: 39
Status
Not open for further replies.
Top