Added A setting for a minimum percentage of AI at which a mission is complete.

this should reduce the chances that missions don't complete because Ai glitch into buildings, rocks or the ground.
This commit is contained in:
Ghostrider-GRG- 2018-05-31 21:38:25 -04:00
parent a367296df2
commit 8fcac0f0cd
11 changed files with 48 additions and 24 deletions

View File

@ -481,6 +481,8 @@ private _spawnPara = if (random(1) < _chancePara) then {true} else {false};
_x setVariable["crateSpawnPos", (getPos _x)];
} forEach _crates;
private["_thresholdPercentageKilled","_result","_minPercentageKilled"];
_thresholdPercentageKilled = (1-blck_killPercentage);
while {_missionComplete isEqualTo -1} do
{
#ifdef blck_debugMode
@ -490,9 +492,15 @@ while {_missionComplete isEqualTo -1} do
{
if ([_locations,20,true] call blck_fnc_playerInRangeArray) then {_missionComplete = 1};
};
if (_endIfAIKilled) then
{
if (({alive _x} count _blck_AllMissionAI) < 1) then {_missionComplete = 1};
_result = [_blck_AllMissionAI,1] call blck_fnc_countAliveAI;
// _result is an array of [no alive, total spawned];
//private _noneAlive = if (_result select 0 isEqualTo 0) then {true} else {false};
//private _aiCountBelowThreshold = if ( (_result select 0)/(_result select 1) < _thresholdPercentageKilled) then {true} else {false};
//diag_log format["_fnc_missionSpawner: _noneAlive = %1 | _result = %2 | PercentageKilled = %3",_noneAlive,_result,(_result select 0)/(_result select 1)];
if ((_result select 0) < 1 || ((_result select 0)/(_result select 1)) < _thresholdPercentageKilled ) then {_missionComplete = 1};
};
if (_spawnCratesTiming isEqualTo "atMissionSpawn") then
{
@ -510,7 +518,8 @@ while {_missionComplete isEqualTo -1} do
{
_missionComplete = 1
} else {
if (_assetSpawned getVariable["blck_AIState",0] > 0 && (({alive _x} count _blck_AllMissionAI) isEqualTo 1)) then {_missionComplete = 1};
//if (_assetSpawned getVariable["blck_AIState",0] > 0 && (({alive _x} count _blck_AllMissionAI) isEqualTo 1)) then {_missionComplete = 1};
if ( ([_blck_AllMissionAI] call blck_fnc_countAliveAI < 0.15) && (_assetSpawned getVariable["blck_AIState",0] > 0) ) then {_missionComplete = 1};
};
};
if (_spawnPara) then

View File

@ -97,7 +97,7 @@ if (blck_debugLevel > 1) then
#endif
// params["_vehType","_pos",["_clearInventory",true]];
_wep = [(_x select 0),[0,0,0],false] call blck_fnc_spawnVehicle;
_wep = [(_x select 0),[0,0,0],false,true] call blck_fnc_spawnVehicle;
//_wep addEventHandler["HandleDamage",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleDamage}];
_wep addMPEventHandler["MPHit",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleDamage}];
_empGroup setVariable["groupVehicle",_wep];

View File

