Stuff and Junk
Well-Known Member
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.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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.
for some reason it's playing all the sounds twice
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
if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cursorTarget < _allowedDistance) and _canDo) then { //Has some kind of target
// 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;
};
player removeAction toggleRadioOff;
toggleRadioOff = -1;
player removeAction toggleRadioOn;
toggleRadioOn = -1;
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;
};
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;
};
//msgChance,sleepTimer,DayZ 1.8 users set to true
[0.15, 600, false] execVM "scripts\radioChatter.sqf";
_vanillaMsg = ["radio_static","radio_transmission_russian","radio_transmission_wombat"];
_vanillaMsg = ["radio_static","radio_transmission_russian","radio_transmission_wombat"] call BIS_fnc_selectRandom;
// 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;
};
// 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;
};
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";
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"
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. 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
if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cursorTarget < _allowedDistance) and _canDo) then { //Has some kind of target
// 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 fromok 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; };