Jump to content
 EO

On/Off addAction for Survival Radio?

Recommended Posts

I have a radio that has a CfgSFX sound attached to it via a trigger...

Is there a way to switch the radio On/Off via an addaction and still play the same sound effect?

  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, EO said:

a CfgSFX sound attached to it via a trigger...

What is that? Do you mean createSoundSource?

 

If so.. https://community.bistudio.com/wiki/createSoundSource

See Example 2.

Deleting the sound source stops the sound.

Just delete it in the "off" action. And recreate it in the "on" action.

 

  • Like 2

Share this post


Link to post
Share on other sites
21 hours ago, EO said:

radio

 

Hello EO !

 

I have this script for a custom sound played.

#Not yet published !

 

 

https://community.bistudio.com/wiki/say3D

 

description.ext

//__________________________ ***  C O P Y   T H I S  *** __________________________

class CfgSounds
{	
	sounds[] = {};
		
	//adjust the volume from db0
		
	//__________________________ GF_Simple_Radio __________________________
	
	class GF_Simple_Radio_1{name = "GF_Simple_Radio_1";sound[] = {"GF_Simple_Radio\GF_Simple_Radio_Sounds\GF_Simple_Radio_1.ogg", db6, 1.0};titles[] = {};};		
	
};

 

init.sqf

[] execVM "GF_Simple_Radio\GF_Simple_Radio.sqf";

 

GF_Simple_Radio.sqf

GF_Simple_Radio_pos_Delete = {	
GF_Simple_Radio_pos spawn {
    deleteVehicle _this;
};
};


GF_Simple_Radio_addaction = {
[_this, 
[
    "<t size=""1.2"" font=""RobotoCondensedBold"" color=""#FF9933"">" + "Radio on", 
    {
        params ["_target", "_caller", "_actionId", "_arguments"];		
		private _target = _this select 0;
		private _caller = _this select 1;
		private _actionId = _this select 2;
		
		GF_Simple_Radio_target = _target;

		GF_Simple_Radio_pos = "#particlesource" createVehicle [0,0,0];
		GF_Simple_Radio_pos attachTo [GF_Simple_Radio_target, [0,0,0]];

		GF_Simple_Radio = true;
		[]spawn {
		While {GF_Simple_Radio} do {

		[GF_Simple_Radio_pos,["GF_Simple_Radio_1",50]] remoteExec ["say3d"];
		sleep 251;

		};
		};
		
		
		[_target, _actionid] remoteExec ["removeAction"];
		
		[_target,[
    "<t size=""1.2"" font=""RobotoCondensedBold"" color=""#FF9933"">" + "Radio off", 
    {
        params ["_target", "_caller", "_actionId", "_arguments"];		
		private _target = _this select 0;
		private _caller = _this select 1;
		private _actionId = _this select 2;
			
		_target call GF_Simple_Radio_pos_Delete;
			
		GF_Simple_Radio = false;
						
		_target removeAction _actionId;
		_target spawn GF_Simple_Radio_addaction;
    },
    [],1.5,true,true,"","true",4,false,"", ""
]] remoteExec ["addAction"];
    },[], 1.5,true,true,"","true",4,false,"",""
]] remoteExec ["addAction"];
};
publicVariable "GF_Simple_Radio_addaction";



//________________	List	________________ 


GF_Simple_Radio_1 spawn GF_Simple_Radio_addaction;
GF_Simple_Radio_2 spawn GF_Simple_Radio_addaction;


_GF_Simple_Radio = "Land_FMradio_F" createVehicle getmarkerpos "MarkerName_1";
_GF_Simple_Radio spawn GF_Simple_Radio_addaction;

 

and this is also my recommendation :

Ps : i hope you like it !

  • Like 2
  • Thanks 2

Share this post


Link to post
Share on other sites

A perfect script followed by a beautiful song. (it's one of my favorites too)

Thank you very much George. 

 

 

  • Like 1
  • Thanks 1

Share this post


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

a beautiful song.

 

Thank you EO ! , i hope you like the script ,

but tell me , it was this what exacly you wanted ?

 

Share this post


Link to post
Share on other sites

It does throw an error on mission start...

bOOYb8r.jpg

...although it doesn't effect the functionality of the script, the on/off addactions are there and work well....

:f:

 

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
13 hours ago, GEORGE FLOROS GR said:

//________________    ex : name an object , and add this    ________________
/*
GF_Simple_Radio_1 spawn GF_Simple_Radio_addaction;
GF_Simple_Radio_2 spawn GF_Simple_Radio_addaction;

//________________    or createVehicle :    ________________

_GF_Simple_Radio = "Land_FMradio_F" createVehicle getmarkerpos "MarkerName_1";
_GF_Simple_Radio spawn GF_Simple_Radio_addaction;
*/


//________________    add in the end of the script , the names of the objects    ________________

 

//________________ List ________________

 

GF_Simple_Radio_1 spawn GF_Simple_Radio_addaction;

GF_Simple_Radio_2 spawn GF_Simple_Radio_addaction;

 

_GF_Simple_Radio = "Land_FMradio_F" createVehicle getmarkerpos "MarkerName_1";

_GF_Simple_Radio spawn GF_Simple_Radio_addaction;

 

It 's because of the example of my mission !

Delete the first two lines.

Spoiler

GF_Simple_Radio_1 spawn GF_Simple_Radio_addaction;

GF_Simple_Radio_2 spawn GF_Simple_Radio_addaction;

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Does this still work, I've tried setting up a radio near my camp but I don't get the Radio On action when near the object.

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

×