From 0f4b922a460ad053fc8c6f2851cedf1cdafbb8e9 Mon Sep 17 00:00:00 2001 From: second_coming Date: Thu, 14 Apr 2016 09:47:40 +0100 Subject: [PATCH] v15 fixes --- config.sqf | 34 ++++++++++++++++++++++++------ initServer.sqf | 2 +- scripts/occupationMilitary.sqf | 19 ++++++++++------- scripts/occupationPublicBus.sqf | 37 ++++++++++++++++----------------- scripts/occupationVehicle.sqf | 22 ++++++++++---------- scripts/reactions/airHit.sqf | 8 +++---- scripts/reactions/unitMPHit.sqf | 7 ++++--- 7 files changed, 78 insertions(+), 51 deletions(-) diff --git a/config.sqf b/config.sqf index 6942cbc..710b6f7 100644 --- a/config.sqf +++ b/config.sqf @@ -39,14 +39,36 @@ SC_SurvivorsChance = 33; // chance in % to spawn surv // Occupation Military (roaming AI near military buildings) SC_occupyMilitary = true; // true if you want military buildings patrolled (specify which types of building below) -SC_buildings = [ "Land_Cargo_Patrol_V1_F","Land_i_Barracks_V1_F","Land_i_Barracks_V1_dam_F", "Land_i_Barracks_V2_F", - "Land_Cargo_House_V1_F","Land_Cargo_HQ_V1_F","Land_Cargo_HQ_V2_F","Land_Cargo_HQ_V3_F","Land_Cargo_Patrol_V2_F", - "Land_Cargo_Patrol_V3_F","Land_Cargo_Tower_V1_F","Land_Cargo_Tower_V1_No1_F","Land_Cargo_Tower_V1_No2_F", - "Land_Cargo_Tower_V1_No3_F","Land_Cargo_Tower_V1_No4_F","Land_Cargo_Tower_V1_No5_F","Land_Cargo_Tower_V1_No6_F", - "Land_Cargo_Tower_V1_No7_F","Land_Cargo_Tower_V2_F","Land_Cargo_Tower_V3_F","Land_MilOffices_V1_F", - "Land_Radar_F","Land_Radar_Small_F","Land_Dome_Big_F","Land_Dome_Small_F","Land_Army_hut3_long_int", +SC_buildings = [ "Land_TentHangar_V1_F","Land_Hangar_F", + "Land_Airport_Tower_F","Land_Cargo_House_V1_F", + "Land_Cargo_House_V3_F","Land_Cargo_HQ_V1_F", + "Land_Cargo_HQ_V2_F","Land_Cargo_HQ_V3_F", + "Land_u_Barracks_V2_F","Land_i_Barracks_V2_F", + "Land_i_Barracks_V1_F","Land_Cargo_Patrol_V1_F", + "Land_Cargo_Patrol_V2_F","Land_Cargo_Tower_V1_F", + "Land_Cargo_Tower_V1_No1_F","Land_Cargo_Tower_V1_No2_F", + "Land_Cargo_Tower_V1_No3_F","Land_Cargo_Tower_V1_No4_F", + "Land_Cargo_Tower_V1_No5_F","Land_Cargo_Tower_V1_No6_F", + "Land_Cargo_Tower_V1_No7_F","Land_Cargo_Tower_V2_F", + "Land_Cargo_Tower_V3_F","Land_MilOffices_V1_F", + "Land_Radar_F","Land_budova4_winter","land_hlaska", + "Land_Vysilac_FM","land_st_vez","Land_ns_Jbad_Mil_Barracks", + "Land_ns_Jbad_Mil_ControlTower","Land_ns_Jbad_Mil_House", + "land_pozorovatelna","Land_vys_budova_p1", + "Land_Vez","Land_Mil_Barracks_i", + "Land_Mil_Barracks_L","Land_Mil_Barracks", + "Land_Hlidac_budka","Land_Ss_hangar", + "Land_Mil_ControlTower","Land_a_stationhouse", + "Land_Farm_WTower","Land_Mil_Guardhouse", + "Land_A_statue01","Land_A_Castle_Gate", + "Land_A_Castle_Donjon","Land_A_Castle_Wall2_30", + "Land_A_Castle_Stairs_A", + "Land_i_Barracks_V1_dam_F","Land_Cargo_Patrol_V3_F", + "Land_Radar_Small_F","Land_Dome_Big_F", + "Land_Dome_Small_F","Land_Army_hut3_long_int", "Land_Army_hut_int","Land_Army_hut2_int" ]; + SC_occupyStatic = false; // true if you want to garrison AI in specific locations diff --git a/initServer.sqf b/initServer.sqf index 11714f4..ba53ec2 100644 --- a/initServer.sqf +++ b/initServer.sqf @@ -2,7 +2,7 @@ // // Server Occupation script by second_coming // -SC_occupationVersion = "v13 (13-04-2016)"; +SC_occupationVersion = "v15 (14-04-2016)"; // // http://www.exilemod.com/profile/60-second_coming/ // diff --git a/scripts/occupationMilitary.sqf b/scripts/occupationMilitary.sqf index 3d0527c..1006f75 100644 --- a/scripts/occupationMilitary.sqf +++ b/scripts/occupationMilitary.sqf @@ -4,6 +4,7 @@ private["_wp","_wp2","_wp3"]; _logDetail = format ["[OCCUPATION Military]:: Starting Monitor"]; [_logDetail] call SC_fnc_log; +_maxDistance = 500; // Max radius to scan _maxAIcount = SC_maxAIcount; _minFPS = SC_minFPS; _useLaunchers = DMS_ai_use_launchers; @@ -18,9 +19,6 @@ if(_currentPlayerCount > _scaleAI) then _maxAIcount = _maxAIcount - (_currentPlayerCount - _scaleAI) ; }; -// Select an area to scan as nearObjects on the entire map is slooooooooow -_areaToScan = [ 0, 900, 1, 500, 500, 0, 0, 0, true, false ] call DMS_fnc_findSafePos; - // Don't spawn additional AI if the server fps is below 8 if(diag_fps < _minFPS) exitWith { @@ -36,13 +34,15 @@ if(_aiActive > _maxAIcount) exitWith [_logDetail] call SC_fnc_log; }; +// Select an area to scan as nearObjects on the entire map is slooooooooow +_areaToScan = [ 0, 900, 1, 500, 500, 0, 0, 0, true, false ] call DMS_fnc_findSafePos; { _logDetail = format ["[OCCUPATION Military]:: scanning buildings around %2 started at %1",time,_areaToScan]; [_logDetail] call SC_fnc_log; _currentBuilding = _x; - _building = _areaToScan nearObjects [_currentBuilding, 750]; + _building = _areaToScan nearObjects [_currentBuilding, _maxDistance]; _logDetail = format ["[OCCUPATION Military]:: scan for %2 building finished at %1",time,_currentBuilding]; [_logDetail] call SC_fnc_log; @@ -63,9 +63,9 @@ if(_aiActive > _maxAIcount) exitWith while{_okToSpawn} do { - // Percentage chance to spawn (roll 60 or more to spawn AI) + // Percentage chance to spawn (roll 70 or more to spawn AI) _spawnChance = round (random 100); - if(_spawnChance < 60) exitWith + if(_spawnChance < 70) exitWith { _okToSpawn = false; if(SC_extendedLogging) then @@ -128,7 +128,7 @@ if(_aiActive > _maxAIcount) exitWith ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Get AI to patrol the area ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - _aiCount = 2 + (round (random 3)); + _aiCount = 2 + (round (random 1)); _groupRadius = 100; _difficulty = "random"; _side = "bandit"; @@ -159,6 +159,11 @@ if(_aiActive > _maxAIcount) exitWith _unit = _x; [_unit] joinSilent grpNull; [_unit] joinSilent _group; + if(SC_debug) then + { + _tag = createVehicle ["Sign_Arrow_Blue_F", position _unit, [], 0, "CAN_COLLIDE"]; + _tag attachTo [_unit,[0,0,0.6],"Head"]; + }; }foreach units _group; [ _group,_pos,_difficulty,"COMBAT" ] call DMS_fnc_SetGroupBehavior; diff --git a/scripts/occupationPublicBus.sqf b/scripts/occupationPublicBus.sqf index 8eeb83f..8d0c46b 100644 --- a/scripts/occupationPublicBus.sqf +++ b/scripts/occupationPublicBus.sqf @@ -3,7 +3,7 @@ if (!isServer) exitWith {}; _logDetail = format ["[OCCUPATION:publicBus]:: Starting @ %1",time]; [_logDetail] call SC_fnc_log; -_position = [ 0, 50, 1, 500, 500, 200, 200, 200, true, false ] call DMS_fnc_findSafePos; +_position = [ 0, 5000, 1, 500, 500, 200, 200, 200, true, false ] call DMS_fnc_findSafePos; // Get position of nearest roads _nearRoads = _position nearRoads 2000; @@ -42,12 +42,15 @@ _publicBus setVariable ["ExileIsPersistent", false]; _publicBus setVariable["vehPos",_spawnLocation,true]; _publicBus setFuel 1; -diag_log format['[OCCUPATION:publicBus] Vehicle spawned @ %1',_spawnLocation]; +_logDetail = format['[OCCUPATION:publicBus] Vehicle spawned @ %1',_spawnLocation]; +[_logDetail] call SC_fnc_log; _publicBus addEventHandler ["HandleDamage", { _amountOfDamage = 0; _amountOfDamage }]; busDriver assignasdriver _publicBus; +busDriver moveInDriver _publicBus; [busDriver] orderGetin true; +_publicBus lockDriver true; { _markerName = _x; @@ -89,31 +92,27 @@ while {true} do { uiSleep 0.5; _publicBus setFuel 0; - busDriver action ["salute", busDriver]; busDriver disableAI "MOVE"; uiSleep 3; } else { - _currentDriver = driver _publicBus; - if(_currentDriver != busDriver) then - { - _publicBus setFuel 0; - [_currentDriver] orderGetin false; - _currentDriver action ["eject", _publicBus]; - }; - - if(isnull _currentDriver) then - { - sleep 0.1; - busDriver assignAsDriver _publicBus; - busDriver moveInDriver _publicBus; - [busDriver] orderGetin true; - _publicBus lockDriver true; - }; _publicBus setFuel 1; uiSleep 3; busDriver enableAI "MOVE"; if(!Alive busDriver) exitWith {}; }; }; + + +{ + // Check for nearby missions + _missionPos = missionNamespace getVariable [format ["%1_pos",_x], []]; + _missionDistance = _missionPos distance2D _pos; + if (_missionDistance<=500) then + { + // DMS Mission in range + _logDetail = format['[OCCUPATION:publicBus] Vehicle near DMS Mission @ %1 (%2 metres away)',_missionPos,(_missionPos distance2D _pos)]; + [_logDetail] call SC_fnc_log; + }; +} forEach allMapMarkers; \ No newline at end of file diff --git a/scripts/occupationVehicle.sqf b/scripts/occupationVehicle.sqf index f82e3cb..6ecaf02 100644 --- a/scripts/occupationVehicle.sqf +++ b/scripts/occupationVehicle.sqf @@ -72,16 +72,16 @@ _maxDistance = _middle; if(_vehiclesToSpawn >= 1) then { - // decide which side to spawn - _sideToSpawn = random 100; - if(_sideToSpawn <= SC_SurvivorsChance) then - { - _side = "survivor"; - } - else - { - _side = "bandit"; - }; + if(SC_occupyVehicleSurvivors) then + { + // decide which side to spawn + _sideToSpawn = random 100; + if(_sideToSpawn <= SC_SurvivorsChance) then + { + _side = "survivor"; + }; + }; + _useLaunchers = DMS_ai_use_launchers; _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCityCapital"], _maxDistance]); @@ -232,7 +232,7 @@ if(_vehiclesToSpawn >= 1) then _logDetail = format['[OCCUPATION:Vehicle] %3 vehicle %1 spawned @ %2',_VehicleClassToUse,_spawnLocation,_side]; [_logDetail] call SC_fnc_log; - + sleep 15; [_group, _spawnLocation, 2000] call bis_fnc_taskPatrol; _group setBehaviour "SAFE"; _group setCombatMode "RED"; diff --git a/scripts/reactions/airHit.sqf b/scripts/reactions/airHit.sqf index d4321fb..1aced44 100644 --- a/scripts/reactions/airHit.sqf +++ b/scripts/reactions/airHit.sqf @@ -53,11 +53,11 @@ if(_heliDamage > 0.2 && _damagedEssentials > 0 && !_crewEjected && _ejectChance _logDetail = format ["[OCCUPATION:Sky]:: Air unit %2 ejecting passengers at %3 (time: %1)",time,_veh,_heliPosition]; [_logDetail] call SC_fnc_log; }; + _cargo = assignedCargo _veh; { - _unit = _x; - _unit joinSilent _group2; - _unit action ["EJECT", _veh]; - } forEach (assignedCargo _veh); + _x joinSilent _group2; + _x action ["EJECT", _veh]; + } forEach _cargo; _target = _this select 1; _group2 reveal [_target,1.5]; diff --git a/scripts/reactions/unitMPHit.sqf b/scripts/reactions/unitMPHit.sqf index a1fc67b..6b82239 100644 --- a/scripts/reactions/unitMPHit.sqf +++ b/scripts/reactions/unitMPHit.sqf @@ -8,10 +8,11 @@ _unit removeAllMPEventHandlers "mphit"; if (side _aggressor == RESISTANCE) then { - // Make victim and his group aggressive to players + // Make victim and his group aggressive to their attacker _group = group _unit; - _group reveal [_aggressor, 2.5]; - _group moveTo (position _aggressor); + _group reveal [_aggressor, 2.5]; + _group move (position _aggressor); + }; if(alive _unit) then