Advertisement
icdb

[ArmA3] mp garage (Might be outdated?)

Nov 10th, 2017
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 1.64 KB | None | 0 0
  1. //how to call it
  2. [for who it is supposed to open, where the garage is supposed to be] call bis_fnc_garageNew;
  3.  
  4. //example usage (adds the Virtual Garage as an interaction to an object)
  5. this addaction ["Open Virtual Garage", {[_this select 1, getPos spawn_pad_1] call BIS_fnc_garageNew;}];
  6. //(spawn_pad_1 is the variable name of a helipad)
  7.  
  8. //put this into init.sqf
  9. bis_fnc_garageNew = {
  10.     _caller = _this select 0;
  11.     _pos = _this select 1;  
  12.    
  13.     //Deletes all vehicle in a 15 meter radius of the spawn location
  14.     {deleteVehicle _x;}foreach nearestObjects [_pos, ["AllVehicles"], 15];
  15.     sleep(0.1);
  16.     //Creates a temporary invisible helipad on the location of the _pos marker
  17.     BIS_fnc_garage_center = createVehicle [ "Land_HelipadEmpty_F", _pos, [], 0, "CAN_COLLIDE" ];  
  18.     //Opens the garage
  19.     [ "Open", true ] call BIS_fnc_garage;  
  20.     sleep(2);
  21.    
  22.     //Wait until garage is closed
  23.     waitUntil{isNull (uinamespace getvariable ["BIS_fnc_arsenal_cam",objnull])};
  24.     sleep(0.1);
  25.     //Teleport _caller into driver of newly spawned (local) vehicle
  26.     {_caller moveInDriver _x}foreach nearestObjects [_pos, ["AllVehicles"], 10];
  27.    
  28.     //Spawns the new vehicle
  29.     [_caller, _pos] spawn {
  30.         _caller = _this select 0;
  31.         _pos = _this select 1;  
  32.         //Wait until _caller is inside a vehicle
  33.         waitUntil{(vehicle _caller) != _caller};
  34.         //Figure out which type of (local) vehicle was spawned
  35.         _vehType = typeOf Vehicle _caller;
  36.         //Delete old (local) vehicle
  37.         deleteVehicle (Vehicle _caller);
  38.         sleep 0.1;
  39.         //Spawn the new (global) vehicle
  40.         _veh = createVehicle [_vehType, _pos, [], 0, "CAN_COLLIDE"];
  41.         //Teleport _caller into driver
  42.         _caller moveInDriver _veh;
  43.     };
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement