How to implement specific variable operations with the TakenDamageSettings node?

I’d like to try using TakenDamageSettings to configure hit display effects for the player,
achieving different visual effects via variables such as taken_damage or hp.

For example, flash white when HP is 1, flash red when HP is 3, and do not flash when HP is 0.

However, during implementation, I haven’t found a way to provide different display effects by specifying variable values.
Could you please let me know if this node currently supports such functionality?

From my understanding, TakenDamageSettings can’t choose an entry from a variable value like taken_damage or hp. Each entry in the Damage Data List is chosen by the attack’s attribute, and you can also make an entry only apply while a switch is ON or OFF.

If the 1 damage hits and the 3 damage hits come from different attacks, I think the attribute way is the easiest. Give each attack its own attribute in its AttackSettings, then make one entry per attribute in the player’s TakenDamageSettings. One gets Paint Color white with blink, one gets Paint Color red, and for the attack that does 0 damage, make an entry with the filter and blink both turned off. Be careful with an entry set to Attribute “None”. It matches every attack, and when a hit matches more than one entry the damage is applied once per entry, so the HP loss adds up.

If you mean the player’s current HP instead, I think this is where a sub layer would work really well. Add a switch to the player like LowHP and make a sub layer in the player’s Visual Script that turns it ON when hp is 3 or lower and OFF when it goes back up. Then set the red entry to only apply while LowHP is ON and the white entry while it’s OFF. Since the sub layer runs alongside the main layer, it keeps watching hp no matter what state the player is in.

If it really needs to follow the exact damage amount, you could also do the flash itself in a sub layer. Turn off the filter and blink in TakenDamageSettings, and in the sub layer go from a waiting state to a flash state when the player is hit, choosing ApplyObjectFilter with red or white by comparing taken_damage, then RemoveFilter after a short Wait. The main layer keeps doing its normal thing. I haven’t tested exactly when taken_damage updates after a hit, so I’d check its value there first before building on it.

Also, if you still see blinking on a 0 damage hit, it might be the invincibility blink. That’s the Enable Blink option in BaseSettings, which is separate from TakenDamageSettings.

1 Like

Thanks to baz for the very detailed explanation. I did some research afterwards and realized that I need to manually add attack attribute variables in the database, then assign attack actions and attributes to each object capable of attacking, and finally set up damage attributes for the player. Although the process is somewhat tedious, it largely achieves the desired effect.

I never really understood the purpose of vs attack actions before (since as long as there’s an attack hitbox, attacks would trigger automatically without explicitly setting them). Now I finally get it.

However, I’m a bit confused why TakenDamageSettings already includes built-in toggle options but lacks built-in variable selections.

It’s probably because the initial spec followed PGM’s implimentation closely.

I’m sure it could be added now, I just don’t know the priority for it.

I see. I hope the development team adds variable selection in the future, as it would make many adjustments much easier.