Jump to content
  • 0

drop_bombs.sqf


Havoc302

Question

I noticed a sample event in the dayz_server.pbo that's not used, it's a random bombing from an aircraft but all it has is the bomb itself, no warning message, no aircraft to look out for, nothing, so I thought I'd flesh it out a little, at least once the warning message comes up people will have a few seconds to listen for the jet and get the hell away.

 

Could I get someone who's more familiar with scripting than me to take a look over it, I haven't tried running it yet, I'd just like another set of eyes.

 

Original:

 

 

// Sample Drop Bomb
private ["_position"];
_position = [MarkerPosition,0,DynamicVehicleArea,10,0,2000,0] call BIS_fnc_findSafePos;
bomb = createVehicle ["Bo_GBU12_LGB", [(_position select 0),(_position select 1), 1000], [], 0, "CAN_COLLIDE"];

 

 

My modified one:

 

 

// Sample Drop Bomb
private ["_position","_hint","_veh"];
 
if (isNil "EPOCH_EVENT_RUNNING") then {
EPOCH_EVENT_RUNNING = false;
};
 
// Check for another event running
if (EPOCH_EVENT_RUNNING) exitWith {
diag_log("Event already running");
};
 
// Send message to users
[nil,nil,rTitleText,"A survivor has spotted a UN Bombing Strike coming in, listen for it and take cover!", "PLAIN",10] call RE;
 
sleep 30;
 
_position = [MarkerPosition,0,DynamicVehicleArea,10,0,2000,0] call BIS_fnc_findSafePos;
_veh = createVehicle ["F35B", [(_position select 0),(_position select 1) - 500, 500], [], 0, "FLY"];
_crew = createVehicleCrew _veh;
 
sleep 10;
 
bomb = createVehicle ["Bo_GBU12_LGB", [(_position select 0),(_position select 1), 500], [], 0, "CAN_COLLIDE"];
 
// Clean up
deleteVehicle _veh;
deleteVehicleCrew driver _veh;
EPOCH_EVENT_RUNNING = false;

 

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Don't use the modified one yet, found a bug I'm trying to fix.

 

Once I've fixed it there should be a random jet that flies over head if you happen to be in the area which should scare the crap out of some people. It'll certainly make people stop and look up.

Link to comment
Share on other sites

  • 0

I've installed this onto my server and set it to run every 30 minutes. Once the event is ran, this error shows up in the RPT log and the planes don't fly over. I was wondering if you'd be able to fix it?

Error in expression <], 0, "FLY"];
_crew = createVehicleCrew _veh;

sleep 10;

