Jump to content
Rubzen

addAction Cooldown?

Recommended Posts

I'm making a vehicle radio script and i'd like to figure out how to stop the user from using the addAction for "MUSIC ON" more than once every 225 seconds (song length)

also another question, not as important, how would i make the addAction only interactable from within the vehicle itself?


init of vehicle
h1 addAction [ "MUSIC ON" , {  
h1 say3D [ "dangerzone", 10, 1];
} ];
h1 addAction [ "UNMUTE" , {  
1 fadeSound 1;
} ];
h1 addAction [ "MUTE" , {  
1 fadeSound 0;
} ];

Share this post


Link to post
Share on other sites

Like this? @killzone_kid

h1 addAction [ "MUSIC ON" , {  
h1 playMusic [ "dangerzone", 10, 1];
} ];
h1 addAction [ "UNMUTE" , {  
1 fadeSound 1;
} ];
h1 addAction [ "MUTE" , {  
1 fadeSound 0;
} ];

Share this post


Link to post
Share on other sites

Can't find the thread anymore but something similar has already been requested.

This will play a predefined song with an object as sound source, wait until it's done and add the action again, should work fine in MP:

 

//radio repeatable action
//init.sqf
TAG_fnc_radioSong = {

	params ["_object","_caller","_ID"];
	_object removeAction _ID;
	[_object,"ivean_polkka"] remoteExec ["say3d",0];
	sleep 144;
	_object AddAction ["Play Polka again", {_this spawn TAG_fnc_radioSong}];
	[_object,["Play Polka again", {_this spawn TAG_fnc_radioSong}]] remoteExec ["addAction",0];

};

//radio init field
[this,["Play Polka", {_this spawn TAG_fnc_radioSong}]] remoteExec ["addAction",0];

If you want a vehicle/object to be the sound source, then the snippet above should do the trick.

 

Cheers

  • Thanks 1

Share this post


Link to post
Share on other sites

No. fadeMusic controls music volume. If all you want is to play music inside a car, then playMusic should do. It also has a command to tell how much of the track has been played https://community.bistudio.com/wiki/getMusicPlayedTime and you could stop and start music from any time point. None of the other commands provide such flexibility.

Share this post


Link to post
Share on other sites

Problem is, i'm by no means any good at scripting, i can understand most scripts but i cannot make them from the ground up. all the scripts i have for my current scenario is made by the community that i have configured for my own needs. 
All-in-all i have no idea where to start with playMusic. 

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

×