Advertisement
Guest User

EPOCH_supportCopter.sqf

a guest
Feb 27th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.82 KB | None | 0 0
  1. /*
  2. Author: Andrew Gregory - EpochMod.com
  3.  
  4. Contributors: Aaron Clark
  5.  
  6. Description:
  7. Spawn drone function
  8.  
  9. Licence:
  10. Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
  11.  
  12. Github:
  13. https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/EPOCH_supportCopter.sqf
  14. */
  15. //[[[cog import generate_private_arrays ]]]
  16. private ["_aiskill","_arrSkills","_arrUnits","_arrVals","_grp","_minAISkill","_player","_unit","_unitCount","_units"];
  17. //[[[end]]]
  18. params ["_pos","_copter"];
  19.  
  20. _player = player; //need to check on change owner
  21. _unit = objNull;
  22.  
  23. _grp = createGroup RESISTANCE;
  24. _grp setBehaviour "COMBAT";
  25. _grp setCombatMode "RED";
  26.  
  27. _minAISkill = getNumber (getMissionConfig "CfgEpochUAVSupport" >> "minAISkill");
  28. _arrUnits = getArray (getMissionConfig "CfgEpochUAVSupport" >> "unitTypes");
  29. _unitCount = getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxUnitNum");
  30. _arrSkills = ["aimingAccuracy","aimingShake","aimingSpeed","endurance","spotDistance","spotTime","courage","reloadSpeed","commanding","general"];
  31. _arrVals = [
  32. getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxAimingAccuracy"),
  33. getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxAimingShake"),
  34. getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxAimingSpeed"),
  35. getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxEndurance"),
  36. getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxSpotDistance"),
  37. getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxSpotTime"),
  38. getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxCourage"),
  39. getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxReloadSpeed"),
  40. getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxCommanding"),
  41. getNumber (getMissionConfig "CfgEpochUAVSupport" >> "maxGeneral")
  42. ];
  43. _units = [];
  44. for "_i" from 0 to (_unitCount - 1) do {
  45.  
  46. _unitclass = selectRandom _arrUnits;
  47. if (_unitclass in ["Epoch_Sapper_F","Epoch_SapperB_F"]) then {
  48. [_unitClass,player] call EPOCH_unitSpawn;
  49. }
  50. else {
  51. _unit = _grp createUnit[_unitclass, _pos, [], 0, "FORM"];
  52. _units pushBack _unit;
  53.  
  54. //_unit setSkill 0.6;
  55. _unit setRank "Private";
  56.  
  57. _unit enableAI "TARGET";
  58. _unit enableAI "AUTOTARGET";
  59. _unit enableAI "MOVE";
  60. _unit enableAI "ANIM";
  61. _unit disableAI "FSM";
  62.  
  63. for "_i" from 0 to ((count _arrSkills)-1) do {
  64. _aiskill = floor random (_arrVals select _i);
  65. if (_aiskill<_minAISkill) then {_aiskill=_minAISkill};
  66. _unit setSkill [_arrSkills select _i,_arrVals select _i];
  67. };
  68.  
  69. if ((count _units) == 1) then {
  70. _grp selectLeader _unit;
  71. [_pos,_copter,_player,_unit] execFSM "\x\addons\a3_epoch_code\System\Group_Leader_Brain.fsm";
  72. };
  73. };
  74. };
  75.  
  76. // cleanup units or (transfer ownership) if player logs out
  77. _units remoteExec ["EPOCH_localCleanup",2];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement