• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Life precentage skills

Status
Not open for further replies.
Level 5
Joined
Jul 18, 2010
Messages
159
Hello, I've got a problem with makeing two skills
1) I want to make skill which will add bonus to unit when the life will get under for example 10%. Anyone know how to make game check actual precentage life of the unit?

2) Second skill will consume 10% of life when used, and i can't find out how to do this ;/
Hope it is possible and you'll help me :)
 
Use a timer that runs every 0.03 seconds and checks if the desired units hp is below x%
 
1) I want to make skill which will add bonus to unit when the life will get under for example 10%. Anyone know how to make game check actual precentage life of the unit?
There are two approaches for this.

1. Polling: Where you periodically check the life of a unit to see if it is less than 10% of the maximum life for the unit.

2. On damage: Where the unit takes damage that will reduce life below the 10% threshold (be aware the event fires before the actual damage is removed from health). Although this will detect most cases it will not detect life reduction via non-damage sources such as Disease Cloud of the Abomination or calls to set unit life below the threshold.

2) Second skill will consume 10% of life when used, and i can't find out how to do this ;/
There are also two approaches for this.

1. Set the life to the current life minus 10% or the current or maximum life (obviously for current life there is a simplification available).

2. Instead of subtracting the current life by 10% of the current or maximum life, you damage the unit by that amount in a form that will not get reduced. This will run on damage events which may or may not be what you want to happen.
 
Status
Not open for further replies.
Back
Top