[Atmosphere] Radio Chatter Help

I also have an on/off switch i created to allow players to turn off the messages if they want. Pretty basic but i can post it if anyone wants.
 
I also have an on/off switch i created to allow players to turn off the messages if they want. Pretty basic but i can post it if anyone wants.

YEAH!!! It work now!!! Ty so much bro for help =)

if u may, can u past there how i make u'r script off\on radio?
 
in the radiochatter.sqf the line that says while (counter is < 2) then {
change that number to 1 and it will only play once. Ill post the code for the switch soon. Also i have my frequency set to 0.15 and i only hear about 1 message per restart on a 3 hour cycle. Not sure if the 0.05 is too little for everyone else.
 
ok so here we go, i have yet to test this but im almost certain it will be fine. I even put all the bracktes and semi colons lol. Anyway this update will use a on/off switch to allow players to avoid messages if they want. It only plays to each client anyway but some ppl like the option. Also i have updated the radioChatter.sqf to allow for regualr dayz 1.8 users to use the included sound with the vanilla mod. No sounds are need to be downloaded or defined. That means you can skip the description.ext steps if u use only the dayz 1.8. All other mods will need that step. Ok here we go:

new radioChatter.sqf:
Code:
waitUntil {!isNil ("dayz_animalCheck")};
sleep 10;
 
While {alive player} do {
 
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Init Variables
_msgChance =        _this select 0;
_sleepTimer =        _this select 1;
vanillaDayz =        _this select 2;
 
 
_itemsPlayer =        items player;
_hasRadio =        "ItemRadio" in _itemsPlayer;
_radioOff =        player getVariable ["radioOn",false];
_vanillaMsg =        ["radio_static","radio_transmission_russian","radio_transmission_wombat"];
_crueMsg =            ["radio1","radio2","radio3","radio4","radio5"] call BIS_fnc_selectRandom;
 
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
//Make sure player has a radio
if (_hasRadio) then {
 
    //Make sure the radio is turned on
    if (!_radioOff) then {
   
        //Chance Variables
        _spawnRoll = random 1;
       
        //Roll chance to see if message will be played
        if (_spawnRoll <= _msgChance) then {
       
            //Message is going to be played. Notify the player. Comment out to disable notification.
            cutText ["Your radio is picking up a transmission.","PLAIN DOWN"];
            sleep 3;
           
            //message counter
            _msgCounter = 0;
           
            //Change < Num to make sound play more than once. Also adjust sleep time after each message played if you play more than once.
            While {_msgCounter < 1} do {
               
                //Play message for default
                if (vanillaDayz) then {
                    //Play message to player only
                    playSound _vanillaMsg;
                    sleep 60;
                } else {
                    //Play message to player only
                    playSound _crueMsg;
                    sleep 60;
                };
            //Plus one to counter after each loop.
            _msgCounter = _msgCounter + 1;
            };
        };
    };
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
//Sleep timer. Set in init.sqf
sleep _sleepTimer;
};
};//end loop and restart

this is the switch action for an already overwritten fn_selfActions.sqf file. Anywhere BEFORE this line:
Code:
if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cursorTarget < _allowedDistance) and _canDo) then {    //Has some kind of target

add this block of code:
Code:
// Toggle radio
    _radioOff = player getVariable ["radioOn",false];
    if ("ItemRadio" in _tools) then {hasRadio = true;} else {hasRadio = false;};
    if (hasRadio and !_radioOff) then {
        if (toggleRadioOff < 0) then {
            toggleRadioOff = player addAction [("<t color=""#ffff00"">" + ("Radio On") +"</t>"),"scripts\radioOff.sqf",player,5,false,true,"",""];
            };
        } else {
            player removeAction toggleRadioOff;
            toggleRadioOff = -1;
    };
    if (hasRadio and _radioOff) then {
        if (toggleRadioOn < 0) then {
            toggleRadioOn = player addAction [("<t color=""#ffff00"">" + ("Radio Off") +"</t>"),"scripts\radioOn.sqf",player,5,false,true,"",""];
            };
        } else {
            player removeAction toggleRadioOn;
            toggleRadioOn = -1;
    };

at the bottom of fn_selfActions.sqf add this under the existing ones:
Code:
player removeAction toggleRadioOff;
    toggleRadioOff = -1;
    player removeAction toggleRadioOn;
    toggleRadioOn = -1;

Now these are the files that set the radio variables for the switch and messages. Place these in a folder named scripts in the mission root. First is radioOn.sqf:
Code:
turnedOn = true;
sleep 1;
_player = player;
 
if (turnedOn) then {
    _player setVariable ["radioOn",true];
 
    player removeWeapon "ItemRadio";
    sleep 2;
    player addWeapon "ItemRadio";
   
    titleText ["(You will receieve broadcasts when radio is on)","PLAIN DOWN"]; titleFadeOut 7;
};

Then next is the radioOff.sqf:
Code:
turnedOff = true;
sleep 1;
 
if (turnedOff) then {
    player setVariable ["radioOn",false];
 
    player removeWeapon "ItemRadio";
    sleep 2;
    player addWeapon "ItemRadio";
 
    titleText ["(You will not receieve broadcasts when radio is off)","PLAIN DOWN"]; titleFadeOut 7;
};

And finally the new init.sqf line:
Code:
//msgChance,sleepTimer,DayZ 1.8 users set to true
    [0.15, 600, false] execVM "scripts\radioChatter.sqf";

Ok that should be it, i always seem to forget something tho lol so if u have any issues just say so and ill fix em. No school for a week so :p
 
ok i already forgot something lol make the line
Code:
_vanillaMsg =        ["radio_static","radio_transmission_russian","radio_transmission_wombat"];
look like this
Code:
_vanillaMsg =        ["radio_static","radio_transmission_russian","radio_transmission_wombat"] call BIS_fnc_selectRandom;
 
also i tested the radio switch and this in your self actions file:
Code:
// Toggle radio
    _radioOff = player getVariable ["radioOn",false];
    if ("ItemRadio" in _tools) then {hasRadio = true;} else {hasRadio = false;};
    if (hasRadio and !_radioOff) then {
        if (toggleRadioOff < 0) then {
            toggleRadioOff = player addAction [("<t color=""#ffff00"">" + ("Radio On") +"</t>"),"scripts\radioOff.sqf",player,5,false,true,"",""];
            };
        } else {
            player removeAction toggleRadioOff;
            toggleRadioOff = -1;
    };
    if (hasRadio and _radioOff) then {
        if (toggleRadioOn < 0) then {
            toggleRadioOn = player addAction [("<t color=""#ffff00"">" + ("Radio Off") +"</t>"),"scripts\radioOn.sqf",player,5,false,true,"",""];
            };
        } else {
            player removeAction toggleRadioOn;
            toggleRadioOn = -1;
    };

change to this:
Code:
// Toggle radio
    _radioOff = player getVariable ["radioOn",false];
    if ("ItemRadio" in _tools) then {hasRadio = true;} else {hasRadio = false;};
    if (hasRadio and !_radioOff) then {
        if (toggleRadioOff < 0) then {
            toggleRadioOff = player addAction [("<t color=""#ffff00"">" + ("Radio On") +"</t>"),"scripts\radioOn.sqf",player,5,false,true,"",""];
            };
        } else {
            player removeAction toggleRadioOff;
            toggleRadioOff = -1;
    };
    if (hasRadio and _radioOff) then {
        if (toggleRadioOn < 0) then {
            toggleRadioOn = player addAction [("<t color=""#ffff00"">" + ("Radio Off") +"</t>"),"scripts\radioOff.sqf",player,5,false,true,"",""];
            };
        } else {
            player removeAction toggleRadioOn;
            toggleRadioOn = -1;
    };
 
ok so i have found some issues with the switch so far and im about to post a switch that actually works :p Let me know if ur new radio chatter is working though.
 
Ok. I need some help. I installed the Radio Chatter and set the
//[broadcast chance, sleep timer]
[1.00, 60] execVM "scripts\radioChatter.sqf";
to make the radio go off every minute and play 100% of the time but nothing plays. I'll post the relevant parts of my init and description

Pasted from my init
if (!isDedicated) then {
//Conduct map operations
0 fadeSound 0;
waitUntil {!isNil "dayz_loadScreenMsg"};
dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");

//Run the player monitor
_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
_playerMonitor = [] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
_void = [] execVM "R3F_Realism\R3F_Realism_Init.sqf";
////////////////////////////////ADD THIS ADD THIS ADD THIS///////////////////////////
//[broadcast chance, sleep timer]
[1.00, 60] execVM "scripts\radioChatter.sqf";
////////////////////////////////ADD THIS ADD THIS ADD THIS///////////////////////////
//Lights
//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};
if (dayz_REsec == 1) then {
#include "\z\addons\dayz_code\system\REsec.sqf"
};

[] execVM "addons\R3F_ARTY_AND_LOG\init.sqf";
[] ExecVM "map_updates\Sector_UBF.sqf";
//[] execVM "map_updates\sectorfng.sqf"; //execs Sector FNG
[] ExecVM "map_updates\villages.sqf"; // Epoch Trader Villages 1.2
[] ExecVM "map_updates\buildings.sqf"; // Extra Charnarus Buildings 1.2
[] ExecVM "map_updates\bois1_Dan_BBC.sqf"; // Hidden Killers Ranch
[] ExecVM "map_updates\castle.sqf"; // The Dead Castle
[] ExecVM "map_updates\devilscastle.sqf"; // Devils Castle Base
[] ExecVM "map_updates\bridge.sqm"; // Bridge
[] ExecVM "map_updates\skacast.sqf"; // Skalisty Castel
[] ExecVM "Debug\debug.sqf";

description.ext
idc = 104;
type = 8; // CT_PROGRESS
style = 0; // ST_SINGLE
texture = "\ca\ui\data\loadscreen_progressbar_ca.paa";
};
class CA_Progress2 : RscProgressNotFreeze // progress bar that will go reverse
{
idc = 103;
};
class Name2: RscText // the text on the top-left
{
idc = 101;
x = 0.05;
y = 0.029412;
w = 0.9;
h = 0.04902;
text = "";
sizeEx = 0.05;
colorText[] = {0.543,0.5742,0.4102,1.0};
};
};
};

