/*---------------------Config--------------------------*/
_eventchance = 10;
_eventrandomnumber = 100;
// if random number between 0 and _eventrandomnumber is less then _eventchance. Start event
/*----------------------Loot---------------------------*/
// all weapons in list put into loot crate; 1 of each.
DZES_Weapons = ["M4A1_AIM_SD_camo","M24","MP5A5","M40A3","MakarovSD","M4A1_HWS_GL_SD_Camo","G36K","AK_74_GL","AK_107_pso","M4A3_RCO_GL_EP1","AK_107_kobra","AK_107_GL_kobra","RPK_74"];
// all magazines in list put into loot crate; 10 of each
DZES_Magazines = ["30Rnd_556x45_StanagSD","30Rnd_556x45_Stanag","30Rnd_556x45_G36","30Rnd_545x39_AK","75Rnd_545x39_RPK","5Rnd_762x51_M24","5Rnd_762x51_M24","30Rnd_9x19_MP5","1Rnd_HE_GP25"];
// all food and drink in list put into loot crate; 5 of each
DZES_FoodnDrink = ["FoodCanPasta","FoodCanBadguy","FoodCanBoneboy","FoodCanCorn","FoodCanCurgon","FoodCanDemon","FoodCanFraggleos","FoodCanBeef","ItemWaterbottleUnfilled","ItemWaterbottle","ItemWaterbottleDmg","ItemSodaLirik","ItemSodaPeppsy"];
// all medical supplies in list put into loot crate; 5 of each
DZES_Medical = ["ItemBandage","ItemPainkiller","ItemMorphine","ItemEpinephrine","ItemAntibacterialWipe","ItemAntibiotic","emptyBloodBag","bloodBagOPOS","equip_gauze","bloodTester","transfusionKit"];
// For DZES_Weapons,DZES_Magazines,DZES_FoodnDrink and DZES_Medical. If you double up items in the array it will double the ammount of given item when adding it to box.
// random vehicle will parachute in; writes to the hive so the player can keep the vehicle forever.
DZES_Vehicles = ["MH6J_DZ","UH1H_DZ","HMMWV_DZ","UralCivil"];
// For DZES_Vehicles, duplicate vehicles in the list will increase the chance of that vehicle being chosen.
/*-----------------Object Customization------------------*/
// smoke shell type (random or name of smoke)
DZES_SmokeType = "random"; //DZES_SmokeType = "SmokeShellRed";
// add different smoke colors for random array.
DZES_SmokeColors = ["SmokeShellRed","SmokeShellYellow","SmokeShellGreen","SmokeShellPurple","SmokeShellBlue","SmokeShellOrange"];
//parachut type
DZES_ParaType = "ParachuteMediumEast";
/*-------------------------------------------------------*/
/*Don't change below here unless u know what u are doing */
/*-------------------------------------------------------*/
//get location passed from sensor
_location = _this select 0;
//variable defines (if you use more sensors add more variables)
if (isnil "eventcherno") then {
eventcherno = false;
};
if (isnil "eventelektro") then {
eventelektro = false;
};
if (isnil "eventberezino") then {
eventberezino = false;
};
//event completed check, exits if the event has been done. (if you use more sensors add more)
if ((_location == "Berezino") && eventberezino) exitwith {diag_log 'DZES: event already completed';};
if ((_location == "Cherno") && eventelektro) exitwith {diag_log 'DZES: event already completed';};
if ((_location == "Elektro") && eventcherno) exitwith {diag_log 'DZES: event already completed';};
//create percentage properties for event start or skip.
_eventrng = round (random _eventrandomnumber);
if (_eventrng > _eventchance) exitwith {diag_log 'DZES: Event chance failed';};
//smoke color
if (DZES_SmokeType == "random") then {
DZES_Smoke = DZES_SmokeColors call BIS_fnc_selectRandom;
} else {
DZES_Smoke = DZES_SmokeType;
};
// WIP Random Loot 40|40|20 food|medical|military
_loottype = ["Medical","Food","Medical","Food","Military","Vehicle","Vehicle"] call BIS_fnc_selectRandom;
//get position for event
_position = getPos player;
_nearbyposition = [_position, 100, 400, 20, 0, 0, 0] call BIS_fnc_findSafePos; //event within 100-1000m of activating player
_eventposition = [(_nearbyposition select 0), (_nearbyposition select 1), 100];
//Vehicle check for alternate setup
if (_loottype == "Vehicle") then {
_randomvehicle = DZES_Vehicles call BIS_fnc_selectRandom;
//double check that vehicle is in DayZ_SafeObjects so that it can be written to the hive.
if (!(_randomvehicle in DayZ_SafeObjects)) then {
DayZ_SafeObjects = DayZ_SafeObjects + [_randomvehicle];
publicVariable "DayZ_SafeObjects";
};
eventcrate = createVehicle [_randomvehicle, _eventposition, [], 0, "CAN_COLLIDE"];
//additional setup to write vehicle to hive and make it not blow up
_dir = getdir eventcrate;
PVDZ_obj_Publish = [0,eventcrate,[_dir,_eventposition],[]];
publicVariableServer "PVDZ_obj_Publish";
} else {
// box for other loot types
eventcrate = "AmmoBoxBig" createVehicle _eventposition;
};
//event setup
_eventpara = createVehicle [DZES_ParaType, _eventposition, [], 0, "FLY"];
_eventsmoke = createVehicle [DZES_Smoke, _eventposition, [], 0, "FLY"];
//clear event crate
clearWeaponCargoGlobal eventcrate;
clearMagazineCargoGlobal eventcrate;
//attach smoke to crate
_eventsmoke attachto [eventcrate, [0,0,0]];
/*-------------------
Crate Setup
-------------------*/
//Military
if (_loottype == "Military") then {
{eventcrate addWeaponCargoGlobal [_x,1]} foreach DZES_Weapons;
{eventcrate addMagazineCargoGlobal [_x,10]} foreach DZES_Magazines;
};
//Food
if (_loottype == "Food") then {
{eventcrate addMagazineCargoGlobal [_x,5]} foreach DZES_FoodnDrink;
};
//Medical
if (_loottype == "Medical") then {
{eventcrate addMagazineCargoGlobal [_x,5]} foreach DZES_Medical;
};
//attach crate to chute
if (_loottype == "Vehicle") then {
eventcrate attachTo [_eventpara, [0,0,-1.6]];
} else {
eventcrate attachTo [_eventpara, [0,0,.3]];
};
// detach object before ground
[_eventpara,eventcrate,_eventsmoke] spawn {
_para = _this select 0;
_object = _this select 1;
_smoke = _this select 2;
_dropping = true;
while {_dropping} do {
_pos = getpos _object;
// .4m above ground is about right for vehicles and boxes since it detaches shortly after hitting that point.
if ((_pos select 2) < .4) then {
_dropping = false;
};
};
waituntil {!_dropping};
detach _object;
deletevehicle _para;
deletevehicle _smoke;
//create secondary somke for better visibility for short period of time
_pos = getpos eventcrate;
_eventsmoke2 = createVehicle [DZES_Smoke, _pos, [], 0, "FLY"];
_eventsmoke2 attachto [eventcrate, [0,0,0]];
uisleep 30;
deletevehicle _eventsmoke2;
};
// getname of vehicle and send out message to all players on type of loot and general location
if (_loottype == "Vehicle") then {
_veh = typeOf eventcrate;
_loottype = getText (configFile >> 'CfgVehicles' >> _veh >> 'displayName');
[nil,nil,rTitleText,format["A carepackage with a %2 has been dropped near %1, find it before anyone else!",_location,_loottype], "PLAIN",20] call RE;
} else {
[nil,nil,rTitleText,format["A carepackage with %2 supplies has been dropped near %1, find it before anyone else!",_location,_loottype], "PLAIN",20] call RE;
};
//event completed, set variable true and broadcast. (if you use more sensors add more)
if ((_location == "Berezino") && !eventberezino) then {eventberezino = true; publicVariable "eventberezino";diag_log 'DZES: Event started, Berezino true.';};
if ((_location == "Elektro") && !eventelektro) then {eventelektro = true; publicVariable "eventelektro";diag_log 'DZES: Event started, Elektro true.';};
if ((_location == "Cherno") && !eventcherno) then {eventcherno = true; publicVariable "eventcherno";diag_log 'DZES: Event started, Cherno true.';};