My blueprint is this: if an enemy gets hit, I play the hit sound and subtract the enemy’s health. If the enemy’s health is less than 0, I play the enemy’s death sound. The problem is how NOT to play that last hit sound if death occurs afterwards. I just don’t want to play two sounds in a row - a hit sound followed by a death sound, it sounds silly. I just want to play the death sound. But how to solve this logically - an enemy can have a health value of 1 or also 50, and I’m never able to determine in advance how many hits the player will kill him with. Does anyone have an idea how to solve this?
In OnHit()
(or whichever callback you use):
- Subtract damage from health
- If remaining health > 0, play
HitSound
- Else play
DeathSound
If your callback is a generic “take damage” callback, then you have to attach the “hit sound” to the damage type, so use one damage type per kind of hit sound you want to play.
Well, this is my blueprint. I use “Event AnyDamage”. How exactly should I create a different damage type and attach a sound to it?
There are some good links on damage types here:
Note the “damage class” option, where you can select a subclass of the damage type class. There you can configure your own class, and give that class a sound to play.