From b08f08ec0ca3749b298107303913726a3dd8aca4 Mon Sep 17 00:00:00 2001
From: second_coming <second_coming@second-coming.net>
Date: Fri, 15 Apr 2016 01:49:24 +0100
Subject: [PATCH] v19 tweaks & fixes

Survivor AI now attack hostile players. Survivor side changed from WEST
to CIVILIAN
---
 config.sqf                        | 22 ++++++++---------
 initServer.sqf                    |  4 ++--
 scripts/occupationHeliCrashes.sqf | 13 ++---------
 scripts/occupationLootCrates.sqf  |  2 +-
 scripts/occupationMilitary.sqf    |  8 +++----
 scripts/occupationPlaces.sqf      | 39 ++++++++++++-------------------
 scripts/occupationPublicBus.sqf   | 19 ++++++++++++---
 scripts/occupationSea.sqf         |  4 ++--
 scripts/occupationSky.sqf         |  4 ++--
 scripts/occupationStatic.sqf      | 10 ++++----
 scripts/occupationVehicle.sqf     | 19 +++++----------
 scripts/reactions/getOffBus.sqf   |  2 +-
 scripts/reactions/getOnBus.sqf    |  3 ++-
 scripts/reactions/reactUnit.sqf   |  5 ----
 scripts/reactions/unitMPHit.sqf   | 12 +++++++---
 15 files changed, 78 insertions(+), 88 deletions(-)

diff --git a/config.sqf b/config.sqf
index 29728f9..227b486 100644
--- a/config.sqf
+++ b/config.sqf
@@ -12,7 +12,7 @@
 
 // Shared Config for each occupation monitor
 
-SC_debug 				    = true;				// set to true to turn on debug features (not for live servers) 
+SC_debug 				    = false;				    // set to true to turn on debug features (not for live servers) 
 SC_extendedLogging          = false;                // set to true for additional logging
 SC_infiSTAR_log			    = true;			        // true Use infiSTAR logging, false logs to server rpt
 SC_maxAIcount 			    = 100;					// the maximum amount of AI, if the AI count is above this then additional AI won't spawn
@@ -25,19 +25,17 @@ SC_scaleAI 				    = 10; 					// any more than _scaleAI players on the server an
 SC_useWaypoints			    = true;					// When spawning AI create waypoints to make them enter buildings 
 												    // (can affect performance when the AI is spawned and the waypoints are calculated)
 
-                                                    // Occupation Places (towns, villages & cities roaming AI)
 SC_occupyPlaces 			= true;				    // true if you want villages,towns,cities patrolled by bandits
-SC_occupyPlacesSurvivors	= true;	                // true if you want a chance to spawn survivor AI as well as bandits (SC_occupyPlaces must be true to use this option)
 
 SC_occupyVehicle			= true;					// true if you want to have roaming AI vehicles
 SC_occupyVehiclesLocked		= true;					// true if AI vehicles to stay locked until all the linked AI are dead
-SC_occupyVehicleSurvivors	= true;	                // true if you want a chance to spawn survivor AI as well as bandits (SC_occupyVehicle must be true to use this option)
+
 
 SC_SurvivorsChance          = 33;                   // chance in % to spawn survivors instead of bandits (for places and land vehicles)
+SC_occupyPlacesSurvivors	= true;	                // true if you want a chance to spawn survivor AI as well as bandits (SC_occupyPlaces must be true to use this option)
+SC_occupyVehicleSurvivors	= true;	                // true if you want a chance to spawn survivor AI as well as bandits (SC_occupyVehicle must be true to use this option)
 
-
-                                                    // Occupation Military (roaming AI near military buildings)
-SC_occupyMilitary 		    = true;			    // true if you want military buildings patrolled (specify which types of building below)
+SC_occupyMilitary 		    = true;			        // true if you want military buildings patrolled (specify which types of building below)
 
 SC_buildings                = [	"Land_TentHangar_V1_F","Land_Hangar_F",
                                 "Land_Airport_Tower_F","Land_Cargo_House_V1_F",
@@ -70,9 +68,7 @@ SC_buildings                = [	"Land_TentHangar_V1_F","Land_Hangar_F",
                                 ]; 
    
 
-SC_occupyStatic	 		    = true;		    	// true if you want to garrison AI in specific locations
-
-
+SC_occupyStatic	 		    = true;		    	    // true if you want to garrison AI in specific locations
 
 SC_occupySky				= true;					// true if you want to have roaming AI helis
 SC_occupySea				= false;		        // true if you want to have roaming AI boats
@@ -121,6 +117,8 @@ if (worldName == 'Namalsk') then
 };
 
 // Don't alter anything below this point
+SC_SurvivorSide         = CIVILIAN;
+SC_BanditSide           = EAST;
 SC_liveVehicles 		= 0;
 SC_liveVehiclesArray    = [];
 SC_liveHelis	 		= 0;
@@ -138,4 +136,6 @@ publicVariable "SC_liveBoats";
 publicVariable "SC_liveBoatsArray";
 publicVariable "SC_numberofLootCrates";
 publicVariable "SC_publicBusArray";
-publicVariable "SC_StopTheBus";
\ No newline at end of file
+publicVariable "SC_StopTheBus";
+publicVariable "SC_SurvivorSide";
+publicVariable "SC_BanditSide";
\ No newline at end of file
diff --git a/initServer.sqf b/initServer.sqf
index aca1e3a..fe78d0d 100644
--- a/initServer.sqf
+++ b/initServer.sqf
@@ -2,7 +2,7 @@
 //
 //		Server Occupation script by second_coming
 //
-SC_occupationVersion = "v18 (14-04-2016)";
+SC_occupationVersion = "v19 (15-04-2016)";
 //
 //		http://www.exilemod.com/profile/60-second_coming/
 //
@@ -33,7 +33,7 @@ SC_occupationVersion = "v18 (14-04-2016)";
     // Select the log style depending on config settings
     SC_fnc_log			        = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\occupationLog.sqf";
 
-    // EventHandlers for AI reactions
+    // EventHandlers for AI reactions & player interactions
     SC_fnc_repairVehicle 		= compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\repairVehicle.sqf";
     SC_fnc_vehicleDestroyed     = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\vehicleDestroyed.sqf"; 
     SC_fnc_reactUnit 			= compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\reactUnit.sqf";
diff --git a/scripts/occupationHeliCrashes.sqf b/scripts/occupationHeliCrashes.sqf
index 45d05ab..4881f9e 100644
--- a/scripts/occupationHeliCrashes.sqf
+++ b/scripts/occupationHeliCrashes.sqf
@@ -16,14 +16,9 @@ for "_i" from 1 to SC_numberofHeliCrashes do
 	while{!_validspot} do 
 	{
 		sleep 0.2;
-		_position = [ 0, 50, 1, 500, 500, 200, 200, 200, true, false ] call DMS_fnc_findSafePos;
+		_position = [ 10, 50, 1, 750, 750, 200, 200, 200, true, false ] call DMS_fnc_findSafePos;
 		_validspot	= true;
 	
-		// Check for nearby spawn points and traders
-		_nearestMarker = [allMapMarkers, _position] call BIS_fnc_nearestPosition;
-		_posNearestMarker = getMarkerPos _nearestMarker;
-		if(_position distance _posNearestMarker < 750) then { _validspot = false; };
-
 		//Check if near another heli crash site
 		_nearOtherCrash = (nearestObjects [_position,["Land_UWreck_MV22_F"],750]) select 0;	
 		if (!isNil "_nearOtherCrash") then { _validspot = false; };
@@ -31,11 +26,7 @@ for "_i" from 1 to SC_numberofHeliCrashes do
 		//Check if near another loot crate site
 		_nearOtherCrate = (nearestObjects [_position,["CargoNet_01_box_F"],500]) select 0;	
 		if (!isNil "_nearOtherCrate") then { _validspot = false; };
-		
-		//Check if near player base
-        _nearBase = (nearestObjects [_position,["Exile_Construction_Flag_Static"],500]) select 0;
-        if (!isNil "_nearBase") then { _validspot = false;  };	
-		
+				
 	};	
 	
 	_logDetail = format['[OCCUPATION:HeliCrashes] Crash %1 : Location %2',_i,_position];
