v13 tweaks

This commit is contained in:
second_coming 2016-04-13 22:03:44 +01:00
parent d0f81fc838
commit f48e02f403
6 changed files with 47 additions and 22 deletions

View File

@ -37,7 +37,7 @@ SC_SurvivorsChance = 33; // chance in % to spawn surv
// Occupation Military (roaming AI near military buildings)
SC_occupyMilitary = false; // 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_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",

View File

@ -2,7 +2,7 @@
//
// Server Occupation script by second_coming
//
SC_occupationVersion = "v12 (13-04-2016)";
SC_occupationVersion = "v13 (13-04-2016)";
//
// http://www.exilemod.com/profile/60-second_coming/
//
@ -43,6 +43,7 @@ SC_occupationVersion = "v12 (13-04-2016)";
SC_fnc_getIn = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\getIn.sqf";
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";
_logDetail = "=============================================================================================================";
[_logDetail] call SC_fnc_log;

View File

@ -30,29 +30,28 @@ if(diag_fps < _minFPS) exitWith
_aiActive = {alive _x && (side _x == EAST OR side _x == WEST)} count allUnits;
//_aiActive = count(_spawnCenter nearEntities ["O_recon_F", _maxDistance+1000]);
if(_aiActive > _maxAIcount) exitWith
{
_logDetail = format ["[OCCUPATION Military]:: %1 active AI, so not spawning AI this time",_aiActive];
[_logDetail] call SC_fnc_log;
};
for [{_i = 0},{_i < (count _buildings)},{_i =_i + 1}] do
{
_logDetail = format ["[OCCUPATION Military]:: scanning buildings around %2 started at %1",time,_areaToScan];
[_logDetail] call SC_fnc_log;
_currentBuilding = _buildings select _i;
_currentBuilding = _x;
_building = _areaToScan nearObjects [_currentBuilding, 750];
_logDetail = format ["[OCCUPATION Military]:: scan for %2 building finished at %1",time,_currentBuilding];
[_logDetail] call SC_fnc_log;
for [{_n = 0},{_n < (count _building)-1},{_n =_n + 1}] do
{
_okToSpawn = true;
Sleep 0.1;
_foundBuilding = (_building select _n);
_foundBuilding = _x;
_location = getPos _foundBuilding;
_pos = [_location select 0, _location select 1, 0];
@ -114,7 +113,7 @@ for [{_i = 0},{_i < (count _buildings)},{_i =_i + 1}] do
};
// Don't spawn additional AI if there are players in range
if([_pos, 200] call ExileClient_util_world_isAlivePlayerInRange) exitwith
if([_pos, 250] call ExileClient_util_world_isAlivePlayerInRange) exitwith
{
_okToSpawn = false;
if(SC_extendedLogging) then
@ -218,7 +217,7 @@ for [{_i = 0},{_i < (count _buildings)},{_i =_i + 1}] do
_okToSpawn = false;
};
};
};
};
}foreach _building;
}foreach _buildings;
_logDetail = "[OCCUPATION Military]: Ended";
[_logDetail] call SC_fnc_log;

View File

@ -198,6 +198,7 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
[_unit] joinSilent _group;
if(_side == "survivor") then
{
_unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"];
removeUniform _unit;
_unit forceAddUniform "Exile_Uniform_BambiOverall";
if(SC_debug) then
@ -294,12 +295,14 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
[_unit] joinSilent _group2;
if(_side == "survivor") then
{
_unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"];
removeUniform _unit;
_unit forceAddUniform "Exile_Uniform_BambiOverall";
if(SC_debug) then
{
_tag = createVehicle ["Sign_Arrow_Green_F", position _unit, [], 0, "CAN_COLLIDE"];
_tag attachTo [_unit,[0,0,0.6],"Head"];
};
}
else
{
@ -309,7 +312,6 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
_tag attachTo [_unit,[0,0,0.6],"Head"];
};
};
};
}foreach units _initialGroup2;
[_group2, _pos, _groupRadius] call bis_fnc_taskPatrol;

View File

@ -197,6 +197,7 @@ if(_vehiclesToSpawn >= 1) then
_unit = [_group,_spawnLocation,"assault","random",_side,"Vehicle"] call DMS_fnc_SpawnAISoldier;
if(_side == "survivor") then
{
_unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"];
removeUniform _unit;
_unit forceAddUniform "Exile_Uniform_BambiOverall";
};
@ -209,6 +210,7 @@ if(_vehiclesToSpawn >= 1) then
_unit = [_group,_spawnLocation,"assault","random",_side,"Vehicle"] call DMS_fnc_SpawnAISoldier;
if(_side == "survivor") then
{
_unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"];
removeUniform _unit;
_unit forceAddUniform "Exile_Uniform_BambiOverall";
};

View File

@ -0,0 +1,21 @@
// Get the variables from the event handler
_unit = _this select 0;
_aggressor = _this select 1;
_damage = _this select 2;
// remove the eventhandler to stop it triggering multiple times simultaneously
_unit removeAllMPEventHandlers "mphit";
if (side _aggressor == RESISTANCE) then
{
// Make victim and his group aggressive to players
_group = group _unit;
_group reveal [_aggressor, 2.5];
_group moveTo (position _aggressor);
};
if(alive _unit) then
{
// reapply the eventhandler
_unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"];
};