Advertisement
Guest User

Untitled

a guest
Sep 24th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. params[
  2. '_ZCP_CDG_spawnAIPos',
  3. '_ZCP_CDG_unitsPerGroup',
  4. '_ZCP_CDG_dificulty',
  5. '_ZCP_CDG_solierType',
  6. '_ZCP_CDG_side',
  7. '_ZCP_CDG_minLaunchers',
  8. '_ZCP_CDG_maxLaunchers',
  9. '_ZCP_CDG_radius'
  10. ];
  11.  
  12. diag_log text format['ZCP: Spawning %1 AI for cappoint.', _ZCP_CDG_unitsPerGroup];
  13.  
  14. private _ZCP_CDG_dummyGroup = createGroup _ZCP_CDG_side;
  15.  
  16. for "_i" from 1 to _ZCP_CDG_unitsPerGroup do {
  17. private _ZCP_unit = [_ZCP_CDG_dummyGroup, _ZCP_CDG_spawnAIPos, _ZCP_CDG_dificulty, _ZCP_CDG_solierType, _ZCP_CDG_radius] call ZCP_fnc_createDMSSoldier;
  18. };
  19.  
  20. sleep 0.2;
  21.  
  22. private _ZCP_CDG_groupAI = createGroup _ZCP_CDG_side;
  23.  
  24. {
  25. [_x] joinSilent _ZCP_CDG_groupAI;
  26. }count (units _ZCP_CDG_dummyGroup);
  27.  
  28. sleep 0.2;
  29.  
  30. // An AI will definitely spawn with a launcher if you define type
  31. if (_ZCP_CDG_minLaunchers >= 0 && _ZCP_CDG_maxLaunchers > 0 && _ZCP_CDG_maxLaunchers >= _ZCP_CDG_minLaunchers) then
  32. {
  33. private _ZCP_CDG_launcherType = "AT";
  34.  
  35. _ZCP_CDG_units = units _ZCP_CDG_groupAI;
  36.  
  37. for "_i" from 0 to (((_ZCP_CDG_maxLaunchers min _ZCP_CDG_unitsPerGroup)-1) max 0) do
  38. {
  39. if ( _i < _ZCP_CDG_minLaunchers || ((random 100) < ZCP_AI_useLaunchersChance)) then
  40. {
  41. private _ZCP_CDG_unit = _ZCP_CDG_units select _i;
  42.  
  43. private _ZCP_CDG_launcher = (selectRandom (missionNamespace getVariable [format ["DMS_AI_wep_launchers_%1",_ZCP_CDG_launcherType],["launch_NLAW_F"]]));
  44.  
  45. if(!isNil '_ZCP_CDG_unit') then {
  46. removeBackpackGlobal _ZCP_CDG_unit;
  47. _ZCP_CDG_unit addBackpack "B_Carryall_mcamo";
  48. private _ZCP_CDG_rocket = _ZCP_CDG_launcher call DMS_fnc_selectMagazine;
  49.  
  50. [_ZCP_CDG_unit, _ZCP_CDG_launcher, DMS_AI_launcher_ammo_count,_ZCP_CDG_rocket] call BIS_fnc_addWeapon;
  51.  
  52. _ZCP_CDG_unit setVariable ["DMS_AI_Launcher",_ZCP_CDG_launcher];
  53. };
  54.  
  55. //(format["SpawnAIGroup :: Giving %1 a %2 launcher with %3 %4 rockets",_ZCP_CDG_unit,_ZCP_CDG_launcher,DMS_AI_launcher_ammo_count,_ZCP_CDG_rocket]) call DMS_fnc_DebugLog;
  56. };
  57. };
  58. };
  59.  
  60. {
  61. _x allowDamage true;
  62. _x enableAI "AUTOTARGET";
  63. _x enableAI "TARGET";
  64. _x enableAI "MOVE";
  65. }count (units _ZCP_CDG_groupAI);
  66.  
  67. _ZCP_CDG_groupAI selectLeader ((units _ZCP_CDG_groupAI) select 0);
  68.  
  69. _ZCP_CDG_groupAI setVariable ["DMS_LockLocality", nil];
  70. _ZCP_CDG_groupAI setVariable ["DMS_SpawnedGroup", true];
  71. _ZCP_CDG_groupAI setVariable ["DMS_Group_Side", toUpper format["%1",_ZCP_CDG_side]];
  72.  
  73. deleteGroup _ZCP_CDG_dummyGroup;
  74.  
  75. _ZCP_CDG_groupAI
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement