Merge pull request #705 from Ignatz-HeMan/experimental

SupportCopter v2
This commit is contained in:
vbawol 2017-03-02 12:50:34 -06:00 committed by GitHub
commit a3f56709ad
3 changed files with 117 additions and 77 deletions

View File

@ -12,6 +12,28 @@
Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/EPOCH_supportCopter.sqf
*/
params ["_pos","_copter"];
_arrUnits = getArray (getMissionConfig "CfgEpochUAVSupport" >> "unitTypes");
_minunitCount = getNumber (getMissionConfig "CfgEpochUAVSupport" >> "minUnitNum");
_maxunitCount = getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxUnitNum");
_unitCount = _minunitCount + round (random (_maxunitCount - _minunitCount));
_SpawnTypes = [];
_Spawncounts = [];
for "_i" from 1 to _unitCount do {
_UnitType = selectRandom _arrUnits;
_idx = _SpawnTypes find _UnitType;
if (_idx == -1) then {
_SpawnTypes pushback _UnitType;
_Spawncounts pushback 1;
}
else {
_Spawncounts set [_idx,(_Spawncounts select _idx)+ 1];
};
};
{
[_x, player, true, _this] call EPOCH_unitSpawn;
} forEach (["CfgEpochClient", "uavAlertUnitSpawnTemplate", ["I_Soldier_EPOCH"]] call EPOCH_fnc_returnConfigEntryV2);
[_SpawnTypes select _foreachindex, player, true, _x, _this] call EPOCH_unitSpawn;
} forEach _Spawncounts;

View File