class CfgSounds
{
sounds[] ={radio1,radio2,radio3,radio4,radio5};

class radio1
{
name="radio1";
sound[]={sounds\radio1.ogg, 0.3, 1};
titles[] = {};
};
class radio2
{
name="radio2";
sound[]={sounds\radio2.ogg, 0.3, 1};
titles[] = {};
};
class radio3
{
name="radio3";
sound[]={sounds\radio3.ogg, 0.3, 1};
titles[] = {};
};
class radio4
{
name="radio4";
sound[]={sounds\radio4.ogg, 0.3, 1};
titles[] = {};
};
class radio5
{
name="radio5";
sound[]={sounds\radio5.ogg, 0.3, 1};
titles[] = {};
};
};

#include "addons\R3F_ARTY_AND_LOG\desc_rsct_include.h"
 
Ok. I need some help. I installed the Radio Chatter and set the
//[broadcast chance, sleep timer]
[1.00, 60] execVM "scripts\radioChatter.sqf";
to make the radio go off every minute and play 100% of the time but nothing plays. I'll post the relevant parts of my init and description

Pasted from my init


description.ext
In ur description.ext you need to put ur class cfgsounds much further up in the file. If you look back i think i posted a description example that shows where to paste it. Also in the radiioChatter.sqf file add }; to the very end if u havent already. Also use 1 instead of 1.00 not sure if that matters but just to be safe.
 
