• 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.

[Spell] Scaling hp damage

Status
Not open for further replies.
Level 2
Joined
Aug 9, 2012
Messages
6
Hey, first time posting so i hope this is the correct place. i need help with a spell that will deal damage equal to 40% of a targets missing hit points.

example: 100/1000 hit points would take 360 damage from the ability

im not the best with the triggers so im at a bit of a loss here. i dont use jass or anything other than the vanilla editor.

Thanks ^^
 
Level 12
Joined
May 22, 2015
Messages
1,051
Hey, first time posting so i hope this is the correct place. i need help with a spell that will deal damage equal to 40% of a targets missing hit points.

example: 100/1000 hit points would take 360 damage from the ability

im not the best with the triggers so im at a bit of a loss here. i dont use jass or anything other than the vanilla editor.

Thanks ^^

There's no direct way to get the missing health of a unit, so you have to get their max health minus their remaining health.

It would look a little like this:
  • Special Zap
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • Ability being cast is equal to Special Zap
  • Actions
    • set tempReal = ((Max life of (Target Unit of Ability being cast) - (Life of (Target Unit of Ability being cast)) * 0.40)
    • Unit - Cause (Trigger unit) to deal (tempReal) damage to (Target unit of ability being cast)
The damage function definitely has a bunch more things to fill out, but I don't remember them well.
 
Level 2
Joined
Aug 9, 2012
Messages
6
Special Zap
Events
Unit - A unit starts the effect of an ability
Conditions
Ability being cast is equal to Special Zap
Actions
set tempReal = ((Max life of (Target Unit of Ability being cast) - (Life of (Target Unit of Ability being cast)) * 0.40)
Unit - Cause (Trigger unit) to deal (tempReal) damage to (Target unit of ability being cast)

I tried this obviously adujsted to my own spell names but it simply puts the target from 100% to 40% hp and anything after that is an instant kill.

I think there is still something missing here but im completely lost as to what. I would 'quote' it but ive no idea how :)
 
Level 2
Joined
Aug 9, 2012
Messages
6
Done! I did it! you were correct i just put the calculation in a little wrong when i did the action. works perfectly now :) Thank you so much!
 
Status
Not open for further replies.
Top