Needing help with character hitting object that plays sound but loops if stuck on object (with do once added)

Hey there, I am having a slight issue when my character rag dolls and hits an object it plays a soundcue. For the most part it works how I want it, the issue I am having is when the character can get stuck on said object it plays the sound over and over (which is why I have a do once to avoid it in the first place). I am wondering if my blueprint is setup correctly or what I need to add to it (or improve it if its not a good way of doing this). I’m really new to UE5 (I’ve been using it for the first time for about 9 days or so roughly)

Here is the blueprint

If I sucked at explaining, here is a video. The first clip is basically how I want it/how it works each hit, activates the sound cue (3 different sounds)
But the 2nd clip is when the character can get stuck (which I want so there is some kind of goal to the little project - reach the bottom) but only want the first hit to be registered should the character get stuck like in the video.

Please let me know if I need to add other information.
I added this screenshot as I’m not sure if its needed (or helpful)

Thank you

You can play the sound ( with a do once ) on overlap, instead of hit.

That way, you can reset the do once, on end overlap :slight_smile:

1 Like

Thanks for the reply, when I do that it doesn’t seem to play any audio then.
I attempted on the collision box too and it would play a sound but would only register the one hit basically.

This is my blueprint just to confirm I understood and setup correctly from your last comment.

And just to confirm, I apply this to the 3D model itself (Cylinder) or do I add it to the hitbox (Capsule)?

You’re on the right track :slight_smile:

It would be applied to the capsule ( so you’ll probably need to make it fatter ).

1 Like

Sorry for the late reply, just got time to work on it some more.
Ok so the sound is somewhat working better, but it doesn’t seem to do every bar it hits (sometimes I can get like 2-3 bars making the noise, other times it doesn’t make a noise when landed/hit).

But it is improving thank you for your help so far

Ok, that’s good.

You could try triggering the sound on hit, IF, it’s not already playing.

For that, use ‘spawn sound 2D’ instead. As it gives you a reference to check.

1 Like

How would I do that? I know the on hit and and the sound 2D part, just a bit unsure on the if function (and how to set one up)

1 Like

Just something like

1 Like

And just to confirm, I am doing this on the characters Blue Print as the metal bars Blue print I made within UE so I don’t have a static mesh so thats why I was asking was this for the character BP and not metal BP, sorry to be annoying. Also I wasn’t able to find “play sound if not playing”

It’s a custom event, you can call them anything you want :wink:

1 Like

Ahhhh yes I understand now, well I am about 99% there. It does what I was wanting, there are two issues (one might fix the other though) I seem to have the sound playing constantly on if character gets stuck on bar, but the other issue is I compile, save…everything is fine…I play/test and when I exit the testing area i get some audio issues…Not quite sure why though…

Just before I sent this message, I turned off the auto destroy in the Spawn Sound 2D area which cleaned up the errors. So now I’ve just got the audio playing non stop if character gets stuck to the bar again. Would I need a do once somewhere connected to the spawn 2D node? (But other than that, its working the way I want it to basically, just that little hicup if he gets stuck on the bar). Thank you so much

When the character gets stuck, are they dead at that point?

1 Like

Basically yeah, I have a trigger just above the pit that activates the character to ragdoll (and player can jump and activate ragdoll too). (image to give you a bit of an idea)

So when you rag doll the player, stop playing the sound :slight_smile:

Oh but I am wanting it to play the sound, my project is based off like the death pits in UT2004 for example (the player would auto ragdoll if you went past a certain point of the pit). So the goal is to jump into the pit and make it all the way to the bottom and was wanting like the “crashing” noises when the character would connect to the metal bars falling down.

I have marked this as resolved, massive thanks ClockworkOcen. As this allowed me to have when the character hits the bars it would play every time. Though a little bug that I can’t figure out (but will leave it for now, or just leave it) is when the character gets stuck on a bar the sound plays due to the way it’s setup but it’s not a huge issue as players will reset when this happens anyways.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.