ok this switch is tested and working, remember this goes in your self actions file above the line that says
Code:
if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cursorTarget < _allowedDistance) and _canDo) then {    //Has some kind of target

Paste this:
Code:
// Toggle radio
    _radioOn = player getVariable ["radioOn",true];
    if ("ItemRadio" in _tools) then {hasRadio = true;} else {hasRadio = false;};
    if (hasRadio and !_radioOn) then {
        if (toggleRadioOff < 0) then {
            toggleRadioOff = player addAction [("<t color=""#ffff00"">" + ("Radio Off") +"</t>"),"scripts\radioOn.sqf",player,5,false,true,"",""];
            };
        } else {
            player removeAction toggleRadioOff;
            toggleRadioOff = -1;
    };
    if (hasRadio and _radioOn) then {
        if (toggleRadioOn < 0) then {
            toggleRadioOn = player addAction [("<t color=""#ffff00"">" + ("Radio On") +"</t>"),"scripts\radioOff.sqf",player,5,false,true,"",""];
            };
        } else {
            player removeAction toggleRadioOn;
            toggleRadioOn = -1;
    };
 
ok this switch is tested and working, remember this goes in your self actions file above the line that says
Code:
if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cursorTarget < _allowedDistance) and _canDo) then {    //Has some kind of target

Paste this:
Code:
// Toggle radio
    _radioOn = player getVariable ["radioOn",true];
    if ("ItemRadio" in _tools) then {hasRadio = true;} else {hasRadio = false;};
    if (hasRadio and !_radioOn) then {
        if (toggleRadioOff < 0) then {
            toggleRadioOff = player addAction [("<t color=""#ffff00"">" + ("Radio Off") +"</t>"),"scripts\radioOn.sqf",player,5,false,true,"",""];
            };
        } else {
            player removeAction toggleRadioOff;
            toggleRadioOff = -1;
    };
    if (hasRadio and _radioOn) then {
        if (toggleRadioOn < 0) then {
            toggleRadioOn = player addAction [("<t color=""#ffff00"">" + ("Radio On") +"</t>"),"scripts\radioOff.sqf",player,5,false,true,"",""];
            };
        } else {
            player removeAction toggleRadioOn;
            toggleRadioOn = -1;
    };
also you need to change the variables inside radioChatter from
_radioOff = player getVariable ["radioOn",false];
to
_radioOn = player getVariable ["radioOn",true];

and
if (_hasRadio) then {

//Make sure the radio is turned on
if (!_radioOff) then {
to
if (_hasRadio) then {

//Make sure the radio is turned on
if (_radioOn ) then {
 
I've implemented this and it works like a charm.

Removed the warning about getting a radio transmission, and set it to play with a 23% chance, and boy I tell you, people get freaked when they hear:


Or


and really freaked when they hear the running footstep sound :p
 
Back
Top