also depends on the scale. let's say you want to deal 10 dmg if the unit has 80-100 health, 20 dmg if 60-80 etc, this can be done with a trigger effect validating the different health status. if it has to be more dynamic and you don't want to deal a fixed amount of dmg then you have to go with a data + trigger solution.
well actually i just got an idea, again based on the idea of critical strike. each unit needs a behaviour with damage response. when reacting to dmg you use a trigger effect to apply different behaviours based on the current health (80-100 % hp = buff 1, 60-80 = buff 2 etc), those behaviours will amply the dmg with a fixed percentage amount. it's still not as flexible as triggers but you could deal % dmg instead of fixed values.
I highly recommend to use a trigger for a missing health damage effect, because it's much smoother and more efficient.
A small explanation - it's really easy:
Data: Make your ability normally and name the damage effect something you remember (e.g. Ability Missing Health Damage). Make another damage effect and name it "Physical Damage" or "Spell Damage" or whatever TYPE the damage is going to be, because this will be the effect that actually deals damage later. Both these effects need to have amount = 0, because the trigger will add damage. Make sure to change the flags for your Missing Health Damage effect so it doesn't gain scaled/unscaled/fraction bonuses, because otherwise if you pick up an item with +10 damage your damage effect that should deal 0 damage suddenly deals 10.
Go to triggers. Make a new one and name it like your ability so you can remember what it does. Add an Event "Unit takes damage". Now in that line change the field "effect" to the damage effect that you created for your ability, you find it in the "value" area. This will cause the trigger to trigger when a unit takes damage from the ability.
We don't need variables or conditions.
In the Actions section add an action "deal damage". You select your second damage effect (the one you named physical or spell dmg or similar) as the damage dealing effect. For target you select "triggering unit" and for caster "damaging unit", these can be found in "functions".
Now the hard part - there is a part "with xxx bonus damage" - this is where we calculate the missing health damage. Basically what you do is - click on it, select "Expression", there you have an ~A~ - your first variable. We will need two variables so add another. Make ~A~ a function "Unit Property" and select Maximum Life (Current). Select function too for ~B~ then again Unit Property but this time Life (Current). The one thing left is how you want to deal damage. Say you want your ability to deal 8% missing health, then your expression needs to be (~A~-~B~)*0.08. You can copy-paste this no problem.
The title says it all; how do I make a damage effect that scales with the amount of health the target is missing?
You can't create scaling damage using data. Triggers would have to be your solution for this.
@TheLazzoro: Go
also depends on the scale. let's say you want to deal 10 dmg if the unit has 80-100 health, 20 dmg if 60-80 etc, this can be done with a trigger effect validating the different health status. if it has to be more dynamic and you don't want to deal a fixed amount of dmg then you have to go with a data + trigger solution.
Dammit. I'd hoped for a solution in the data editor only... I guess there is none :/
@TheLazzoro: Go
well actually i just got an idea, again based on the idea of critical strike. each unit needs a behaviour with damage response. when reacting to dmg you use a trigger effect to apply different behaviours based on the current health (80-100 % hp = buff 1, 60-80 = buff 2 etc), those behaviours will amply the dmg with a fixed percentage amount. it's still not as flexible as triggers but you could deal % dmg instead of fixed values.
@FunkyUserName: Go
Glad that you're trying to help me, but I need a solution where the data editor is the only one involved.
@TheLazzoro: Go
my post doesn't invole triggers
You mentioned "trigger" in this one... I don't think I get your idea :P
@TheLazzoro: Go
He means an effect in data that triggers when damage happens.
@Spoolofwhool: Go
trigger effect == switch effect, sry for my bad english
Ahh alright, thx :D
I highly recommend to use a trigger for a missing health damage effect, because it's much smoother and more efficient.
A small explanation - it's really easy:
Data: Make your ability normally and name the damage effect something you remember (e.g. Ability Missing Health Damage). Make another damage effect and name it "Physical Damage" or "Spell Damage" or whatever TYPE the damage is going to be, because this will be the effect that actually deals damage later. Both these effects need to have amount = 0, because the trigger will add damage. Make sure to change the flags for your Missing Health Damage effect so it doesn't gain scaled/unscaled/fraction bonuses, because otherwise if you pick up an item with +10 damage your damage effect that should deal 0 damage suddenly deals 10.
Go to triggers. Make a new one and name it like your ability so you can remember what it does. Add an Event "Unit takes damage". Now in that line change the field "effect" to the damage effect that you created for your ability, you find it in the "value" area. This will cause the trigger to trigger when a unit takes damage from the ability.
We don't need variables or conditions.
In the Actions section add an action "deal damage". You select your second damage effect (the one you named physical or spell dmg or similar) as the damage dealing effect. For target you select "triggering unit" and for caster "damaging unit", these can be found in "functions".
Now the hard part - there is a part "with xxx bonus damage" - this is where we calculate the missing health damage. Basically what you do is - click on it, select "Expression", there you have an ~A~ - your first variable. We will need two variables so add another. Make ~A~ a function "Unit Property" and select Maximum Life (Current). Select function too for ~B~ then again Unit Property but this time Life (Current). The one thing left is how you want to deal damage. Say you want your ability to deal 8% missing health, then your expression needs to be (~A~-~B~)*0.08. You can copy-paste this no problem.