Jump to content
cklymowsky

HELP with playing start-up music for each JIP

Recommended Posts

HI All,

 

I'm trying to play my start-up music for every client that joins the game, but so far it only plays on the host?

 

initPlayerLocal.sqf

_handle1 = addMissionEventHandler ["PlayerConnected",{playMusic "MenuMusic"}];

...

//BI RESPAWN MENU - IDD 58 PLAY MenuMusic
if (!isDedicated) then { 
	waitUntil {!(isNull (findDisplay 58))}; 
	if (isNil "BEAK_MUSIC_INIT") then {
		BEAK_MUSIC_INIT = 1;
		playMusic "MenuMusic";
		_music = addMusicEventHandler ["MusicStop",{playMusic (_this select 0)}];
		waitUntil {isNull (findDisplay 58)};
		removeMusicEventHandler ["MusicStop",_music];
		playMusic "";
	};  
};

I tried placing it in init.sqf but has same effect...still not sure how to broadcast script to all clients.

 

 

Share this post


Link to post
Share on other sites
32 minutes ago, cklymowsky said:

HI All,

 

I'm trying to play my start-up music for every client that joins the game, but so far it only plays on the host?

 

initPlayerLocal.sqf


_handle1 = addMissionEventHandler ["PlayerConnected",{playMusic "MenuMusic"}];

...

//BI RESPAWN MENU - IDD 58 PLAY MenuMusic
if (!isDedicated) then { 
	waitUntil {!(isNull (findDisplay 58))}; 
	if (isNil "BEAK_MUSIC_INIT") then {
		BEAK_MUSIC_INIT = 1;
		playMusic "MenuMusic";
		_music = addMusicEventHandler ["MusicStop",{playMusic (_this select 0)}];
		waitUntil {isNull (findDisplay 58)};
		removeMusicEventHandler ["MusicStop",_music];
		playMusic "";
	};  
};

I tried placing it in init.sqf but has same effect...still not sure how to broadcast script to all clients.

 

 

if its in the initPlayerLocal you can remove the mission event handler and just run playMusic "MenuMusic; by itself and then add the music event handler to just replay the same file. just from looking at it it doesnt make sense why its not running on other clients, place down some hints in the script so you can see how far the script is running on clients to see if its even running all the way through or if theres an issue somewhere

Share this post


Link to post
Share on other sites
4 hours ago, gokitty1199 said:

just from looking at it it doesnt make sense why its not running on other clients

 

Thanks gokitty1199,

 

You're correct, I had to remove the addMissionEventHandler, then it worked.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×