@ -15,14 +15,17 @@
//[[[cog import generate_private_arrays ]]]
private ["_bomb","_config","_currentLimit","_disableAI","_driver","_grp","_index","_jammerRange","_jammers","_loop","_nonJammer","_nonTrader","_nonTraderAIRange","_restricted","_sapperNum","_spawnLimit","_targetPos","_unit","_units"];
//[[[end]]]
params ["_unitClass",["_trgt",player],["_doVariable",false],["_extraData",[]]];
params ["_unitClass",["_trgt",player],["_doVariable",false],["_unitCount",1],["_extraData",[]]];
_bomb = objNull;
// diag_log format["DEBUG: Antagonist %1 Spawning on %2. Do variable: %3.", _unitClass, _trgt, _doVariable];
if(_doVariable)then{_unitClass call EPOCH_unitSpawnIncrease;};//Assumes Antagonist is required.
_index = EPOCH_spawnIndex find _unitClass;
_spawnLimit = EPOCH_playerSpawnArray select _index;
_spawnLimit = 0;
if (_index != -1) then {
_spawnLimit = EPOCH_playerSpawnArray select _index;
};
_currentLimit = count(_trgt nearEntities[_unitClass, 800]);
if (!_doVariable && (_currentLimit >= _spawnLimit)) exitWith {
diag_log format["DEBUG: too many %1 exiting unitspawn",_unitClass];
@ -51,18 +54,22 @@ _disableAI = {
_units = [];
switch _unitClass do {
case "Epoch_Cloak_F": {
_unit = createAgent[_unitClass, _targetPos, [], 256, "FORM"];
_units pushBack _unit;
_unit call _disableAI;
[_unit,_trgt] execFSM "\x\addons\a3_epoch_code\System\cloak.fsm";
for "_i" from 0 to (_unitCount-1) do {
_unit = createAgent[_unitClass, _targetPos, [], 256, "FORM"];
_units pushBack _unit;
_unit call _disableAI;
[_unit,_trgt] execFSM "\x\addons\a3_epoch_code\System\cloak.fsm";
};
};
case "GreatWhite_F": {
if (surfaceIsWater _targetPos) then{
if (((_targetPos vectorDiff getPosASL _trgt) select 2) > 25) then{
_unit = createAgent[_unitClass, _targetPos, [], 120, "FORM"];
_units pushBack _unit;
_unit call _disableAI;
[_unit] execFSM "\x\addons\a3_epoch_code\System\Shark_Brain.fsm";
for "_i" from 0 to (_unitCount-1) do {
_unit = createAgent[_unitClass, _targetPos, [], 120, "FORM"];
_units pushBack _unit;
_unit call _disableAI;
[_unit] execFSM "\x\addons\a3_epoch_code\System\Shark_Brain.fsm";
};
};
};
};
@ -75,52 +82,60 @@ switch _unitClass do {
};
[_trgt,_sapperNum] execVM "epoch_code\compile\EPOCH_callSapperMigration.sqf";
}else{
for "_i" from 0 to (_unitCount-1) do {
_unit = createAgent[_unitClass, _targetPos, [], 256, "FORM"];
_units pushBack _unit;
_bomb = createVehicle ["Sapper_Charge_Ammo", _targetPos, [], 0, "CAN_COLLIDE"];
_bomb attachTo [_unit, [0,0,0],"Pelvis"];
_unit call _disableAI;
_sapperHndl = [_unit, _bomb, _trgt] execFSM "\x\addons\a3_epoch_code\System\Sapper_Brain.fsm";
_unit setVariable ["sapperHndl",_sapperHndl];
_unit addEventHandler ["FiredNear", format ["%1 setFSMVariable [""_sFiredNear"",[_this select 1, _this select 2]];",_sapperHndl]];
_unit addEventHandler ["Hit", format ["%1 setFSMVariable [""_sHit"",[_this select 1, _this select 2]];",_sapperHndl]];
};
};
};
case "Epoch_SapperG_F": {
for "_i" from 0 to (_unitCount-1) do {
_unit = createAgent[_unitClass, _targetPos, [], 256, "FORM"];
_units pushBack _unit;
_bomb = createVehicle ["Sapper_Charge_Ammo", _targetPos, [], 0, "CAN_COLLIDE"];
_bomb = createVehicle ["SmokeShellCustom", _targetPos, [], 0, "CAN_COLLIDE"];
_bomb attachTo [_unit, [0,0,0],"Pelvis"];
_unit call _disableAI;
_sapperHndl = [_unit, _bomb, _trgt] execFSM "\x\addons\a3_epoch_code\System\Sapper_Brain.fsm";
_unit setVariable ["sapperHndl",_sapperHndl];
_unit setVariable ["sapperHndl",_sapperHndl];
_unit addEventHandler ["FiredNear", format ["%1 setFSMVariable [""_sFiredNear"",[_this select 1, _this select 2]];",_sapperHndl]];
_unit addEventHandler ["Hit", format ["%1 setFSMVariable [""_sHit"",[_this select 1, _this select 2]];",_sapperHndl]];
};
};
case "Epoch_SapperG_F": {
_unit = createAgent[_unitClass, _targetPos, [], 256, "FORM"];
_units pushBack _unit;
_bomb = createVehicle ["SmokeShellCustom", _targetPos, [], 0, "CAN_COLLIDE"];
_bomb attachTo [_unit, [0,0,0],"Pelvis"];
_unit call _disableAI;
_sapperHndl = [_unit, _bomb, _trgt] execFSM "\x\addons\a3_epoch_code\System\Sapper_Brain.fsm";
_unit setVariable ["sapperHndl",_sapperHndl];
_unit addEventHandler ["FiredNear", format ["%1 setFSMVariable [""_sFiredNear"",[_this select 1, _this select 2]];",_sapperHndl]];
_unit addEventHandler ["Hit", format ["%1 setFSMVariable [""_sHit"",[_this select 1, _this select 2]];",_sapperHndl]];
};
case "Epoch_SapperB_F": {
_unit = createAgent[_unitClass, _targetPos, [], 256, "FORM"];
_units pushBack _unit;
_bomb = createVehicle["SapperB_Charge_Ammo", _targetPos, [], 0, "CAN_COLLIDE"];
_bomb attachTo[_unit, [0, 0, 0], "Pelvis"];
_unit call _disableAI;
_sapperHndl = [_unit, _bomb, _trgt] execFSM "\x\addons\a3_epoch_code\System\Sapper_Brain2.fsm";
_unit setVariable ["sapperHndl",_sapperHndl];
_unit addEventHandler ["FiredNear", format ["%1 setFSMVariable [""_sFiredNear"",[_this select 1, _this select 2]];",_sapperHndl]];
_unit addEventHandler ["Hit", format ["%1 setFSMVariable [""_sHit"",[_this select 1, _this select 2]];",_sapperHndl]];
for "_i" from 0 to (_unitCount-1) do {
_unit = createAgent[_unitClass, _targetPos, [], 256, "FORM"];
_units pushBack _unit;
_bomb = createVehicle["SapperB_Charge_Ammo", _targetPos, [], 0, "CAN_COLLIDE"];
_bomb attachTo[_unit, [0, 0, 0], "Pelvis"];
_unit call _disableAI;
_sapperHndl = [_unit, _bomb, _trgt] execFSM "\x\addons\a3_epoch_code\System\Sapper_Brain2.fsm";
_unit setVariable ["sapperHndl",_sapperHndl];
_unit addEventHandler ["FiredNear", format ["%1 setFSMVariable [""_sFiredNear"",[_this select 1, _this select 2]];",_sapperHndl]];
_unit addEventHandler ["Hit", format ["%1 setFSMVariable [""_sHit"",[_this select 1, _this select 2]];",_sapperHndl]];
};
};
case "I_UAV_01_F": {
_targetPos = getPosATL _trgt;
_targetPos = [_targetPos, 600, 1200, 5, 0, 400, 0] call BIS_fnc_findSafePos;
_targetPos set[2, 600];
_unit = createVehicle["I_UAV_01_F", _targetPos, [], 0, "FLY"];
_unit disableTIEquipment true;
_units pushBack _unit;
addToRemainsCollector[_unit];
_unit flyInHeight 600;
_grp = createGroup RESISTANCE;
_driver = _grp createUnit["I_UAV_AI", position _unit, [], 0, "CAN_COLLIDE"];
_driver moveInAny _unit;
[_unit, _trgt] execFSM "\x\addons\a3_epoch_code\System\Copter_brain.fsm";
for "_i" from 0 to (_unitCount-1) do {
_targetPos = getPosATL _trgt;
_targetPos = [_targetPos, 600, 1200, 5, 0, 400, 0] call BIS_fnc_findSafePos;
_targetPos set[2, 600];
_unit = createVehicle["I_UAV_01_F", _targetPos, [], 0, "FLY"];
_unit disableTIEquipment true;
_units pushBack _unit;
addToRemainsCollector[_unit];
_unit flyInHeight 600;
_grp = createGroup RESISTANCE;
_driver = _grp createUnit["I_UAV_AI", position _unit, [], 0, "CAN_COLLIDE"];
_driver moveInAny _unit;
[_unit, _trgt] execFSM "\x\addons\a3_epoch_code\System\Copter_brain.fsm";
};
};
case "PHANTOM": {
[] execFSM "\x\addons\a3_epoch_code\System\Phantom_Brain.fsm";
@ -136,25 +151,24 @@ switch _unitClass do {
};
};
case "I_Soldier_EPOCH": {
_extraData params ["_pos","_copter"];
_grp = createGroup RESISTANCE;
_grp setBehaviour "COMBAT";
_grp setCombatMode "RED";
_minAISkill = getNumber (getMissionConfig "CfgEpochUAVSupport" >> "minAISkill");
_arrUnits = getArray (getMissionConfig "CfgEpochUAVSupport" >> "unitTypes");
_unitCount = getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxUnitNum");
_extraData params [["_pos",getpos player],["_copter",objnull]];
_grp = createGroup RESISTANCE;
_grp setBehaviour "COMBAT";
_grp setCombatMode "RED";
_minAISkill = getNumber (getMissionConfig "CfgEpochSoldier" >> "minAISkill");
_arrUnits = getArray (getMissionConfig "CfgEpochSoldier" >> "unitTypes");
_arrSkills = ["aimingAccuracy","aimingShake","aimingSpeed","endurance","spotDistance","spotTime","courage","reloadSpeed","commanding","general"];
_arrVals = [
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxAimingAccuracy"),
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxAimingShake"),
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxAimingSpeed"),
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxEndurance"),
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxSpotDistance"),
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxSpotTime"),
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxCourage"),
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxReloadSpeed"),
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxCommanding"),
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxGeneral")
getNumber (getMissionConfig "CfgEpochSoldier" >> "maxAimingAccuracy"),
getNumber (getMissionConfig "CfgEpochSoldier" >> "maxAimingShake"),
getNumber (getMissionConfig "CfgEpochSoldier" >> "maxAimingSpeed"),
getNumber (getMissionConfig "CfgEpochSoldier" >> "maxEndurance"),
getNumber (getMissionConfig "CfgEpochSoldier" >> "maxSpotDistance"),
getNumber (getMissionConfig "CfgEpochSoldier" >> "maxSpotTime"),
getNumber (getMissionConfig "CfgEpochSoldier" >> "maxCourage"),
getNumber (getMissionConfig "CfgEpochSoldier" >> "maxReloadSpeed"),
getNumber (getMissionConfig "CfgEpochSoldier" >> "maxCommanding"),
getNumber (getMissionConfig "CfgEpochSoldier" >> "maxGeneral")
];
_units = [];
for "_i" from 0 to (_unitCount - 1) do {

View File

@ -46,7 +46,6 @@ class CfgEpochClient
niteLight[] = {1,1.88,22}; //Set ambient lighting at night: {Brightness of light,Height of light}. Default (Low Ambient): {1.88,22} | Twilight: {7.2,88} | Distant: {12.8,142}
ryanZombiesEnabled = "true";
antagonistSpawnIndex[] = {{"Epoch_Cloak_F",1},{"GreatWhite_F",2},{"Epoch_Sapper_F",2},{"Epoch_SapperB_F",1},{"I_UAV_01_F",2},{"PHANTOM",1},{"B_Heli_Transport_01_F",1},{"EPOCH_RyanZombie_1",12},{"I_Soldier_EPOCH",1}}; // {"type", limit}
uavAlertUnitSpawnTemplate = {"I_Soldier_EPOCH"};
customVarsDefaults[] = {{"Temp",98.6,{106.7,95,102,105,96,95}},{"Hunger",1500,{5000,0,5001,5001,1250,0}},{"Thirst",750,{2500,0,2501,2501,625,0}},{"AliveTime",0,{-2,0}},{"Energy",0,{2500,0}},{"Wet",0,{100,0,35,55,-1,-1}},{"Soiled",0,{100,0,35,55,-1,-1}},{"Immunity",0,{100,0}},{"Toxicity",0,{100,0,35,55,-1,-1}},{"Stamina",100,{"EPOCH_playerStaminaMax",0}},{"Crypto",0,{250000,0}},{"HitPoints",{0,0,0,0},{1,0,0.5,1,-1,-1}},{"BloodP",100,{190,0,120,140,70,50}},{"SpawnArray",{},{}},{"Karma",0,{50000,-50000}},{"Alcohol",0,{100,0,35,55,-1,-1}},{"Radiation",0,{100,0,35,55,-1,-1}},{"Nuisance",0,{100,0}},{"MissionArray",{},{}}}; // EPOCH_player + varName, default value, {max,min,high-warn,high-critical,low-warn,low-critical}
hudConfigs[] = {{{"BloodP","","",{"getPlayerDamage",">=",0.7}},"topRight","x\addons\a3_epoch_code\Data\UI\bleeding_ca.paa",{"forceUpdate"}},{{"Oxygen","getPlayerOxygenRemaining","",{},{1,0,2,2,1,0.55}},"topRight","x\addons\a3_epoch_code\Data\UI\oxygen_ca.paa"},{"Hunger","topRight","x\addons\a3_epoch_code\Data\UI\hunger_ca.paa",{"forceBloodRise"}},{"Thirst","topRight","x\addons\a3_epoch_code\Data\UI\thirst_ca.paa",{"forceBloodRise"}},{"Temp","topRight",{"x\addons\a3_epoch_code\Data\UI\hot_ca.paa","x\addons\a3_epoch_code\Data\UI\cold_ca.paa"},{"forceFatigue"}},{"Toxicity","topRight","x\addons\a3_epoch_code\Data\UI\hazzard_ca.paa"},{"Alcohol","topRight","x\addons\a3_epoch_code\Data\UI\drunk_ca.paa"},{"Soiled","topRight","x\addons\a3_epoch_code\Data\UI\soiled_ca.paa"},{"Radiation","topRight","x\addons\a3_epoch_code\Data\UI\rads_ca.paa"},{{"HitPoints","getPlayerHitPointDamage","HitLegs"},"topRight","x\addons\a3_epoch_code\Data\UI\broken_ca.paa"}};
group_upgrade_lvl[] = {4,"1000",6,"1500",8,"2000",10,"2500",12,"3000",14,"3500",16,"4000",32,"8000",64,"16000"}; // controls max group limit and cost
@ -100,6 +99,21 @@ class CfgEpochClient
#include "CfgEpochClient\Tanoa.hpp"
#include "CfgEpochClient\WorldInteractions.hpp"
};
class CfgEpochSoldier
{
unitTypes[] = {"I_Soldier_EPOCH", "I_Soldier2_EPOCH", "I_Soldier3_EPOCH"};//Selects from randomly
minAISkill = 0.2; //Minumum AI Skill. Skills are chosen randomly between this minimum overall AI skill value and the following max AI skill values, for each of the next skills:
maxAimingAccuracy = 0.7;
maxAimingShake = 0.9;
maxAimingSpeed = 0.6;
maxEndurance = 0.4;
maxSpotDistance = 0.4;
maxSpotTime = 0.3;
maxCourage = 0.3;
maxReloadSpeed = 0.5;
maxCommanding = 0.4;
maxGeneral = 0.4;
};
class CfgEpochSapper
{
detonateDistMax = 8; //Random distance between 3m and this number at which sapper detonates. Min value = 4
@ -119,19 +133,9 @@ class CfgEpochUAV
};
class CfgEpochUAVSupport
{
unitTypes[] = {"I_Soldier_EPOCH", "I_Soldier2_EPOCH", "I_Soldier3_EPOCH"};//Selects from randomly
maxUnitNum = 2; //Maximum number of units spawned when UAV spots target.
minAISkill = 0.2; //Minumum AI Skill. Skills are chosen randomly between this minimum overall AI skill value and the following max AI skill values, for each of the next skills:
maxAimingAccuracy = 0.7;
maxAimingShake = 0.9;
maxAimingSpeed = 0.6;
maxEndurance = 0.4;
maxSpotDistance = 0.4;
maxSpotTime = 0.3;
maxCourage = 0.3;
maxReloadSpeed = 0.5;
maxCommanding = 0.4;
maxGeneral = 0.4;
unitTypes[] = {"I_Soldier_EPOCH"}; //Selects from randomly (e.g. {"I_Soldier_EPOCH","Epoch_Sapper_F","Epoch_SapperB_F","Epoch_SapperG_F"};)
minUnitNum = 2; //Maximum number of units spawned when UAV spots target.
maxUnitNum = 4; //Maximum number of units spawned when UAV spots target.
};
class CfgEpochAirDrop
{