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:
|
2016-06-13 16:54:19 +00:00
|
|
|
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/EPOCH_supportCopter.sqf
|
2015-12-07 16:24:52 +00:00
|
|
|
*/
|
2017-05-02 13:28:52 +00:00
|
|
|
//[[[cog import generate_private_arrays ]]]
|
|
|
|
private ["_SpawnTypes","_Spawncounts","_UnitType","_arrUnits","_idx","_maxunitCount","_minunitCount","_unitCount"];
|
|
|
|
//[[[end]]]
|
2017-03-02 16:57:41 +00:00
|
|
|
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 {
|
2017-03-02 17:12:35 +00:00
|
|
|
_Spawncounts set [_idx,(_Spawncounts select _idx)+ 1];
|
2017-03-02 16:57:41 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2017-03-01 23:16:06 +00:00
|
|
|
{
|
2017-03-02 16:57:41 +00:00
|
|
|
[_SpawnTypes select _foreachindex, player, true, _x, _this] call EPOCH_unitSpawn;
|
|
|
|
} forEach _Spawncounts;
|