diff --git a/scripts/occupationLootCrates.sqf b/scripts/occupationLootCrates.sqf
index 25ded79..a105ae6 100644
--- a/scripts/occupationLootCrates.sqf
+++ b/scripts/occupationLootCrates.sqf
@@ -14,7 +14,7 @@ for "_i" from 1 to SC_numberofLootCrates do
 	while{!_validspot} do 
 	{
 		sleep 0.2;
-		_position = [ 0, 50, 1, 500, 500, 200, 200, 200, true, false ] call DMS_fnc_findSafePos;
+		_position = [ 10, 50, 1, 750, 750, 200, 200, 200, true, false ] call DMS_fnc_findSafePos;
 		_validspot	= true;
 		
 		//Check if near another crate site
diff --git a/scripts/occupationMilitary.sqf b/scripts/occupationMilitary.sqf
index 1006f75..0287a1a 100644
--- a/scripts/occupationMilitary.sqf
+++ b/scripts/occupationMilitary.sqf
@@ -26,7 +26,7 @@ if(diag_fps < _minFPS) exitWith
     [_logDetail] call SC_fnc_log;
 };
 
-_aiActive = {alive _x && (side _x == EAST OR side _x == WEST)} count allUnits;
+_aiActive = {alive _x && (side _x == SC_BanditSide OR side _x == SC_SurvivorSide)} count allUnits;
 
 if(_aiActive > _maxAIcount) exitWith 
 { 
@@ -131,7 +131,7 @@ _areaToScan = [ 0, 900, 1, 500, 500, 0, 0, 0, true, false ] call DMS_fnc_findSaf
 				_aiCount = 2 + (round (random 1)); 
 				_groupRadius = 100;
 				_difficulty = "random";
-				_side = "bandit";
+				_side = SC_BanditSide;
 				_spawnPosition = _pos;				
 										
 				// Get the AI to shut the fuck up :)
@@ -141,7 +141,7 @@ _areaToScan = [ 0, 900, 1, 500, 500, 0, 0, 0, true, false ] call DMS_fnc_findSaf
 				if(!SC_useWaypoints) then
 				{
 					DMS_ai_use_launchers = false;
-					_group = [_spawnPosition, _aiCount, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup;
+					_group = [_spawnPosition, _aiCount, _difficulty, "random", "bandit"] call DMS_fnc_SpawnAIGroup;
 					DMS_ai_use_launchers = true;
 
 					[_group, _pos, _groupRadius] call bis_fnc_taskPatrol;
@@ -152,7 +152,7 @@ _areaToScan = [ 0, 900, 1, 500, 500, 0, 0, 0, true, false ] call DMS_fnc_findSaf
 				{
 									
 					DMS_ai_use_launchers = false;
-					_group = [_spawnPosition, _aiCount, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup;
+					_group = [_spawnPosition, _aiCount, _difficulty, "random", "bandit"] call DMS_fnc_SpawnAIGroup;
 					DMS_ai_use_launchers = true;
 
                     {	
diff --git a/scripts/occupationPlaces.sqf b/scripts/occupationPlaces.sqf
index 979cd70..e893d7e 100644
--- a/scripts/occupationPlaces.sqf
+++ b/scripts/occupationPlaces.sqf
@@ -17,12 +17,6 @@ _side               = "bandit";
 
 if(SC_occupyPlacesSurvivors) then 
 { 
-    // Make survivors friendly to players and enemies to bandit AI
-    RESISTANCE setFriend[WEST,1];
-    WEST setFriend[RESISTANCE,1];
-    WEST setFriend[EAST,0];
-    EAST setFriend[WEST,0];
-    
     if(!isNil "DMS_Enable_RankChange") then { DMS_Enable_RankChange = true;  };
 };
 
@@ -44,7 +38,7 @@ if(diag_fps < _minFPS) exitWith
     };
 };
 
-_aiActive = {alive _x && (side _x == EAST OR side _x == WEST)} count allUnits;
+_aiActive = {alive _x && (side _x == SC_BanditSide OR side _x == SC_SurvivorSide)} count allUnits;
 if(_aiActive > _maxAIcount) exitWith 
 { 
     if(SC_extendedLogging) then 
@@ -117,46 +111,43 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
                 [_logDetail] call SC_fnc_log;
             }; 
         };
-	
-
     
 		// Don't spawn additional AI if there are already AI in range
+        _nearBanditAI = { side _x == SC_BanditSide AND _x distance _pos < 500 } count allUnits;
+        _nearSurvivorAI = { side _x == SC_SurvivorSide AND _x distance _pos < 500 } count allUnits;
 
-        _nearEastAI = { side _x == EAST AND _x distance _pos < 500 } count allUnits;
-        _nearWestAI = { side _x == WEST AND _x distance _pos < 500 } count allUnits;
-
-        if(_nearEastAI > 0 AND _nearWestAI > 0) then 
+        if(_nearBanditAI > 0 AND _nearSurvivorAI > 0) then 
         { 
             _okToSpawn = false; 
             if(SC_extendedLogging) then 
             { 
-                _logDetail = format ["[OCCUPATION:Places]:: %1 already has %2 active AI patrolling",_locationName,_aiNear];
+                _logDetail = format ["[OCCUPATION:Places]:: %1 already has active AI patrolling",_locationName];
                 [_logDetail] call SC_fnc_log;
             }; 
         }
         else
         {
-            if(_nearEastAI == 0 AND _nearWestAI == 0) then 
+            if(_nearBanditAI == 0 AND _nearSurvivorAI == 0) then 
             { 
                 _sideToSpawn = random 100; 
                 if(_sideToSpawn <= SC_SurvivorsChance) then  
                 { 
-                    _side = "survivor";    
+                    _side = "survivor";   
                 }
                 else
                 { 
-                    _side = "bandit";            
+                    _side = "bandit";           
                 };
             }
             else
             {
-                if(_nearWestAI == 0) then 
+                if(_nearSurvivorAI == 0) then 
                 { 
                     _side = "survivor";
                 }
                 else 
                 { 
-                    _side = "bandit";
+                    _side = "bandit"; 
                 };
             };            
         };
@@ -183,11 +174,11 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
 			_initialGroup = [_spawnPosition, _aiCount, "randomEasy", "assault", _side] call DMS_fnc_SpawnAIGroup;
 			DMS_ai_use_launchers = _useLaunchers;
             
-            _group = createGroup EAST;
+            _group = createGroup SC_BanditSide;
             if(_side == "survivor") then 
             { 
                 deleteGroup _group;
-                _group = createGroup WEST;              
+                _group = createGroup SC_SurvivorSide;              
             };
             
             _group setVariable ["DMS_LockLocality",nil];
@@ -276,11 +267,11 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
 				_initialGroup2 = [_spawnPosition, 5, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup;
 				DMS_ai_use_launchers = _useLaunchers;
 
-                _group2 = createGroup EAST;
+                _group2 = createGroup SC_BanditSide;
                 if(_side == "survivor") then 
                 {                   
                     deleteGroup _group2;
-                    _group2 = createGroup WEST;
+                    _group2 = createGroup SC_SurvivorSide;
                 };
                          
                 _group2 setVariable ["DMS_LockLocality",nil];
@@ -334,7 +325,7 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
 				_marker setMarkerText "Occupied Area";	
 			};			
 			
-			if(_side == 'survivor') then 
+			if(_side == "survivor") then 
             {
                 _logDetail = format ["[OCCUPATION:Places]:: Spawning %2 survivor AI in at %3 to patrol %1",_locationName,_aiCount,_spawnPosition];                  
             }
diff --git a/scripts/occupationPublicBus.sqf b/scripts/occupationPublicBus.sqf
index e09f51e..17f0029 100644
--- a/scripts/occupationPublicBus.sqf
+++ b/scripts/occupationPublicBus.sqf
@@ -1,18 +1,24 @@
 if (!isServer) exitWith {};
 
+_middle 		    = worldSize/2;			
+_spawnCenter 	    = [_middle,_middle,0];		// Centre point for the map
+_maxDistance 	    = _middle;			        // Max radius for the map
+
 _logDetail = format ["[OCCUPATION:publicBus]:: Starting @ %1",time];
 [_logDetail] call SC_fnc_log;
 
-_position = [ 0, 5000, 1, 500, 500, 200, 200, 200, true, false ] call DMS_fnc_findSafePos;
+_logDetail = format ["[OCCUPATION:publicBus]:: Spawning near map centre %1 @ %2",_spawnCenter,time];
+[_logDetail] call SC_fnc_log;
+
+_positionOfBus = [_spawnCenter,0,500,25,0,10,0] call BIS_fnc_findSafePos;
 
 // Get position of nearest roads
-_nearRoads = _position nearRoads 2000;
+_nearRoads = _positionOfBus nearRoads 2000;
 _nearestRoad = _nearRoads select 0;
 _nearestRoadPos = position (_nearRoads select 0);
 _spawnLocation = [_nearestRoadPos select 0, _nearestRoadPos select 1, 0];
 
 // Create the busDriver and ensure he doest react to gunfire or being shot at.
-
 _group = createGroup resistance;
 _group setCombatMode "BLUE";
 
@@ -34,6 +40,7 @@ _publicBus setVariable ["SC_vehicleSpawnLocation", _spawnLocation,true];
 _publicBus addEventHandler ["getin", "_this call SC_fnc_getOnBus;"];
 _publicBus addEventHandler ["getout", "_this call SC_fnc_getOffBus;"];
 
+
 _group addVehicle _publicBus;	
 clearBackpackCargoGlobal _publicBus;
 clearItemCargoGlobal _publicBus;
@@ -94,11 +101,17 @@ while {true} do
         uiSleep 0.5;
         _publicBus setFuel 0;
         busDriver disableAI "MOVE";
+        _publicBus animateDoor ["Doors_1", 1];
+        _publicBus animateDoor ["Doors_2", 1];
+        _publicBus animateDoor ["Doors_3", 1];
         uiSleep 3;
     }
     else
     {	
         _publicBus setFuel 1;
+        _publicBus animateDoor ["Doors_1", 0];
+        _publicBus animateDoor ["Doors_2", 0];
+        _publicBus animateDoor ["Doors_3", 0];
         uiSleep 3;
         busDriver enableAI "MOVE";
         if(!Alive busDriver) exitWith {};
diff --git a/scripts/occupationSea.sqf b/scripts/occupationSea.sqf
index c2e1471..7542507 100644
--- a/scripts/occupationSea.sqf
+++ b/scripts/occupationSea.sqf
@@ -19,7 +19,7 @@ if(diag_fps < SC_minFPS) exitWith
     [_logDetail] call SC_fnc_log; 
 };
 
-_aiActive = {alive _x && (side _x == EAST OR side _x == WEST)} count allUnits;
+_aiActive = {alive _x && (side _x == SC_BanditSide OR side _x == SC_SurvivorSide)} count allUnits;
 if(_aiActive > _maxAIcount) exitWith 
 { 
     _logDetail = format ["[OCCUPATION:Sea]:: %1 active AI, so not spawning AI this time",_aiActive]; 
@@ -44,7 +44,7 @@ for "_i" from 1 to _vehiclesToSpawn do
 {
 	private["_group"];
 	_spawnLocation = [ 250, 0, 1, 1000, 1000, 1000, 1000, 1000, true, true ] call DMS_fnc_findSafePos; 
-    _group = createGroup east;
+    _group = createGroup SC_BanditSide;
     _VehicleClassToUse = SC_BoatClassToUse call BIS_fnc_selectRandom;
     _vehicle = createVehicle [_VehicleClassToUse, _spawnLocation, [], 0, "NONE"];
     _vehicle setPosASL _spawnLocation;
diff --git a/scripts/occupationSky.sqf b/scripts/occupationSky.sqf
index 6da27a6..b2038e6 100644
--- a/scripts/occupationSky.sqf
+++ b/scripts/occupationSky.sqf
@@ -19,7 +19,7 @@ if(diag_fps < SC_minFPS) exitWith
     [_logDetail] call SC_fnc_log; 
 };
 
-_aiActive = {alive _x && (side _x == EAST OR side _x == WEST)} count allUnits;
+_aiActive = {alive _x && (side _x == SC_BanditSide OR side _x == SC_SurvivorSide)} count allUnits;
 if(_aiActive > _maxAIcount) exitWith 
 { 
     _logDetail = format ["[OCCUPATION:Sky]:: %1 active AI, so not spawning AI this time",_aiActive]; 
@@ -68,7 +68,7 @@ for "_i" from 1 to _vehiclesToSpawn do
 	_height = 350 + (round (random 200));
 	_spawnLocation = [_safePos select 0, _safePos select 1, _height];
    
-    _group = createGroup east;
+    _group = createGroup SC_BanditSide;
     _VehicleClassToUse = SC_HeliClassToUse call BIS_fnc_selectRandom;
     _vehicle = createVehicle [_VehicleClassToUse, _spawnLocation, [], 0, "NONE"];
     _group addVehicle _vehicle;
diff --git a/scripts/occupationStatic.sqf b/scripts/occupationStatic.sqf
index e3b10e2..9d0da7b 100644
--- a/scripts/occupationStatic.sqf
+++ b/scripts/occupationStatic.sqf
@@ -32,7 +32,7 @@ if(diag_fps < _minFPS) exitWith
     [_logDetail] call SC_fnc_log;    
 };
 
-_aiActive = {alive _x && (side _x == EAST OR side _x == WEST)} count allUnits;
+_aiActive = {alive _x && (side _x == SC_BanditSide OR side _x == SC_SurvivorSide)} count allUnits;
 if(_aiActive > _maxAIcount) exitWith 
 { 
     _logDetail = format ["[OCCUPATION Static]:: %1 active AI, so not spawning AI this time",_aiActive]; 
@@ -57,13 +57,13 @@ if(_aiActive > _maxAIcount) exitWith
 	{			
 
 		// Don't spawn additional AI if there are already AI in range
-        _nearEastAI = { side _x == EAST AND _x distance _spawnPosition < 250 } count allUnits;
-		if(_nearEastAI > 0) exitwith 
+        _nearBanditAI = { side _x == SC_BanditSide AND _x distance _spawnPosition < 250 } count allUnits;
+		if(_nearBanditAI > 0) exitwith 
         { 
             _okToSpawn = false; 
             if(_debug) then 
             { 
-                _logDetail = format ["[OCCUPATION Static]:: %1 already has %2 active AI patrolling",_spawnPosition,_nearEastAI];
+                _logDetail = format ["[OCCUPATION Static]:: %1 already has %2 active AI patrolling",_spawnPosition,_nearBanditAI];
                 [_logDetail] call SC_fnc_log;
             };
         };
@@ -94,7 +94,7 @@ if(_aiActive > _maxAIcount) exitWith
             _initialGroup setCombatMode "BLUE";
             _initialGroup setBehaviour "SAFE";
 
-            _group = createGroup EAST;           
+            _group = createGroup SC_BanditSide;           
             _group setVariable ["DMS_LockLocality",nil];
             _group setVariable ["DMS_SpawnedGroup",true];
             _group setVariable ["DMS_Group_Side", _side];
diff --git a/scripts/occupationVehicle.sqf b/scripts/occupationVehicle.sqf
index 52430bb..b2bd654 100644
--- a/scripts/occupationVehicle.sqf
+++ b/scripts/occupationVehicle.sqf
@@ -3,17 +3,11 @@ if (!isServer) exitWith {};
 _logDetail = format['[OCCUPATION:Vehicle] Started'];
 [_logDetail] call SC_fnc_log;
 
-// set the default side to "bandit"
+// set the default side for bandit AI
 _side               = "bandit"; 
 
 if(SC_occupyVehicleSurvivors) then 
-{ 
-    // Make survivors friendly to players and enemies to bandit AI
-    RESISTANCE setFriend[WEST,1];
-    WEST setFriend[RESISTANCE,1];
-    WEST setFriend[EAST,0];
-    EAST setFriend[WEST,0];
-    
+{   
     if(!isNil "DMS_Enable_RankChange") then { DMS_Enable_RankChange = true;  };
 };
 
@@ -33,7 +27,7 @@ if(diag_fps < SC_minFPS) exitWith
     [_logDetail] call SC_fnc_log; 
 };
 
-_aiActive = {alive _x && (side _x == EAST OR side _x == WEST)} count allUnits;
+_aiActive = {alive _x && (side _x == SC_BanditSide OR side _x == SC_SurvivorSide)} count allUnits;
 if(_aiActive > _maxAIcount) exitWith 
 { 
     _logDetail = format ["[OCCUPATION:Vehicle]:: %1 active AI, so not spawning AI this time",_aiActive]; 
@@ -78,11 +72,10 @@ if(_vehiclesToSpawn >= 1) then
         _sideToSpawn = random 100; 
         if(_sideToSpawn <= SC_SurvivorsChance) then  
         { 
-            _side = "survivor";    
+            _side = "survivor";   
         };         
     };
  
-
 	_useLaunchers = DMS_ai_use_launchers;
 	_locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCityCapital"], _maxDistance]);
 	_i = 0;
@@ -115,11 +108,11 @@ if(_vehiclesToSpawn >= 1) then
 		_nearestRoad = position (_nearRoads select 0);
 		_spawnLocation = [_nearestRoad select 0, _pos select 1, 0];
 
-        _group = createGroup EAST;
+        _group = createGroup SC_BanditSide;
         if(_side == "survivor") then 
         { 
             deleteGroup _group;
-            _group = createGroup WEST; 
+            _group = createGroup SC_SurvivorSide; 
         };        
         
         _group setVariable ["DMS_LockLocality",nil];
diff --git a/scripts/reactions/getOffBus.sqf b/scripts/reactions/getOffBus.sqf
index e945815..bbf18ab 100644
--- a/scripts/reactions/getOffBus.sqf
+++ b/scripts/reactions/getOffBus.sqf
@@ -5,5 +5,5 @@ _unit	= _this select 2;
 
 if(isPlayer _unit) then
 {
-    _unit removeAction _bustop;      
+    _bus removeAction SC_bustop;      
 };
\ No newline at end of file
diff --git a/scripts/reactions/getOnBus.sqf b/scripts/reactions/getOnBus.sqf
index 2474745..efc9224 100644
--- a/scripts/reactions/getOnBus.sqf
+++ b/scripts/reactions/getOnBus.sqf
@@ -5,6 +5,7 @@ _unit	= _this select 2;
 
 if(isPlayer _unit) then
 {
-    _bustop = _unit addAction ["Stop the bus", { SC_StopTheBus = true } ];      
+    hint "You got on the bus";
+    SC_bustop = _bus addAction ["Stop the bus", { SC_StopTheBus = true } ];    
 };
 
diff --git a/scripts/reactions/reactUnit.sqf b/scripts/reactions/reactUnit.sqf
index 6c91d4b..139597f 100644
--- a/scripts/reactions/reactUnit.sqf
+++ b/scripts/reactions/reactUnit.sqf
@@ -1,7 +1,2 @@
-_logDetail = format ["[OCCUPATION]:: Unit %2 killed at %1",time,_this];
-[_logDetail] call SC_fnc_log;
 
-// Get the variables from the event handler
-_unit 			= _this select 0;
-_weaponFired 	= _this select 1;
 
diff --git a/scripts/reactions/unitMPHit.sqf b/scripts/reactions/unitMPHit.sqf
index 6f9e6b5..f663bd3 100644
--- a/scripts/reactions/unitMPHit.sqf
+++ b/scripts/reactions/unitMPHit.sqf
@@ -8,9 +8,15 @@ _unit removeAllMPEventHandlers  "mphit";
 
 if (side _aggressor == RESISTANCE) then 
 {
-    // Make victim and his group aggressive to their attacker
-    _group = group _unit;
-    _unit addRating -999999; 
+    // Make victim and his group aggressive to players
+    _initialGroup = group _unit;
+    _group =  createGroup WEST;
+    {
+        _unit = _x;           
+        //[_unit] joinSilent grpNull;
+        [_unit] joinSilent _group;      
+    }foreach units _initialGroup;
+    
     _group reveal [_aggressor, 2.5]; 
     _group move (position _aggressor); 
     diag_log format["::testing:: unit %1 damaged by %2",_unit,_aggressor];