Advertisement
Guest User

Untitled

a guest
Apr 25th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. /*
  2. Author: Karel Moricky
  3.  
  4. Description:
  5. Let group members land at the waypoint position
  6.  
  7. Parameters:
  8. 0: GROUP
  9. 1: ARRAY - waypoint position
  10. 2: OBJECT - target to which waypoint is attached to
  11.  
  12. Returns:
  13. BOOL
  14. */
  15.  
  16. private ["_group","_pos","_target","_wp"];
  17. _group = [_this,0,grpnull,[grpnull]] call bis_fnc_param;
  18. _pos = [_this,1,[],[[]],3] call bis_fnc_param;
  19. _target = [_this,2,objnull,[objnull]] call bis_fnc_param;
  20. _wp = [_group,currentwaypoint _group];
  21. _wp setwaypointdescription localize "STR_A3_CfgWaypoints_Land";
  22.  
  23. private ["_vehsMove","_vehsLand"];
  24. _vehsMove = [];
  25. _vehsLand = [];
  26.  
  27. waituntil {
  28. private ["_countReady","_vehsGroup"];
  29. _countReady = 0;
  30. _vehsGroup = [];
  31.  
  32. //--- Check state of group members
  33. {
  34. private ["_veh"];
  35. _veh = vehicle _x;
  36. if (_x == effectivecommander _x) then {
  37. if (!(_veh in _vehsMove)) then {
  38.  
  39. //--- Move to landing position
  40. _veh domove _pos;
  41. _vehsMove set [count _vehsMove,_veh];
  42. } else {
  43. if !(istouchingground _veh) then {
  44. if (unitready _veh && !(_veh in _vehsLand)) then {
  45.  
  46. //--- van 't Land
  47. _veh land "land";
  48. _vehsLand set [count _vehsLand,_veh];
  49. };
  50. } else {
  51. //--- Ready (keep the engine running)
  52. _veh engineon true;
  53. _countReady = _countReady + 1;
  54. };
  55. };
  56. _vehsGroup set [count _vehsGroup,_veh];
  57. };
  58. } foreach units _group;
  59.  
  60. //--- Remove vehicles which are no longer in the group
  61. _vehsMove = _vehsMove - (_vehsMove - _vehsGroup);
  62. _vehsLand = _vehsLand - (_vehsLand - _vehsGroup);
  63.  
  64. sleep 1;
  65. count _vehsGroup == _countReady
  66. };
  67. true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement