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: Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/EPOCH_supportCopter.sqf 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; [_SpawnTypes select _foreachindex, player, true, _x, _this] call EPOCH_unitSpawn;
} forEach (["CfgEpochClient", "uavAlertUnitSpawnTemplate", ["I_Soldier_EPOCH"]] call EPOCH_fnc_returnConfigEntryV2); } forEach _Spawncounts;

View File

@ -15,14 +15,17 @@
//[[[cog import generate_private_arrays ]]] //[[[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"]; private ["_bomb","_config","_currentLimit","_disableAI","_driver","_grp","_index","_jammerRange","_jammers","_loop","_nonJammer","_nonTrader","_nonTraderAIRange","_restricted","_sapperNum","_spawnLimit","_targetPos","_unit","_units"];
//[[[end]]] //[[[end]]]
params ["_unitClass",["_trgt",player],["_doVariable",false],["_extraData",[]]]; params ["_unitClass",["_trgt",player],["_doVariable",false],["_unitCount",1],["_extraData",[]]];
_bomb = objNull; _bomb = objNull;
// diag_log format["DEBUG: Antagonist %1 Spawning on %2. Do variable: %3.", _unitClass, _trgt, _doVariable]; // 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. if(_doVariable)then{_unitClass call EPOCH_unitSpawnIncrease;};//Assumes Antagonist is required.
_index = EPOCH_spawnIndex find _unitClass; _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]); _currentLimit = count(_trgt nearEntities[_unitClass, 800]);
if (!_doVariable && (_currentLimit >= _spawnLimit)) exitWith { if (!_doVariable && (_currentLimit >= _spawnLimit)) exitWith {
diag_log format["DEBUG: too many %1 exiting unitspawn",_unitClass]; diag_log format["DEBUG: too many %1 exiting unitspawn",_unitClass];
@ -51,14 +54,17 @@ _disableAI = {
_units = []; _units = [];
switch _unitClass do { switch _unitClass do {
case "Epoch_Cloak_F": { case "Epoch_Cloak_F": {
for "_i" from 0 to (_unitCount-1) do {
_unit = createAgent[_unitClass, _targetPos, [], 256, "FORM"]; _unit = createAgent[_unitClass, _targetPos, [], 256, "FORM"];
_units pushBack _unit; _units pushBack _unit;
_unit call _disableAI; _unit call _disableAI;
[_unit,_trgt] execFSM "\x\addons\a3_epoch_code\System\cloak.fsm"; [_unit,_trgt] execFSM "\x\addons\a3_epoch_code\System\cloak.fsm";
}; };
};
case "GreatWhite_F": { case "GreatWhite_F": {
if (surfaceIsWater _targetPos) then{ if (surfaceIsWater _targetPos) then{
if (((_targetPos vectorDiff getPosASL _trgt) select 2) > 25) then{ if (((_targetPos vectorDiff getPosASL _trgt) select 2) > 25) then{
for "_i" from 0 to (_unitCount-1) do {
_unit = createAgent[_unitClass, _targetPos, [], 120, "FORM"]; _unit = createAgent[_unitClass, _targetPos, [], 120, "FORM"];
_units pushBack _unit; _units pushBack _unit;
_unit call _disableAI; _unit call _disableAI;
@ -66,6 +72,7 @@ switch _unitClass do {
}; };
}; };
}; };
};
case "Epoch_Sapper_F": { case "Epoch_Sapper_F": {
if(random 100 < 6 && isNull _trgt)then{ if(random 100 < 6 && isNull _trgt)then{
_config = 'CfgEpochSapper' call EPOCH_returnConfig; _config = 'CfgEpochSapper' call EPOCH_returnConfig;
@ -75,6 +82,7 @@ switch _unitClass do {
}; };
[_trgt,_sapperNum] execVM "epoch_code\compile\EPOCH_callSapperMigration.sqf"; [_trgt,_sapperNum] execVM "epoch_code\compile\EPOCH_callSapperMigration.sqf";
}else{ }else{
for "_i" from 0 to (_unitCount-1) do {
_unit = createAgent[_unitClass, _targetPos, [], 256, "FORM"]; _unit = createAgent[_unitClass, _targetPos, [], 256, "FORM"];
_units pushBack _unit; _units pushBack _unit;
_bomb = createVehicle ["Sapper_Charge_Ammo", _targetPos, [], 0, "CAN_COLLIDE"]; _bomb = createVehicle ["Sapper_Charge_Ammo", _targetPos, [], 0, "CAN_COLLIDE"];
@ -86,7 +94,9 @@ switch _unitClass do {
_unit addEventHandler ["Hit", format ["%1 setFSMVariable [""_sHit"",[_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": { case "Epoch_SapperG_F": {
for "_i" from 0 to (_unitCount-1) do {
_unit = createAgent[_unitClass, _targetPos, [], 256, "FORM"]; _unit = createAgent[_unitClass, _targetPos, [], 256, "FORM"];
_units pushBack _unit; _units pushBack _unit;
_bomb = createVehicle ["SmokeShellCustom", _targetPos, [], 0, "CAN_COLLIDE"]; _bomb = createVehicle ["SmokeShellCustom", _targetPos, [], 0, "CAN_COLLIDE"];
@ -97,7 +107,9 @@ switch _unitClass do {
_unit addEventHandler ["FiredNear", format ["%1 setFSMVariable [""_sFiredNear"",[_this select 1, _this select 2]];",_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]]; _unit addEventHandler ["Hit", format ["%1 setFSMVariable [""_sHit"",[_this select 1, _this select 2]];",_sapperHndl]];
}; };
};
case "Epoch_SapperB_F": { case "Epoch_SapperB_F": {
for "_i" from 0 to (_unitCount-1) do {
_unit = createAgent[_unitClass, _targetPos, [], 256, "FORM"]; _unit = createAgent[_unitClass, _targetPos, [], 256, "FORM"];
_units pushBack _unit; _units pushBack _unit;
_bomb = createVehicle["SapperB_Charge_Ammo", _targetPos, [], 0, "CAN_COLLIDE"]; _bomb = createVehicle["SapperB_Charge_Ammo", _targetPos, [], 0, "CAN_COLLIDE"];
@ -108,7 +120,9 @@ switch _unitClass do {
_unit addEventHandler ["FiredNear", format ["%1 setFSMVariable [""_sFiredNear"",[_this select 1, _this select 2]];",_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]]; _unit addEventHandler ["Hit", format ["%1 setFSMVariable [""_sHit"",[_this select 1, _this select 2]];",_sapperHndl]];
}; };
};
case "I_UAV_01_F": { case "I_UAV_01_F": {
for "_i" from 0 to (_unitCount-1) do {
_targetPos = getPosATL _trgt; _targetPos = getPosATL _trgt;
_targetPos = [_targetPos, 600, 1200, 5, 0, 400, 0] call BIS_fnc_findSafePos; _targetPos = [_targetPos, 600, 1200, 5, 0, 400, 0] call BIS_fnc_findSafePos;
_targetPos set[2, 600]; _targetPos set[2, 600];
@ -122,6 +136,7 @@ switch _unitClass do {
_driver moveInAny _unit; _driver moveInAny _unit;
[_unit, _trgt] execFSM "\x\addons\a3_epoch_code\System\Copter_brain.fsm"; [_unit, _trgt] execFSM "\x\addons\a3_epoch_code\System\Copter_brain.fsm";
}; };
};
case "PHANTOM": { case "PHANTOM": {
[] execFSM "\x\addons\a3_epoch_code\System\Phantom_Brain.fsm"; [] execFSM "\x\addons\a3_epoch_code\System\Phantom_Brain.fsm";
}; };
@ -136,25 +151,24 @@ switch _unitClass do {
}; };
}; };
case "I_Soldier_EPOCH": { case "I_Soldier_EPOCH": {
_extraData params ["_pos","_copter"]; _extraData params [["_pos",getpos player],["_copter",objnull]];
_grp = createGroup RESISTANCE; _grp = createGroup RESISTANCE;
_grp setBehaviour "COMBAT"; _grp setBehaviour "COMBAT";
_grp setCombatMode "RED"; _grp setCombatMode "RED";
_minAISkill = getNumber (getMissionConfig "CfgEpochUAVSupport" >> "minAISkill"); _minAISkill = getNumber (getMissionConfig "CfgEpochSoldier" >> "minAISkill");
_arrUnits = getArray (getMissionConfig "CfgEpochUAVSupport" >> "unitTypes"); _arrUnits = getArray (getMissionConfig "CfgEpochSoldier" >> "unitTypes");
_unitCount = getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxUnitNum");
_arrSkills = ["aimingAccuracy","aimingShake","aimingSpeed","endurance","spotDistance","spotTime","courage","reloadSpeed","commanding","general"]; _arrSkills = ["aimingAccuracy","aimingShake","aimingSpeed","endurance","spotDistance","spotTime","courage","reloadSpeed","commanding","general"];
_arrVals = [ _arrVals = [
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxAimingAccuracy"), getNumber (getMissionConfig "CfgEpochSoldier" >> "maxAimingAccuracy"),
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxAimingShake"), getNumber (getMissionConfig "CfgEpochSoldier" >> "maxAimingShake"),
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxAimingSpeed"), getNumber (getMissionConfig "CfgEpochSoldier" >> "maxAimingSpeed"),
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxEndurance"), getNumber (getMissionConfig "CfgEpochSoldier" >> "maxEndurance"),
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxSpotDistance"), getNumber (getMissionConfig "CfgEpochSoldier" >> "maxSpotDistance"),
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxSpotTime"), getNumber (getMissionConfig "CfgEpochSoldier" >> "maxSpotTime"),
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxCourage"), getNumber (getMissionConfig "CfgEpochSoldier" >> "maxCourage"),
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxReloadSpeed"), getNumber (getMissionConfig "CfgEpochSoldier" >> "maxReloadSpeed"),
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxCommanding"), getNumber (getMissionConfig "CfgEpochSoldier" >> "maxCommanding"),
getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxGeneral") getNumber (getMissionConfig "CfgEpochSoldier" >> "maxGeneral")
]; ];
_units = []; _units = [];
for "_i" from 0 to (_unitCount - 1) do { 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} 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"; 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} 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} 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"}}; 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 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\Tanoa.hpp"
#include "CfgEpochClient\WorldInteractions.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 class CfgEpochSapper
{ {
detonateDistMax = 8; //Random distance between 3m and this number at which sapper detonates. Min value = 4 detonateDistMax = 8; //Random distance between 3m and this number at which sapper detonates. Min value = 4
@ -119,19 +133,9 @@ class CfgEpochUAV
}; };
class CfgEpochUAVSupport class CfgEpochUAVSupport
{ {
unitTypes[] = {"I_Soldier_EPOCH", "I_Soldier2_EPOCH", "I_Soldier3_EPOCH"};//Selects from randomly unitTypes[] = {"I_Soldier_EPOCH"}; //Selects from randomly (e.g. {"I_Soldier_EPOCH","Epoch_Sapper_F","Epoch_SapperB_F","Epoch_SapperG_F"};)
maxUnitNum = 2; //Maximum number of units spawned when UAV spots target. minUnitNum = 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: maxUnitNum = 4; //Maximum number of units spawned when UAV spots target.
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 CfgEpochAirDrop class CfgEpochAirDrop
{ {