diff --git a/initServer.sqf b/initServer.sqf index fe78d0d..f6f9d70 100644 --- a/initServer.sqf +++ b/initServer.sqf @@ -2,7 +2,7 @@ // // Server Occupation script by second_coming // -SC_occupationVersion = "v19 (15-04-2016)"; +SC_occupationVersion = "v20 (15-04-2016)"; // // http://www.exilemod.com/profile/60-second_coming/ // @@ -44,6 +44,7 @@ SC_occupationVersion = "v19 (15-04-2016)"; SC_fnc_refuel = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\refuel.sqf"; SC_fnc_comeUnstuck = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\comeUnstuck.sqf"; SC_fnc_unitMPHit = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\unitMPHit.sqf"; + SC_fnc_unitMPKilled = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\unitMPKilled.sqf"; SC_fnc_getOnBus = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\getOnBus.sqf"; SC_fnc_getOffBus = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\getOffBus.sqf"; diff --git a/scripts/occupationLootCrates.sqf b/scripts/occupationLootCrates.sqf index a105ae6..4e53621 100644 --- a/scripts/occupationLootCrates.sqf +++ b/scripts/occupationLootCrates.sqf @@ -45,19 +45,30 @@ for "_i" from 1 to SC_numberofLootCrates do _AICount = 1 + (round (random (SC_LootCrateGuards-1))); }; - _spawnPosition = [_position select 0, _position select 1, 0]; - _group = [_spawnPosition, _AICount, "random", "random", "bandit"] call DMS_fnc_SpawnAIGroup; - // Get the AI to shut the fuck up :) - enableSentences false; - enableRadio false; + + if(_AICount > 0) then + { + _spawnPosition = [_position select 0, _position select 1, 0]; + _group = [_spawnPosition, _AICount, "random", "random", "bandit"] call DMS_fnc_SpawnAIGroup; + + // Get the AI to shut the fuck up :) + enableSentences false; + enableRadio false; - [_group, _spawnPosition, 100] call bis_fnc_taskPatrol; - _group setBehaviour "AWARE"; - _group setCombatMode "RED"; + [_group, _spawnPosition, 100] call bis_fnc_taskPatrol; + _group setBehaviour "AWARE"; + _group setCombatMode "RED"; + + _logDetail = format ["[OCCUPATION:LootCrates]:: Creating crate %3 at drop zone %1 with %2 guards",_position,_AICount,_i]; + [_logDetail] call SC_fnc_log; + } + else + { + _logDetail = format ["[OCCUPATION:LootCrates]:: Creating crate %2 at drop zone %1 with no guards",_position,_i]; + [_logDetail] call SC_fnc_log; + }; - _logDetail = format ["[OCCUPATION:LootCrates]:: Creating crate %3 at drop zone %1 with %2 guards",_position,_AICount,_i]; - [_logDetail] call SC_fnc_log; _box = "CargoNet_01_box_F" createvehicle _position; diff --git a/scripts/reactions/unitMPKilled.sqf b/scripts/reactions/unitMPKilled.sqf new file mode 100644 index 0000000..8b2ef57 --- /dev/null +++ b/scripts/reactions/unitMPKilled.sqf @@ -0,0 +1,12 @@ +// Get the variables from the event handler +_unit = _this select 0; +_killer = _this select 1; + +// remove all eventhandlers from the dead unit +_unit removeAllMPEventHandlers "mphit"; +_unit removeAllMPEventHandlers "mpkilled"; + +if(SC_debug) then +{ + { detach _x; deleteVehicle _x; } forEach attachedObjects _unit; +};