@ -4,11 +4,10 @@
*/
params["_group"];
private["_nearestGroup","_modType"];
private["_nearestGroup"];
_modType = call blck_fnc_getModType;
if (_modType == "Epoch") then {_units = _group nearEntities ["I_Soldier_EPOCH", 100]};
if (_modType == "Exile") then (_units = _group nearEntities ["i_g_soldier_unarmed_f", 100]};
if (blck_modType == "Epoch") then {_units = _group nearEntities ["I_Soldier_EPOCH", 100]};
if (blck_modType == "Exile") then (_units = _group nearEntities ["i_g_soldier_unarmed_f", 100]};
_nearestGroup = group _units select 0;
{
if (group _x != _group && _x distance (leader _group) < ((leader _nearestGroup) distance (leader _group))) then {_nearestGroup = group _x};

View File

@ -16,13 +16,12 @@
params["_unit","_killer"];
//diag_log format["rewardKiller:: _unit = %1 and _killer %2",_unit,_killer];
private["_modType","_reward","_maxReward","_dist","_killstreakReward","_distanceBonus","_newKillerScore","_newKillerFrags","_money"];
_modType = call blck_fnc_getModType;
private["_reward","_maxReward","_dist","_killstreakReward","_distanceBonus","_newKillerScore","_newKillerFrags","_money"];
//diag_log format["[blckeagles] rewardKiller:: - _modType = %1",_modType];
//if (_modType isEqualTo "Epoch") exitWith {}; // Have players pull crypto from AI bodies now that this feature is available.
if (_modType isEqualTo "Epoch") then
if (blck_modType isEqualTo "Epoch") then
{
//diag_log "calculating reward for Epoch";
@ -63,7 +62,7 @@ _player setVariable ["ExileTemperature", _data select 44];
_player setVariable ["ExileWetness", _data select 45];
*/
if (_modType isEqualTo "Exile") then
if (blck_modType isEqualTo "Exile") then
{
private["_distanceBonus","_overallRespectChange","_newKillerScore","_newKillerFrags","_maxReward","_money","_message"];
/*

View File

@ -11,7 +11,7 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_coords","_hostageConfigs"];
private["_hostageGroup","_hostage","_modType"];
private["_hostageGroup","_hostage"];
_hostage = [_coords,_hostageConfigs] call blck_fnc_spawnCharacter;
_hostage remoteExec["GMS_fnc_initHostage", -2, true];
_hostage setVariable["assetType",1,true];

View File

@ -91,8 +91,17 @@ _unit allowDammage true;
_unit setBehaviour "COMBAT";
_unit setunitpos "AUTO";
if (_headGear isEqualTo []) then {_unit addHeadgear (selectRandom _headGear)};
if (_vests isEqualTo []) then {_unit addVest (selectRandom _vests)};
if !(_headGear isEqualTo []) then
{
_unit addHeadgear (selectRandom _headGear);
//diag_log format["Headgear for unit %1 = %2",_unit, headgear _unit];
};
if !(_vests isEqualTo []) then
{
_unit addVest (selectRandom _vests);
//diag_log format["Vest for unit %1 = %2",_unit, vest _unit];
};
if (_weaponList isEqualTo []) then {_weaponList = call blck_fnc_selectAILoadout};
_weap = selectRandom _weaponList;
_unit addWeaponGlobal _weap;

View File

@ -12,7 +12,7 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_i","_weap","_skin","_unit","_skillLevel","_aiSkills","_launcherRound","_index","_ammoChoices","_modType","_optics","_pointers","_muzzles","_underbarrel","_legalOptics"];
private ["_i","_weap","_skin","_unit","_skillLevel","_aiSkills","_launcherRound","_index","_ammoChoices","_optics","_pointers","_muzzles","_underbarrel","_legalOptics"];
params["_pos","_aiGroup",["_skillLevel","red"],["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]],["_scuba",false]];
#ifdef blck_debugMode
@ -27,8 +27,8 @@ if (blck_debugLevel >= 2) then
if (isNull _aiGroup) exitWith {diag_log "[blckeagls] ERROR CONDITION:-->> NULL-GROUP Provided to _fnc_spawnUnit"};
_unit = ObjNull;
_modType = call blck_fnc_getModType;
if (_modType isEqualTo "Epoch") then
if (blck_modType isEqualTo "Epoch") then
{
"I_Soldier_EPOCH" createUnit [[0,0,0], _aiGroup, "_unit = this", blck_baseSkill, "COLONEL"];
_unit setVariable ["LAST_CHECK",28800,true];
@ -40,7 +40,7 @@ if (_modType isEqualTo "Epoch") then
case "orange":{_unit setVariable["Crypto",8 + floor(random(blck_maxMoneyOrange)),true];};
};
};
if (_modType isEqualTo "Exile") then
if (blck_modType isEqualTo "Exile") then
{
"i_g_soldier_unarmed_f" createUnit [[0,0,0], _aiGroup, "_unit = this", blck_baseSkill, "COLONEL"];
switch(_skillLevel) do
@ -52,7 +52,17 @@ if (_modType isEqualTo "Exile") then
};
};
// findEmptyPosition [minDistance, maxDistance, vehicleType]
_unit setPos ( _pos findEmptyPosition [0.1,3,(typeOf _unit)]);
_posUnit = getPosATL _unit;
_start = +_posUnit;
_start set [2, 100];
while { (lineIntersects [ATLToASL _start, ATLToASL _posUnit]) } do {
_pos set [2, ((_pos select 2) + 0.25)];
_posUnit set[1,((_posUnit select 1) + 0.25)];
};
_unit setPosATL _pos;
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
{

View File

@ -12,9 +12,7 @@
params["_Vehicle"];
private["_modType"];
_modType = call blck_fnc_getModType;
switch (_ModType) do {
switch (blck_modType) do {
case "Epoch":
{
#ifdef blck_debugMode

View File

@ -12,7 +12,7 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_veh","_modType"];
private["_veh"];
params["_vehType","_pos",["_clearInventory",true]];
#ifdef blck_debugMode

View File

@ -12,7 +12,7 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_veh","_modType"];
private["_veh"];
params["_vehType","_pos",["_clearInventory",true]];
#ifdef blck_debugMode

View File

@ -12,7 +12,7 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_veh","_modType"];
private["_veh"];
params["_vehType","_pos",["_clearInventory",true]];
#ifdef blck_debugMode