YesNoOk
avatar

Damage scale according to target's life (Read 4261 times)

Started by Sam, December 25, 2021, 11:14:41 pm
Share this topic:

Sam

Damage scale according to target's life
#1  December 25, 2021, 11:14:41 pm
  • avatar
  • ***
Hi, my question is kinda dumb, but it has been so long since I last played around coding anything so I can't seem to figure out on my own lol
Here is the thing, I'm trying to come up with some kind of a damage dampener, but based on the target's life value. It works fine, except for the very first hit, since I can't seem to make mugen read the target's value.

Here's the code
Code:
[State -2, VarSet]
type = VarSet
trigger1= Numtarget
trigger1 = target, life > (lifemax*.50)
fv = 0
value = 1

[State -2, VarSet]
type = VarSet
trigger1= Numtarget
trigger1 = target, life <= (lifemax*.50)
fv = 0
value = .87

[State -2, VarSet]
type = VarSet
trigger1= Numtarget
trigger1 = target, life <= (lifemax*.24)
fv = 0
value = .75
Re: Damage scale according to target's life
#2  December 26, 2021, 01:21:37 am
  • ******
  • Hedgehog Whisperer
  • Red Bull addict
    • Spain
    • xgargoyle.mgbr.net
1. The second and third varset are overlapping, resulting in both conditions happening at the same time. You need to add a range delimiter on the second one.
2. You are using the "target,life" as a reference, but before the first hit, you don't have a target. And on the first hit, damage is already applied when acquiring the target so the dampening formula is applied later. I would recommend using "enemynear,life" and "enemynear,lifemax" instead
XGargoyle: Battle posing since 1979
http://xgargoyle.mgbr.net
http://www.pandorabots.com/pandora/talk?botid=e71c0d43fe35093a  <-- Please click that link
http://paypal.me/XGargoyle  <-- Donations welcome!

Sam

Re: Damage scale according to target's life
#3  December 27, 2021, 01:35:31 pm
  • avatar
  • ***
Thanks man!
Yeah, that makes sense!

1. The second and third varset are overlapping, resulting in both conditions happening at the same time. You need to add a range delimiter on the second one.
2. You are using the "target,life" as a reference, but before the first hit, you don't have a target. And on the first hit, damage is already applied when acquiring the target so the dampening formula is applied later. I would recommend using "enemynear,life" and "enemynear,lifemax" instead