2015-12-07 16:24:52 +00:00
|
|
|
/*
|
|
|
|
Author: Andrew Gregory - EpochMod.com
|
|
|
|
|
|
|
|
Contributors: Aaron Clark
|
|
|
|
|
|
|
|
Description:
|
|
|
|
Spawn drone function
|
|
|
|
|
|
|
|
Licence:
|
|
|
|
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
|
|
|
|
|
|
|
|
Github:
|
|
|
|
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_code/compile/EPOCH_supportCopter.sqf
|
|
|
|
*/
|
2016-04-08 20:21:46 +00:00
|
|
|
private ["_aiskill","_unit","_player","_grp","_arrUnits","_arrSkills","_units"];
|
|
|
|
params ["_pos","_copter"];
|
|
|
|
|
|
|
|
_player = player; //need to check on change owner
|
2015-09-14 20:55:36 +00:00
|
|
|
_unit = objNull;
|
|
|
|
|
|
|
|
_grp = createGroup RESISTANCE;
|
|
|
|
_grp setBehaviour "COMBAT";
|
|
|
|
_grp setCombatMode "RED";
|
2016-04-08 20:21:46 +00:00
|
|
|
|
2016-04-25 12:38:16 +00:00
|
|
|
_minAISkill = getNumber (getMissionConfig "CfgEpochUAVSupport" >> "minAISkill");
|
|
|
|
_arrUnits = getArray (getMissionConfig "CfgEpochUAVSupport" >> "unitTypes");
|
|
|
|
_unitCount = getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxUnitNum");
|
2015-09-14 20:55:36 +00:00
|
|
|
_arrSkills = ["aimingAccuracy","aimingShake","aimingSpeed","endurance","spotDistance","spotTime","courage","reloadSpeed","commanding","general"];
|
2016-04-25 12:38:16 +00:00
|
|
|
_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")
|
|
|
|
];
|
2015-09-14 20:55:36 +00:00
|
|
|
_units = [];
|
2016-04-25 12:38:16 +00:00
|
|
|
for "_i" from 0 to (_unitCount - 1) do {
|
2015-09-14 20:55:36 +00:00
|
|
|
|
2016-04-26 02:26:30 +00:00
|
|
|
_unit = _grp createUnit[selectRandom _arrUnits, _pos, [], 0, "FORM"];
|
2015-09-14 20:55:36 +00:00
|
|
|
_units pushBack _unit;
|
|
|
|
|
2016-04-25 12:38:16 +00:00
|
|
|
//_unit setSkill 0.6;
|
2015-09-14 20:55:36 +00:00
|
|
|
_unit setRank "Private";
|
|
|
|
|
|
|
|
_unit enableAI "TARGET";
|
|
|
|
_unit enableAI "AUTOTARGET";
|
|
|
|
_unit enableAI "MOVE";
|
|
|
|
_unit enableAI "ANIM";
|
|
|
|
_unit disableAI "FSM";
|
|
|
|
|
|
|
|
for "_i" from 0 to ((count _arrSkills)-1) do {
|
2016-04-25 12:38:16 +00:00
|
|
|
_aiskill = floor random (_arrVals select _i);
|
|
|
|
if (_aiskill<_minAISkill) then {_aiskill=_minAISkill};
|
|
|
|
_unit setSkill [_arrSkills select _i,_arrVals select _i];
|
2015-09-14 20:55:36 +00:00
|
|
|
};
|
2016-04-08 20:21:46 +00:00
|
|
|
|
2015-09-14 20:55:36 +00:00
|
|
|
if (_i == 0) then {
|
|
|
|
_grp selectLeader _unit;
|
2016-04-08 20:21:46 +00:00
|
|
|
[_pos,_copter,_player,_unit] execFSM "\x\addons\a3_epoch_code\System\Group_Leader_Brain.fsm";
|
2015-09-14 20:55:36 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// cleanup units or (transfer ownership) if player logs out
|
2015-12-28 16:31:54 +00:00
|
|
|
_units remoteExec ["EPOCH_localCleanup",2];
|