Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_DeathMusic.c
Go to the documentation of this file.
2{
3 MusicManager m_MusicManager;
4
5 //~ When the player died
6 protected void OnPlayerDied(notnull SCR_InstigatorContextData instigatorContextData)
7 {
8 if (instigatorContextData.GetVictimPlayerID() != SCR_PlayerController.GetLocalPlayerId())
9 return;
10
11 m_MusicManager.Play(SCR_SoundEvent.SOUND_ONDEATH);
12 }
13
14 override void Init()
15 {
16 ChimeraWorld world = GetGame().GetWorld();
17
18 if (!world)
19 return;
20
21 m_MusicManager = world.GetMusicManager();
22 if (!m_MusicManager)
23 return;
24
25 //~ On player spawned and died register
27 if (gameMode)
28 {
29 gameMode.GetOnPlayerKilled().Insert(OnPlayerDied);
30 }
31
32 }
33
34 override void OnDelete()
35 {
37 if (gameMode)
38 {
39 gameMode.GetOnPlayerKilled().Remove(OnPlayerDied);
40 }
41 }
42}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_BaseGameMode GetGameMode()
ScriptInvokerBase< SCR_BaseGameMode_OnControllableDestroyed > GetOnPlayerKilled()
override void OnDelete()
override void Init()
void OnPlayerDied(notnull SCR_InstigatorContextData instigatorContextData)
static int GetLocalPlayerId()
Returns either a valid ID of local player or 0.