diff --git a/changeLog.txt b/changeLog.txt index 6ed0593..90a0489 100644 --- a/changeLog.txt +++ b/changeLog.txt @@ -1,3 +1,10 @@ +================================================================================= +V42 (18-05-2016) +================================================================================= +Forced reload after spawning AI to make sure they are ready to fire when they spot +an enemy +Added in compatibility with the new DMS feature AI freezing + ================================================================================= V41 (15-05-2016) ================================================================================= diff --git a/config.cpp b/config.cpp index 35356f5..d1fe98f 100644 --- a/config.cpp +++ b/config.cpp @@ -4,6 +4,8 @@ class CfgPatches units[] = {}; weapons[] = {}; requiredVersion = 0.1; + a3_exile_occupation_version = "v42 (22-05-2016)"; + requiredAddons[] = {"a3_dms"}; author[]= {"second_coming"}; }; }; diff --git a/config.sqf b/config.sqf index e53cc51..efba614 100644 --- a/config.sqf +++ b/config.sqf @@ -23,7 +23,7 @@ SC_scaleAI = 10; // any more than _scaleAI players on the server an SC_removeUserMapMarkers = true; // true to delete map markers placed by players every 10 seconds -SC_fastNights = true; // true if you want night time to go faster than daytime +SC_fastNights = false; // true if you want night time to go faster than daytime SC_fastNightsStarts = 18; // Start fast nights at this hour (24 hour clock) eg. 18 for 6pm SC_fastNightsMultiplierNight= 16; // the time multiplier to use at night (12 = 12x speed) SC_fastNightsEnds = 6; // End fast nights at this hour (24 hour clock) eg. 6 for 6am diff --git a/initServer.sqf b/initServer.sqf index 46dd3e6..4c28c3b 100644 --- a/initServer.sqf +++ b/initServer.sqf @@ -2,7 +2,6 @@ // // Server Occupation script by second_coming // -SC_occupationVersion = "v41 (17-05-2016)"; // // http://www.exilemod.com/profile/60-second_coming/ // @@ -20,6 +19,8 @@ SC_occupationVersion = "v41 (17-05-2016)"; // //////////////////////////////////////////////////////////////////////////////////////////// +SC_occupationVersion = getText (configFile >> "CfgPatches" >> "a3_exile_occupation" >> "a3_exile_occupation_version"); + [] spawn { diag_log format ["[OCCUPATION]:: Occupation %2 Giving the server time to start before starting [OCCUPATION] (%1)",time,SC_occupationVersion]; diff --git a/scripts/functions/fnc_findsafePos.sqf b/scripts/functions/fnc_findsafePos.sqf index ce31841..6dbe82c 100644 --- a/scripts/functions/fnc_findsafePos.sqf +++ b/scripts/functions/fnc_findsafePos.sqf @@ -52,6 +52,14 @@ while{!_validspot} do }; }; + _isOverWater = surfaceIsWater _position; + + if(!_waterSpawn && _isOverWater) then + { + _validspot = false; + diag_log format["BIS_fnc_findSafePos none waterspawn over water %1",_position]; + }; + if(_validspot) then { _validspot = [ _position ] call SC_fnc_isSafePos; diff --git a/scripts/occupationLootCrates.sqf b/scripts/occupationLootCrates.sqf index 997ec8d..ba339b2 100644 --- a/scripts/occupationLootCrates.sqf +++ b/scripts/occupationLootCrates.sqf @@ -57,6 +57,7 @@ for "_i" from 1 to SC_numberofLootCrates do _unit = [_group,_spawnPosition,"custom","random","bandit","soldier",_loadOut] call DMS_fnc_SpawnAISoldier; _unitName = ["bandit"] call SC_fnc_selectName; _unit setName _unitName; + reload _unit; }; // Get the AI to shut the fuck up :) diff --git a/scripts/occupationMilitary.sqf b/scripts/occupationMilitary.sqf index 84ab63f..560c37c 100644 --- a/scripts/occupationMilitary.sqf +++ b/scripts/occupationMilitary.sqf @@ -149,7 +149,8 @@ _areaToScan = [ false, false ] call SC_fnc_findsafePos; [_unit] joinSilent grpNull; [_unit] joinSilent _group; _unitName = ["bandit"] call SC_fnc_selectName; - _unit setName _unitName; + _unit setName _unitName; + reload _unit; if(SC_debug) then { _tag = createVehicle ["Sign_Arrow_Blue_F", position _unit, [], 0, "CAN_COLLIDE"]; diff --git a/scripts/occupationMonitor.sqf b/scripts/occupationMonitor.sqf index 1624976..68153d9 100644 --- a/scripts/occupationMonitor.sqf +++ b/scripts/occupationMonitor.sqf @@ -11,11 +11,19 @@ _logDetail = format ["[OCCUPATION:Unstick]:: Initialised at %1",time]; _pos = position _x; _nearestMarker = [allMapMarkers, _pos] call BIS_fnc_nearestPosition; // Nearest Marker to the Location _posNearestMarker = getMarkerPos _nearestMarker; - if(_pos distance _posNearestMarker < 750) then + + _group = group _x; + _isFrozen = _group getVariable["DMS_isGroupFrozen",false]; + if (!_isFrozen && (_pos distance _posNearestMarker < 750)) then { _GroupLeader = leader (group _x); _GroupLeader doMove _originalSpawnLocation; - }; + } + else + { + _logDetail = format ["[OCCUPATION:Unstick]:: Air: %1 is currently frozen",_x]; + [_logDetail] call SC_fnc_log; + }; }forEach SC_liveHelisArray; { @@ -23,7 +31,17 @@ _logDetail = format ["[OCCUPATION:Unstick]:: Initialised at %1",time]; _logDetail = format ["[OCCUPATION:Unstick]:: Land: %1 is active",_x]; [_logDetail] call SC_fnc_log; _x setFuel 1; - [_x] call SC_fnc_unstick; + _group = group _x; + _isFrozen = _group getVariable["DMS_isGroupFrozen",false]; + if (!_isFrozen) then + { + [_x] call SC_fnc_unstick; + } + else + { + _logDetail = format ["[OCCUPATION:Unstick]:: Land: %1 is currently frozen",_x]; + [_logDetail] call SC_fnc_log; + }; sleep 2; }forEach SC_liveVehiclesArray; @@ -31,8 +49,18 @@ _logDetail = format ["[OCCUPATION:Unstick]:: Initialised at %1",time]; if(isNull _x) exitWith { SC_liveBoatsArray = SC_liveBoatsArray - [_x]; }; _logDetail = format ["[OCCUPATION:Unstick]:: Sea: %1 is active",_x]; [_logDetail] call SC_fnc_log; - _x setFuel 1; - [_x] call SC_fnc_unstick; + _x setFuel 1; + _group = group _x; + _isFrozen = _group getVariable["DMS_isGroupFrozen",false]; + if (!_isFrozen) then + { + [_x] call SC_fnc_unstick; + } + else + { + _logDetail = format ["[OCCUPATION:Unstick]:: Sea: %1 is currently frozen",_x]; + [_logDetail] call SC_fnc_log; + }; sleep 2; }forEach SC_liveBoatsArray; diff --git a/scripts/occupationPlaces.sqf b/scripts/occupationPlaces.sqf index 13bcb2d..c024dcd 100644 --- a/scripts/occupationPlaces.sqf +++ b/scripts/occupationPlaces.sqf @@ -164,6 +164,7 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi [_unit] joinSilent grpNull; [_unit] joinSilent _group; [_side,_unit] call SC_fnc_addMarker; + reload _unit; }foreach units _group; // Get the AI to shut the fuck up :) @@ -254,6 +255,7 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi [_unit] joinSilent grpNull; [_unit] joinSilent _group2; [_side,_unit] call SC_fnc_addMarker; + reload _unit; }foreach units _group2; [_group2, _pos, _groupRadius] call bis_fnc_taskPatrol; diff --git a/scripts/occupationSea.sqf b/scripts/occupationSea.sqf index 36b47f5..0a1c3be 100644 --- a/scripts/occupationSea.sqf +++ b/scripts/occupationSea.sqf @@ -114,6 +114,7 @@ for "_i" from 1 to _vehiclesToSpawn do _unit assignAsDriver _vehicle; _unit moveInDriver _vehicle; _unit setVariable ["DMS_AssignedVeh",_vehicle]; + _unit setVariable ["DMS_AllowFreezing",false,true]; _unitPlaced = true; }; if(_vehicleRole == "Turret") then diff --git a/scripts/occupationSky.sqf b/scripts/occupationSky.sqf index d84c331..a7f99e4 100644 --- a/scripts/occupationSky.sqf +++ b/scripts/occupationSky.sqf @@ -132,6 +132,7 @@ for "_i" from 1 to _vehiclesToSpawn do _unit moveInDriver _vehicle; //_vehicle lockDriver true; _unit setVariable ["DMS_AssignedVeh",_vehicle]; + _unit setVariable ["DMS_AllowFreezing",false,true]; removeBackpackGlobal _unit; _unit addBackpackGlobal "B_Parachute"; _unitPlaced = true; diff --git a/scripts/occupationTransport.sqf b/scripts/occupationTransport.sqf index afb8083..65d8e24 100644 --- a/scripts/occupationTransport.sqf +++ b/scripts/occupationTransport.sqf @@ -109,6 +109,7 @@ _transport setVariable ["SC_assignedDriver", _transportDriver,true]; _transport setVariable ["SC_transport", true,true]; _transport setVariable ["SC_vehicleSpawnLocation", _spawnLocation,true]; _transportDriver setVariable ["DMS_AssignedVeh",_transport]; +_transportDriver setVariable ["DMS_AllowFreezing",false,true]; _transport addEventHandler ["getin", "_this call SC_fnc_getOnBus;"]; _transport addEventHandler ["getout", "_this call SC_fnc_getOffBus;"]; diff --git a/scripts/occupationVehicle.sqf b/scripts/occupationVehicle.sqf index ac47403..ec008f6 100644 --- a/scripts/occupationVehicle.sqf +++ b/scripts/occupationVehicle.sqf @@ -201,6 +201,7 @@ if(_vehiclesToSpawn >= 1) then _unit assignAsDriver _vehicle; _unit moveInDriver _vehicle; _unit setVariable ["DMS_AssignedVeh",_vehicle]; + _unit setVariable ["DMS_AllowFreezing",false,true]; _unit setVariable ["SC_drivenVehicle", _vehicle,true]; _unit addMPEventHandler ["mpkilled", "_this call SC_fnc_driverKilled;"]; _vehicle setVariable ["SC_assignedDriver", _unit,true]; @@ -251,7 +252,8 @@ if(_vehiclesToSpawn >= 1) then { _x enableAI "FSM"; - _x enableAI "MOVE"; + _x enableAI "MOVE"; + reload _x; }forEach units _group; [_group, _spawnLocation, 2000] call bis_fnc_taskPatrol;