From M.U.G.E.N Wiki
What is Damage Dampening?
Damage Dampening is a Fighting Game mechanic that makes later hits in a combo do less damage with the same attack than earlier hits.
What is it good for?
It's a way to balance out characters that can combo moves together into a chain of attacks. If an attack does a constant amount of damage, adding longer combos is impossible without ruining game balance. Let's see a very basic example. If a character can do 50 damage on average with every attack, which is a reasonable amount, and you want the character to be able to chain up to 12 attacks together, that would result in 600 damage. Doing more than half of the total health of the opponent without him regaining control, and for free, too. Of course you can decide how much you want that chain of 12 moves do in total, for example, you decide on 300, which is a fair amount as long as the combo is not too easy to do. To achieve this, you reduce the damage of the attacks in a way that the new total is 300, but what's the result? The attacks are now doing only 25 damage on average without a combo. In short, comboing no longer rewards the better player with more damage, it is now the only way to do a reasonable amount of damage and stand a chance at winning. It just made the character to weak and hard to play.If your character can combo more than 2-3 moves together, you should consider adding damage dampening, and if it can reach 5+ hits each, or can mix in specials or supers, you absolutely need to add it to keep the character balanced. And additional side effect of damage dampening is, that if the character is able to do a combo much longer than you intended in an unexpected way (like mixing in a projectile or striker move), it won't be an issue as the dampening will make sure the damage stays reasonable. This is especially common if you have moves that have a random outcome that cannot be predicted, like projectiles that are spawned at random locations or time intervals, move randomly or have a homing ability.
How do I add damage dampening to my character?
Although there are some simple solutions that only require a single controller to be added to your minus states, obviously, such solutions are very limited in use, and cannot be customized. In general, a damage dampener code consists of three parts : One that counts the amount of dampening that needs to be applied in a variable, one that applies this to the amount of damage being done, and one that resets this variable whenever the combo is finished and a new one is started. In the example codes, I'm going to use fvar(39) as the dampening value, and it will be a multiplier (meaning that it stores how much the damage need to be multiplied by currently)
Part I : Applying the dampening
This part can be done in two ways. If your character has no helper nor projectile attacks, you can add an Attackmulset controller to your state -3 that applies the dampening value.
[State -3] Type=Attackmulset Trigger1=1 value=fvar(39) ignorehitpause=1
Do note that when using this method, you have to place it below your dampening reset code. If you do have projectile or helper moves, or don't want to use Attackmulset because it's already used in some states, then you have to add the dampening directly to the damage value of your attack hitdefs (and projectiles)
where x is your original damage. Keep in mind that a Hitdef controller is generally executed only once, but the dampening value can change before the hit is done if another source (helper or projectile) hits the opponent. If your attack has a longer duration for the Hitdef being active, it is recommended to reactive it to apply the updated dampener value every tick. This is especially important for helper projectiles, as those generally have their hitdef active for the full duration of the animation (except the startup frames), and if you hit the opponent with a combo before the projectile reaches them, the dampening would not be applied unless the hitdef is reactivated. To reactivate the Hitdef use a code like this :
Type=Hitdef Triggerall=!movecontact Triggerall=!movereversed Trigger1=time>0 damage=floor(fvar(39)*x) ...
In case of a projectile controller, it will always use the dampener value from the time the projectile was generated, so avoid using projectile controllers on projectiles slow enough to allow attacking the opponent with something else before they hit. Use a helper for those projectiles instead. Note that instead of Floor(), Ceil() can be also used, but I recommend using Floor for one reason : If there is an infinite in the character, if Floor is used, hits will eventually do 0 damage each instead of 1, so the total damage that can be done would be still limited. Of course, you should aim at not having infinites, but using floor acts like a safety net against them. It is also useful if there are factors involved that can end up extending combos in an unplanned way, like homing projectiles that can hit the opponent much later than when they were fired.
Part II : Updating the dampener value
To update the dampener value you have to add one of these codes :
In case of a regular attack done by the player
Type=Varset Trigger1=movehit=1 fvar(39)=fvar(39)*x
where x is the amount you want the hit to dampen all future hits in the combo. For example if you want all future hits to do 10% less damage, write 0.9 for x. Recommended values are 0.9-0.95 for weak attacks (~20 damage), 0.8-0.9 for medium (~50 damage), 0.8 or less for strong attacks (more than 70 damage). If you want to make sure no further damage can be done after a powerful attack like a super move, use 0. In general, use 0.1-0.7 for super moves depending on the damage done. This needs to be placed in the attack state in a location that gets executed before the attack ends (meaning above any Changestate controller in the state). In case the player can leave the attack state immediately when the hit is done (chaining/comboing moves can lead to this), this code needs to be placed into state -3 instead with a stateno trigger included, because that way it executes before the changestate in -1 takes effect.
In case of an attack done by a projectile
[State -2] Type=Varset Trigger1=projhittime(y)=0 fvar(39)=fvar(39)*x ignorehitpause=1
As projectiles can hit after your character finished the projectile attack, and left that state, these need to be placed in the state -2. Y is the ID of the projectile. One such controller needs to be added for every type of projectile your character can use. It needs to be added above the dampening reset code.
In case of a helper
Type=Parentvarset Trigger1=movehit=1 fvar(39)=parent,fvar(39)*x
You need to place it above any Destroyself or Changestate controllers the helper might have. If the helper is spawned by another helper, and not by the root, you have to make sure the value reaches the root. For this, you need to put this code to every state of the spawning helper (and its parents), and make sure it is not destroyed until the attack is over :
[State 1081] Type=Parentvarset Trigger1=time>0 fvar(39)=parent,fvar(39)*fvar(39) [State 1081] Type=VarSet Trigger1=1 fvar(39)=1
The dampening reset code
The dampening reset code is responsible for setting your multiplier variable back to 1 when there is no combo being done. Below is an example of what I'm using :
[State -2] Type=VarSet Trigger1=Roundstate<2 Trigger2=P2Stateno=[120,160] Trigger3=enemynear,ctrl Trigger4=P2StateType!=A Trigger4=P2MoveType!=H fvar(39)=1 ignorehitpause=1
This goes to state -2.
This is a special case of helpers. If many of them hit the opponent at the same time (usually happens if they are spawned at the same time at the same spot the opponent happens to stand on, like a move that creates 4 fireballs that move into 4 different directions), dampening won't apply to the hits, so a move that spawns 12 helpers of 30 damage each would for example do 360 damage. To apply dampening in this situation, the "double hitdef" technique needs to be used. Although I won't post details as this is rather complicated, in short, it means doing 2 hits, one for 0 damage that updates the dampener on a hit, and one for the real damage on the next tick if the first hit did happen.
You can add or reduce dampening regardless of attacks and attack damage, whenever you want by modifying the value stored in fvar(39) for example as a special ability that can reduce the effect of dampening to half in a certain mode. You can also change the value in case of a specific combo where the normal dampening amounts would be inappropriate any way you wish. You can make moves that are not affected by dampening (best used in super moves only, or if the damage value is too low per hit on a multi-hit attack and dampening would make it rounded down to 0 too often) simply by not adding the fvar(39)* multiplier into your damage line. You can also make moves that suffer less or more dampening than normal by using an exponent like fvar(39)**0.5 (half effect of dampening) or fvar(39)**2 (for double effect).
This guide was created by Seravy.