EvilSlayerX5's Mugen Stuff

Where you can find everything I created

Now lets try something more advanced coding that most charcters these days should use, damage dampening.

Alright first off, you should check my previous tutorial for how to declare statedef -2, because this also requires it by the way.  Anyways, this is what you put in statedef -2:

[State -2, VarSet]
type = VarSet
trigger1 = enemy,movetype != H
trigger2 = movetype = H
fv = 0
value = 1
ignorehitpause = 1

Wait, why is it a float variable(fv) instead of a normal variable?  Simple, float variables can record decimals, normal variables can't do so at all.  What this does is sets float variable 0 equal to 1 if you either are under attack and in a hitstate or you currently aren't attacking your foe at the moment.

Now for the real part.  In your hitdefs look at the damage of your attack, what you need to do here is look at the damage and chagne the damage code to somelike like this: damage = floor(50*fvar(0)).

What that does is decrease the damage based on what fvar(0) currently is.

Now to code the triggers themselves(Example is taken for a character whose maxhit count is 15):

[State -2, VarSet]
type = VarSet
triggerall = enemy,movetype = H
trigger1 = enemy,gethitvar(hitcount) <= 1
fv = 0
value = 1
ignorehitpause = 1

[State -2, VarSet]
type = VarSet
triggerall = enemy,movetype = H
trigger1 = enemy,gethitvar(hitcount) = 2
fv = 0
value = .9                                                                                        ignorehitpause = 1

[State -2, VarSet]
type = VarSet
triggerall = enemy,movetype = H
trigger1 = enemy,gethitvar(hitcount) = 3
fv = 0
value=.84                                                                                                              ignorehitpause = 1

[State -2, VarSet]
type = VarSet
triggerall = enemy,movetype = H
trigger1 = enemy,gethitvar(hitcount) = 4
fv = 0
value = .78                                                                                                  ignorehitpause = 1

[State -2, VarSet]
type = VarSet
triggerall = enemy,movetype = H
trigger1 = enemy,gethitvar(hitcount) = 5
fv = 0
value = .72
ignorehitpause = 1

[State -2, VarSet]
type = VarSet
triggerall = enemy,movetype = H
trigger1 = enemy,gethitvar(hitcount) = 6
fv = 0
value = .64                                                                                       ignorehitpause = 1

[State -2, VarSet]
type = VarSet
triggerall = enemy,movetype = H
trigger1 = enemy,gethitvar(hitcount) = 7
fv = 0
value = .58                                                                                       ignorehitpause = 1

[State -2, VarSet]
type = VarSet
triggerall = enemy,movetype = H
trigger1 = enemy,gethitvar(hitcount) = 8
fv = 0
value = .52                                                                                       ignorehitpause = 1

[State -2, VarSet]
type = VarSet
triggerall = enemy,movetype = H
trigger1 = enemy,gethitvar(hitcount) = 9
fv = 0
value = .47                                                                                         ignorehitpause = 1

[State -2, VarSet]
type = VarSet
triggerall = enemy,movetype = H
trigger1 = enemy,gethitvar(hitcount) = 10
fv = 0
value = .425                                                                                     ignorehitpause = 1

[State -2, VarSet]
type = VarSet
triggerall = enemy,movetype = H
trigger1 = enemy,gethitvar(hitcount) = 11
fv = 0
value = .37                                                                                       ignorehitpause = 1

[State -2, VarSet]
type = VarSet
triggerall = enemy,movetype = H
trigger1 = enemy,gethitvar(hitcount) = 12
fv = 0
value = .31                                                                                         ignorehitpause = 1

[State -2, VarSet]
type = VarSet
triggerall = enemy,movetype = H
trigger1 = enemy,gethitvar(hitcount) = 13
fv = 0
value = .235                                                                                     ignorehitpause = 1

[State -2, VarSet]
type = VarSet
triggerall = enemy,movetype = H
trigger1 = enemy,gethitvar(hitcount) = 14
fv = 0
value = .175                                                                                     ignorehitpause = 1

[State -2, VarSet]
type = VarSet
triggerall = enemy,movetype = H
trigger1 = enemy,gethitvar(hitcount) = 15
fv = 0
value = .13                                                                                       ignorehitpause = 1

[State -2, VarSet]
type = VarSet
triggerall = enemy,movetype = H
trigger1 = enemy,gethitvar(hitcount) > 15                                                              fv = 0
value = .1                                                                                          ignorehitpause = 1

Note that you can add variables like this as long as you want to and also
change the varsets to anything you would like to, just make sure that the varset decreases as the hitcount increases.  And you should easily know how to change the required float to something other than 0 already, should you want to.  Like if you want to use float variable 10, just put in all instances of fv = 0 put in fv = 10, and there you have basic damage dampening.