I am trying to do a system where when you enter a trigger it spawns a widget with the character’s line, plays the sound clip of the voice actor and then it destroys the widget after a certain amount of time.
I am trying to achieve this by:
-Create an actor blueprint called PlaySounds
-Create a soundWave var inside it editable
-Set it to the sound that each trigger will choose from the list I have
-Spawn the sound at actor location
-Destroy this specific sound three seconds later, In case the player doesn’t bump in other voices.
Now the problem is what to do when the player hits another trigger while a voice line is playing.
This means I have to stop all sounds and remove the previous UMG, which I tried by doing this:
On each trigger:
-Cast to PlaySounds blueprint
-Play the custom event that stops the current sound from playing
-set the variable of which sound to play
-remove all widgets
-Spawn the sound blueprint at actor location
-Spawn the widget that contains the character line
It’s not working as when I cast to a specific Actor blueprint, in this case the Playsounds blueprint, I get the owner in the object node and it doesn’t give me any errors, but it doesn’t work.
I know I have the option of get all actors of class and do a foreachloop which I tried as well, and it still doesn’t work that way.
Could anyone give me any suggestions?