bomb = createVehicle [>
20:30:05   Error position: <_veh;

sleep 10;

bomb = createVehicle [>
Error Missing ;
Link to comment
Share on other sites

  • 0

Hi,

 

I played around with this to create a random bombing script. The below code has a position array BombLocations, currently set for Taviana. You'll have to edit this array for your map if it is not Taviana.

/*
Modified epoch event to a random city bombing script. All credit Epoch Devs. filename: RandomCityBombing.sqf
*/	
private["_place","_name","_coords","_sendwarning","_warning"];
	
sleep 60;
diag_log format["[RANDOM BOMBING]: Running."];

BombLocations = [
["Solibor","NameCity",[13999.6,12240.2,0]],
["ChrveniGradok","NameCity",[12713.8,14482.6,0]],
["Molotovsk","NameCity",[16957.7,12694.3,0]],
["Martin","NameCity",[16136.3,13632.5,0]],
["Lyepestok","NameCity",[11608.1,15476.1,0]],
["Lyubol'","NameCity",[10405.1,16832,0]],
["Sevastopol'","NameCity",[15464.8,16269.3,0]],
["Sabina","NameCity",[15022.2,9693.54,0]],
["Byelov","NameCity",[17319.5,7487.96,0]],
["Yaroslav","NameCity",[10164,19080.4,0]],
["Ekaterinburg","NameCity",[11020.4,18790.6,0]],
["Etanovsk","NameCity",[12664.7,11921,0]],
["Kryvoe","NameCity",[9114.96,5402.52,0]],
["Komarovo","NameCity",[10591.6,6565.65,0]],
["Krasnoznamen'sk","NameCity",[9176.12,8060.1,0]],
["NoviDvor","NameCity",[7925.88,6725.89,0]],
["Vedich","NameCity",[6705.53,9868.36,0]],
["Chernovar","NameCity",[5827.36,9879.22,0]],
["BilgradNaMoru","NameCity",[5452.96,8827.01,0]],
["Shtangrad","NameCity",[3323.68,7552.9,0]],
["Mitrovice","NameCity",[3795.29,7222.12,0]],
["Kryvozhopol","NameCity",[3885.24,17724,0]],
["Topolka","NameCity",[8881.93,2308.74,0]],
["Seven","NameCity",[10985.4,759.202,0]],
["Blato","NameCity",[11787.8,747.01,0]],
["Alexander","NameCityCapital",[4973.97,17701.7,0]],
["Grushnoye","NameCityCapital",[5451.26,14741.8,0]],
["Romanov","NameCityCapital",[11626.9,9063.69,0]],
["Apshironsk","NameCityCapital",[9179.1,14136.6,0]],
["Branibor","NameCityCapital",[7682.46,4312.29,0]],
["Vladimir","NameCityCapital",[1942.44,17177,0]]
];

DropBombs = {

private ["_bombminrange","_bombmaxrange","_msgbomb1","_targetPos","_bombselect","_bombarray","_bombtype","_bombcount","_newpos"];

_targetPos = _this select 0;
_msgbomb1 = _this select 1;

_bombminrange = floor (random 50) + 50;
_bombmaxrange = floor (random 300) + 100;

_bombselect = [];
_bombarray = [["Bo_GBU12_LGB",[1,2,3,4,5]],["Bo_GBU12_LGB",[1,2,3,4,5,6,7]],["Bo_GBU12_LGB",[1,2,3,4,5,6,7,8,9,10]]];
_bombselect = _bombarray select (floor (random (count _bombarray)));
_bombtype = _bombselect select 0;
_bombcount = _bombselect select 1;
[nil,nil,rTitleText,_msgbomb1,"PLAIN",10] call RE;
sleep 15;
{
	_newpos = [_targetPos, _bombminrange, _bombmaxrange, 0, 0, 0, 0] call BIS_fnc_findSafePos;
	bomb = createVehicle [_bombtype, [(_newpos select 0),(_newpos select 1), 100], [], 0, "CAN_COLLIDE"];
	uisleep 2;
} forEach _bombcount;
//sleep 30;
};

while {true} do {	
_place = BombLocations select (floor (random (count BombLocations)));
_name = _place select 0;
_coords = _place select 2;
_warning = "Bomb Strike on "+_name+". ETA 2 Minutes!";
_sendwarning = "Bomb Strike on "+_name+". Take Cover!";
[nil,nil,rTitleText,_warning, "PLAIN",10] call RE;
sleep 120;
0=[_coords,_sendwarning] call DropBombs;
diag_log format["[RANDOM BOMBING]:RANDOM BOMBING at %1.",_name];
sleep 150;
sleep 1; //set this for timer?
};

Default, it cycles every 5 minutes or so.

 

I just added this line:

[] spawn RandomCityBombing;

to the bottom of my init.sqf of my mission system, and this line:

RandomCityBombing = compile preprocessFileLineNumbers "\z\addons\dayz_server\<mission folder>\RandomCityBombing.sqf";

to the mission functions.sqf.

 

Now, I am a baby when it comes to Arma scripting (it's beginning to feel like my teeth are coming through) only been at it seriously for several months, lol. It's taking ages to figure even a little bit of it out, but this seems to work. If there are any glaring 'egg on face' lines then feel free to berate etc, but please set me straight afterwards ;)

 

https://www.youtube.com/watch?v=MKEUujz12S4

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...