How can I fix this relatively simple code?

Hello! So I’m trying to make a lava room, where the player is held in a box with invisible walls until the sound is over, after that the walls would dissapear and XXX things would happen.

How can I make it so the walls I put (Blueprint Actors that are invisible walls) would disappear after the sound is over?

Here is my attempt at making it work.
Any help is appreciated!

Hey @UkkosDuck !

If this is on the Level Blueprint, you would just add each lava wall as you did here and give each of them a “Destroy Actor” node.

Alternatively you could use “Make Array” and plug each wall into that, save that array as a variable, then on custom event use “ForEach” with that plugged in and a “Destroy Actor” node after that with the object passed through! :slight_smile:

Hope that helps!

1 Like

Hello @UkkosDuck ,
You could do something like this
This setup plays an audio when the actor starts and removes the invisible walls once the audio finishes.

If you use OnComponentBeginOverlap, it’s important to cast to the Character that enters the collision to make sure only the player can trigger it.

The logic would look something like this:

  • OnComponentBeginOverlap
  • Cast to the player Character
  • If the cast is successful:
    • Immediately disable the trigger’s collision (so it doesn’t trigger again)
    • Start playing the audio
  • When the audio finishes:
    • The On Audio Finished event is executed
    • The walls are disabled (or any other logic you need is executed)

Hope it helps!

it’s not good that drive event by sound

Did you ever get it figured out, @UkkosDuck ?

Let us know how it’s going! And if you got it figured out, let us know for future answer seekers! :slight_smile:

Have you considered driving the event using Blueprint Interfaces or event dispatchers? I’m not sure if it’s a very clean way to handle such logic directly in the OnAudioFinished delegate, I mean, you’d have to iterate over the walls array you mentioned but that’s not shown in your snippet, just something to think about here that might be useful.

1 Like