Advertisement
Guest User

Untitled

a guest
May 20th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.09 KB | None | 0 0
  1. // F3 - Mission Maker Teleport
  2. // Credits: Please see the F3 online manual http://www.ferstaberinde.com/f3/en/
  3. // ====================================================================================
  4.  
  5. // DECLARE VARIABLES AND FUNCTIONS
  6.  
  7. private ["_textSelect","_textDone"];
  8.  
  9. // ====================================================================================
  10.  
  11. // SET KEY VARIABLES
  12.  
  13. f_telePositionSelected = false;
  14. if (isNil "f_var_mapClickTeleport_Used") then {f_var_mapClickTeleport_Used = 0};
  15.  
  16. // ====================================================================================
  17.  
  18. // TELEPORT FUNCTIONALITY
  19. // Open the map for the player and display a notification, then set either the player's vehicle
  20. // or the unit to the new position. If the group needs to be teleported too, set the group's position
  21. // as well.
  22.  
  23. player groupChat format["Click a location on the map to %1.", (if (f_var_mapClickTeleport_Height == 0) then {"Fast Travel"} else {"HALO Drop"})];
  24. openMap [true, false];
  25. onMapSingleClick "f_var_mapClickTeleport_telePos = _pos; f_telePositionSelected = true";
  26. waitUntil {sleep 0.1;f_telePositionSelected;};
  27.  
  28. // HALO - set height
  29. if (f_var_mapClickTeleport_Height > 0) then {
  30. f_var_mapClickTeleport_telePos = [f_var_mapClickTeleport_telePos select 0,f_var_mapClickTeleport_telePos select 1,f_var_mapClickTeleport_Height];
  31. };
  32.  
  33. // Move player
  34. // If the player is in a vehicle and not HALO-ing, the complete vehicle is moved. Otherwise the player is teleported.
  35. if (vehicle player != player && f_var_mapClickTeleport_Height == 0) then {
  36. (vehicle player) setPos (f_var_mapClickTeleport_telePos findEmptyPosition [0,150,typeOf (vehicle player)]);
  37. } else {
  38. player setPos f_var_mapClickTeleport_telePos;
  39. };
  40.  
  41. if (f_var_mapClickTeleport_Height > 0) then {
  42. cutText ["", "BLACK FADED",999];
  43. [player] spawn f_fnc_mapClickHaloEffect;
  44. };
  45.  
  46. // Move group
  47. // If enabled, the player's group is moved next to him
  48.  
  49. if (f_var_mapClickTeleport_GroupTeleport) then {
  50. sleep 0.1;
  51. {
  52. [_x,f_var_mapClickTeleport_telePos] remoteExec ["f_fnc_mapClickTeleportGroup",_x];
  53. } forEach ((units group player) - [player]);
  54. };
  55.  
  56. openMap false;
  57.  
  58. // ====================================================================================
  59.  
  60. // REMOVE AND READ ACTION
  61. // Remove the action and re-add if we have uses left (or if they are infinite)
  62.  
  63. if (isClass(configFile >> "CfgPatches" >> "ace_main")) then {
  64. [player, 1, ["ACE_SelfActions","ACE_TeamManagement","PAR"]] call ace_interact_menu_fnc_removeActionFromObject;
  65. } else {
  66. player removeAction f_mapClickTeleportAction;
  67. };
  68.  
  69. f_var_mapClickTeleport_Used = f_var_mapClickTeleport_Used + 1;
  70.  
  71. if (f_var_mapClickTeleport_Uses == 0 || f_var_mapClickTeleport_Used < f_var_mapClickTeleport_Uses) then {
  72. if (isClass(configFile >> "CfgPatches" >> "ace_main")) then {
  73. [player, 1, ["ACE_SelfActions","ACE_TeamManagement"], ace_par_action] call ace_interact_menu_fnc_addActionToObject;
  74. } else {
  75. f_mapClickTeleportAction = player addAction [f_var_mapClickTeleport_textAction,{[] spawn f_fnc_mapClickTeleportUnit},"", 0, false,true,"","_this == player"];
  76. };
  77. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement