YesNoOk
avatar

Damage Scaling/Dampening For Helpers (Read 1712 times)

Started by IKOVKY, January 13, 2025, 06:25:04 pm
Share this topic:
Damage Scaling/Dampening For Helpers
#1  January 13, 2025, 06:25:04 pm
    • USA
I manage to get my damage dampening during combos to work. But I can't get it to work for helpers or projectiles. I would appreciate some assistance!

Here's the code:

[State -2, Hit Count]
type = VarAdd
trigger1 = MoveHit = 1 ; Trigger when a move successfully hits
trigger1 = !HitPauseTime ; Exclude hits during hit pause
fvar(33) = 1 ; Increment the combo counter

; Reset the combo counter
[State -2, Hit Count Reset]
type = VarSet
trigger1 = NumEnemy ; Ensure there is an enemy
trigger1 = (EnemyNear, MoveType != H) ; Reset if the enemy is no longer in a hit state
trigger1 = (EnemyNear, StateNo != 5300) ; Reset if the enemy is not in a custom combo state
fvar(33) = 0 ; Reset the counter

; Set the damage multiplier based on the combo count
[State -2, Damage Multiplier Set]
type = VarSet
trigger1 = fvar(33) > 0 ; Apply scaling only when in a combo
fvar(34) = 1 - (0.2 * fvar(33)) ; Calculate the damage multiplier

; Ensure the damage multiplier doesn't go below 0.5
[State -2, Damage Multiplier Limit]
type = VarSet
trigger1 = fvar(34) < 0.4 ; Check if the multiplier is less than 40%
fvar(34) = 0.4 ; Set to 40% if below

; Apply the final damage multiplier
[State -2, Apply Damage Scaling]
type = AttackMulSet
trigger1 = fvar(33) > 0 ; Apply scaling only when in a combo
value = fvar(34) ; Use the calculated and limited damage multiplier
Re: Damage Scaling/Dampening For Helpers
#2  January 13, 2025, 07:55:13 pm
  • ****
  • Formerly DeathScythe
    • Brazil
    • lyricasky.neocities.org
You probably need to add redirects. Helpers have their own variables, so whenever you want to read the character's variables in a helper, add "root," before it:
root, fvar(33)
root, fvar(34)