Forum Jump :

Author Message


Posts: 1
Rank:


Level: Member

Country: de
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2018-01-16 07:54        
     
Hi,
I want to rework this old opendayz Script for random Airraids which I found online.
The bombing is working without problems, but only the triggered person gets the sirens.
Because this script is kinda old I tried to change the way the sound is executed without success.
Mods I use: DesolationRedux

initplayerlocal.sqf
onPreloadFinished {
	disableUserInput true;
	player setVariable["isReady",true,true];
	BASE_var_LastData = diag_tickTime;
	[] spawn BASE_fnc_TimeoutCheck;
	onPreloadFinished {};
	if(hasInterface || isServer) then {
		[] execVM "scripts\script1.sqf";
		[] execVM "scripts\script2.sqf";
		};
	 [b][] execVM "scripts\airraid.sqf[/b]";
};

airraid.sqf
////////////////////////////////////////////////////////////////////////////////////////
//      DayZ Air Raid written by                                                    //
//              mmmyum    with    work    from                                      //
// sirens: http://www.armaholic.com/page.php?id=12598 by DarkXess                    //
// bombs: http://www.armaholic.com/page.php?id=15612 by Maxjoiner                    //
////////////////////////////////////////////////////////////////////////////////////////
 
/////////////////////////SETUP repeat and break
 
private ["_espl","_sound","_pos2","_pos2cnt","_seconds","_rndLoc","_place","_position","_choice","_duration","_xpos","_ypos","_targetpos","_loc","_target","_pos","_siren","_pos1","_choise","_ray","_dblsecs","_repeat","_break"];
sleep 600;
_repeat = 3;                            //times to repeat
_break = 4200;                            //time to break between attacks
_position = [13135.9, 10393.3, 1.5]; //leave this
_xpos = 13135.9;
_ypos = 10393.3;
//repeat script
diag_log format ["AIRRAID: Starting..."];
sleep 2;
While {_repeat > 1} do {
/////////////////////////SETUP position
//                                      enter positions below. format x,y,z
    _rndLoc=floor(random 2);
    _place=
    switch (_rndLoc) do
    {
      case 0: {"Electro"};
      case 1: {"Electro2"};
      
    };
    diag_log format ["AIRRAID: Random Location: %1 | %2",_rndLoc,_place];
    _position=
    switch (_rndLoc) do
    {
      case 0: {[6332.75,2971.85,0]}; //Cherno chhec 
	case 1: {[6798.3,2764.75,1,5]}; //Cherno chhec 
	
    };
//////////////////////////SETUP type of bombing and duration
_choice = 1;
_duration = 25;
/////////////////////////
_xpos = _position select 0;
_ypos = _position select 1;
_targetpos = [_xpos, _ypos, 1.5];
_loc = createVehicle ["HeliHEmpty", _targetpos,[], 0, "NONE"];
_target = createVehicle ["HeliHEmpty",position _loc,[], 0, "NONE"];  // target bombing
sleep 2;
diag_log format ["AIRRAID: INCOMING ATTACK: Sounding Siren at: %1 %2 | Repeat: %3| Type: %4 | Duration: %5",_xpos,_ypos,_repeat,_choice,_duration];
 
 
//sound siren
_pos = position _target;
diag_log ("AIRRAID: POS: %1 | TARGET: %2 | SHOULD MATCH",_pos,_targetpos);
_siren = createVehicle ["HeliHEmpty",position _target,[], 0, "NONE"];
["eve", 1000, siren]remoteExec ["play_sound", 0, false];
sleep 15;
_pos1 = position _siren;
diag_log format ["AIRRAID: SIREN: %1 | TARGET: %2 | SHOULD MATCH APPROX",_pos1,_targetpos];
["puk", 1000, siren]remoteExec ["play_sound", 0, false];
sleep 15;
["eve", 1000, siren]remoteExec ["play_sound", 0, false];
sleep 15;
["nam", 1000, siren]remoteExec ["play_sound", 0, false]; 
sleep 10;
["puk", 1000, siren]remoteExec ["play_sound", 0, false];
sleep 15;
["nam", 1000, siren]remoteExec ["play_sound", 0, false]; 
sleep 5;
 
//start bombing init
_choise = _choice;    // choise bombing: 1 = light 2 = medium 3 = heavy
_ray = 100;          // ray of bombing
_seconds = _duration; // time bombing
_dblsecs = _seconds * 2;
diag_log format ["AIRRAID: Bombing Area: %1 %2",_xpos,_ypos];
 
//start bombing
_pos2 = [getPosATL _siren];
While {_seconds > 1} do {
_sound = createVehicle ["HeliHEmpty",position _target,[], _ray, "NONE"];
["mortar1", 500, sound]remoteExec ["play_sound", 0, false];
_pos2 set [_seconds, getPosATL _sound];
sleep 2;
If (_choise == 1) then {
_espl = createVehicle ["Bo_GBU12_LGB_MI10",position _sound,[], 0, "NONE"];
};
If (_choise == 2) then {
_espl = createVehicle ["Bo_GBU12_LGB_MI10",position _sound,[], 0, "NONE"];
};
If (_choise == 3) then {
_espl = createVehicle ["Bo_GBU12_LGB_MI10",position _sound,[], 0, "NONE"];
};
_pos2 = [_dblsecs,getPosATL _espl];
_pos2cnt = count _pos2;
diag_log format ["AIRRAID: BOMB: %1 | TARGET: %2 | SHOULD MATCH APPROX ||| debug arraycount %3 |",str(_pos2),_targetpos,_pos2cnt];
_seconds = _seconds - 1;
deletevehicle _sound;
};
 
//cleanup
sleep 60;
_repeat = _repeat - 1;
deletevehicle _espl;
deletevehicle _siren;
deletevehicle _loc;
deletevehicle _target;
diag_log format ["AIRRAID: Going down for sleep: Repeat:%1 | Sleep:%2",_repeat,_break];
sleep _break;                     
};
exit

description.ext
class CfgSounds 
{ 

	sounds[] = {nam,eve,puk};
	
	class nam{
		name = "Siren1";
		sound[] = {sound\SirenLoopMono.ogg, db+12, 1.0};
		titles[] = {""};
	};
	class eve{
		name = "Siren2";
		sound[] = {sound\Sirens.ogg, db+12, 1.0};
		titles[] = {""};
	};
	class puk{
		name = "Siren3";
		sound[] = {sound\Sirens2.ogg, db+12, 1.0};
		titles[] = {""};
	};
	
};

Thank you for reading this! =)


Author Message


Posts: 135
Rank:


Level: Member

Country: us
Location: Pennsylvania
Occupation:
Age:
In-game name: Xian

 
#2 Posted at 2018-01-16 15:17        
     
For your sound commands, try using say3d
[_siren,["puk",1000,1]] remoteExec ["say3D",0];


Also, lines 55 you have the local "_siren" but lines 60 through 68 are looking for the public "siren", that on purpose or typo?