I am extremely new to UEFN and Verse, and I’m trying to create a script that plays a sound when a player gets eliminated. (The script also plays a sound onBegin, but that can be ignored for this question). The code I have now works when the user is eliminated via fall damage (and it should work when eliminated by another player? not 100% how to test that right now…please LMK if you know!) but when they are eliminated by the storm, the audio doesn’t play but the Print
gets logged. I think it may be because there’s a sound already playing? I tried looking to see if I could disable the default storm elimination sound, but I had no luck.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
Event_Sound_Manager := class(creative_device):
@editable
KillSoundAudioPlayer : audio_player_device = audio_player_device{}
@editable
RoundStartSoundAudioPlayer : audio_player_device = audio_player_device{}
@editable
EliminationManager : elimination_manager_device = elimination_manager_device{}
OnBegin<override>()<suspends>:void=
EliminationManager.EliminatedEvent.Subscribe(OnEliminated)
RoundStartSoundAudioPlayer.Play()
Print("Death Sound Manager Started")
OnEliminated(Agent : agent):void=
Print("Eliminated")
KillSoundAudioPlayer.Play()