Sound not playing with very simple code?

Before proceeding, please use the forum search feature at the top of the page to check if your question has already been answered.

So basically I have very basic code to have a sound file play when character takes damage but for some reason it doesn’t work and I got no clue why since it worked before.

This is all the code I have going on for this very specific sound. The character is using the health point behavior and it works for taking damage and everything else but for some reason it does not want to trigger the sound. The problem is not the sound because when used code like “if X key press = then play bloodhit.ogg” the sound file does work. Sound channel 12 is also not used by anything else.

Trigger sound file.

Trigger damage to player

kuva

What is going on here? Why doesn’t the sound play?

If the trigger sound is before the trigger damage it may cause an issue since the way gdevelop works is it runs all Events every frame (set up in game properties and icons) and it runs them from top to bottom, so that may be an issue? idk

That could be. I always thought it didn’t do it top to bottom since I swear I heard it in an official GDevelop video. I’ll give it a try

I know for a fact because I had something like this when I was making a tutorial for my shooter game and it would not detect because the thing was above the other

GDevelop does run through the event sheet from top to bottom. Things get a bit more complex when async calls (the Wait action) is used.

Health has just been damaged happens once
So there is no point there for trigger once

And what is the point for having two events if you could put play sound action in event where you apply damage?

This was simplified version of my code. If I remember correctly it wouldn’t work the other way since the damage sound has to be shared between multiple characters and multiple items and what not so it wouldn’t work if they were all on the same line. If I would do it the other way I would have to put the “play sound” line to each item (which there are 5 of) rather than just putting it to “character takes damage” once.