Advertisement
zSkullfox

Arma 3 Flyby

Nov 25th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.20 KB | None | 0 0
  1. /*
  2.     Author: Phil
  3.   Steam: https://steamcommunity.com/id/xshiragamix/
  4.  
  5.     Description:
  6.     Random flyby
  7.  
  8.   Note:
  9.   If you using custom code, you need to delete the crew and vehicle by yourself !
  10.  
  11.     Parameter(s):
  12.         0 Optional: Classname of the vehicle or Array of Classnems, crew will be created automaticly
  13.       Recommend to only use planes or helis
  14.  
  15.     1 Optional: Custom center, Type object
  16.  
  17.     3 Custom code passed as array [{1},{2}]
  18.       1) Code on start waypoint
  19.         Access the vehicle with _vehicle = param[0];
  20.       2) Code on end waypoint
  21.         Access the vehicle with _vehicle = param[0];
  22.  
  23.         To only use waypoint end code use [{},{code}]
  24.  
  25. ----------------------------------->
  26.  
  27.     Examples:
  28.  
  29.     o) Basic
  30.  
  31.       []execVM "fox_ambientFlyby.sqf";
  32.  
  33.     o) Advanced
  34.  
  35.       [
  36.         ["C_Heli_Light_01_civil_F","B_Plane_CAS_01_F","O_T_VTOL_02_infantry_F"],
  37.         false,
  38.         [
  39.         {
  40.           _smoke = "SmokeShellGreen" createVehicle [0,0,0];
  41.           _smoke attachTo[_this select 0,[0,0,0]];
  42.         },
  43.         {
  44.           {deleteVehicle _x;} forEach crew (_this select 0);deleteVehicle (_this select 0);
  45.         }
  46.         ]
  47.       ]execVM "fox_ambientFlyby.sqf";
  48.  
  49. ----------------------------------->
  50.  
  51.     You can copy pasta the code below directly in the 3den debug window to test it.
  52.  
  53. */
  54.  
  55. _vehicleClass = param[0,["C_Plane_Civil_01_F","C_Heli_Light_01_civil_F"]];
  56. _objectCenter = param[1,false];
  57. _customCode = param[2,[{},{}]];
  58.  
  59. //if Array is passed select a random one
  60. if(( typeName _vehicleClass ) isEqualTo "ARRAY") then{
  61.   _vehicleClass = _vehicleClass call BIS_fnc_selectRandom;
  62. };
  63.  
  64. _center = getArray(configfile >> "CfgWorlds" >> worldname >> "centerPosition");
  65.  
  66. _mBottomLeft = [0 - 1000,0 - 1000,0];
  67. _mTopLeft = [0 - 1000,( (_center select 0) * 2) - 1000,0];
  68. _mTopRight = [ ( (_center select 0) * 2 ) + 1000,( (_center select 1) * 2 ) + 1000,0];
  69. _mBottomRight = [( (_center select 0) * 2 ) + 1000,0 - 1000,0];
  70.  
  71. _pos1 = [_mBottomLeft,_mTopLeft] call BIS_fnc_selectRandom;
  72. _pos2 = [_center] call BIS_fnc_selectRandom;
  73. _pos3 = [_mTopRight,_mBottomRight] call BIS_fnc_selectRandom;
  74.  
  75. _startPos = [_pos1,_pos3] call BIS_fnc_selectRandom;
  76. _endPos = [_pos1,_pos3] - [_startPos];
  77.  
  78. _veh = createVehicle [_vehicleClass,_startPos, [], 0, "FLY"];
  79. createVehicleCrew _veh;
  80.  
  81. _centerRandom = _center getPos [((_center select 0) / 2) * sqrt random 1, random 360];
  82. _wp1 = (group _veh) addWaypoint [_startPos, 0];
  83.  
  84. if(( typeName _objectCenter ) isEqualTo "OBJECT")then{
  85.   _wp2 = (group _veh) addWaypoint [getPos _objectCenter, 0];
  86. }else{
  87.   _wp2 = (group _veh) addWaypoint [_centerRandom, 0];
  88. };
  89.  
  90. _wp3 = (group _veh) addWaypoint [_endPos select 0, 0];
  91.  
  92. //Default code for waypoints
  93. _waypointStartCode = _customCode param[0,{}];
  94. _waypointEndCode = _customCode param[1,{{deleteVehicle _x;} forEach crew (_this select 0);deleteVehicle (_this select 0);}];
  95.  
  96. if( ( typeName _waypointStartCode ) isEqualTo "CODE")then{
  97.   _wp1 setWaypointStatements ["true",  format["[vehicle this] call %1",_waypointStartCode]];
  98. };
  99. if( ( typeName _waypointEndCode ) isEqualTo "CODE")then{
  100.   _wp3 setWaypointStatements ["true",  format["[vehicle this] call %1",_waypointEndCode]];
  101. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement