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

Skill hp percentage

Status
Not open for further replies.
Level 2
Joined
Sep 22, 2014
Messages
6
Hello, I would like someone to tell me how I can do to make the tigger is activated when a unit has a specified percentage of life.I just want to know how to make the event. :vw_wtf: :vw_wtf:

Thank You! :thumbs_up:
 
The best way would probably be to use a DDS system (such as lookingforhelp's or Bribe's DDS). When a unit is damaged, check if they have that ability and activate it if necessary.

You'll also have to beware of when you set a unit's life specifically (through triggers), since that doesn't fire the damage event. I don't think there is a generic "unit's life falls below some %" event.
 
Level 13
Joined
Dec 21, 2010
Messages
541
Why use DDS? he said "tell me how I can do to make the tigger is activated when a unit has a specified percentage of life"

so just make an event every 1 or 0.5 or 0.03 (just to be precise) seconds of game time...then store the unit in a variable so you can check his life percentage.. then create a boolean so the trigger you want to run will not run multiple times..
 
Why use DDS? he said "tell me how I can do to make the tigger is activated when a unit has a specified percentage of life"

so just make an event every 1 or 0.5 or 0.03 (just to be precise) seconds of game time...then store the unit in a variable so you can check his life percentage.. then create a boolean so the trigger you want to run will not run multiple times..

In most maps, you'll only go down in HP when you're damaged. So it makes sense to only check % hp when a unit is damaged. Here is a simple comparison:

Let's say a unit stands still for 10 seconds straight (nothing happens to him). The DDS version will have checked his hp % 0 times, since he wasn't hit at all. A timer with 0.03 periodic checking will have checked it ~333 times. With 1 sec or 0.5 sec, it would have checked it 10 and 20 times respectively. Ultimately, the philosophy I follow is that you should only check things when necessary. In a real game, there will be a lot of downtime. People go afk, run to the bathroom, sit around in hubs, etc. The number of wasted operations will add up--and even if it doesn't make much of a difference for our processors (since they can run billions of operations), it is just better to only check things when you need to. :)

But I agree that this could be done with a periodic timer. It depends. If you set unit's life manually through triggers, then a periodic timer is the best route. If you don't already have a DDS in your map, then yeah you may want to resort to a periodic timer if this is a small part of your map. Or if you had something like a footman frenzy, then there may be more damage going on per second than a timer would check, so maybe it would end up being less overhead to use a dedicated timer. Ultimately, those options need to be separately weighed depending on the map. I just proposed one route that I personally thought was very easy and efficient for passive abilities.
 
Status
Not open for further replies.
Top