Jump to content

Recommended Posts

 

Hello everyone, I added a sound script in the task file, there are several audio files, I only know that "call BIS_fnc_selectRandom;" can be played at random, but I hope to play it in order in the game, I do not know the specific command What is it? I searched Google for a lot of web pages but didn't get what I wanted. I hope everyone can give me help. Thank you!

  • Like 1

Share this post


Link to post
Share on other sites
7 hours ago, SakamaKiRyo said:

 

Hello everyone, I added a sound script in the task file, there are several audio files, I only know that "call BIS_fnc_selectRandom;" can be played at random, but I hope to play it in order in the game, I do not know the specific command What is it? I searched Google for a lot of web pages but didn't get what I wanted. I hope everyone can give me help. Thank you!

This should get you started,

best run this in initServer.sqf so every player gets the same song, should work in MP:

 

//initServer.sqf

//init song array
GOM_songs = ["Song1","Song2","Song3"];
publicVariable "GOM_songs";

//define function once
GOM_fnc_getNextElement = {
	params ["_array"];
	_element = _array # (_array pushback (_array deleteAt 0));	
	publicVariable "_array";
	_element
};

//pick the first song, then put it in the back, so the second song will be next
_currentSong = [GOM_songs] call GOM_fnc_getNextElement;
systemchat format ["Current: %1",_currentSong];
systemchat format ["Next: %1",GOM_songs#0];

Edit: forgot that deleteAt returns the deleted element, adjusted it

 

Cheers

  • Like 1
  • Thanks 1

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

×