{"name":"BIS_fnc_garage","operator":null,"title":"BIS fnc garage","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_garage","revid":349504,"updated":"2023-11-08T17:09:12Z","groups":["Vehicles","Broken Functions"],"status":"broken","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.42"}],"since":{"game":"arma3","name":"Arma 3","version":"1.42"},"arma3_since":"1.42","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Splendid™ Virtual Arsenal Garage.","syntaxes":[{"syntax":"[mode, params] call BIS_fnc_garage","since":null,"effect":null,"exec":null,"params":[{"name":"mode","type":"String","optional":true,"default":"\"Open\"","description":"**case-sensitive**. Can be \"Open\"; other cases are for internal use","types":["String"],"since":null,"text":"mode: String - (Optional, default \"Open\") **case-sensitive**. Can be \"Open\"; other cases are for internal use"},{"name":"params","type":"Anything","optional":true,"default":"`[]`","description":"depending on *mode*, can be:\n- \"Open\": [fullGarage, garageCentre]\n  - fullGarage: Boolean - (Optional, default false)\n  - garageCentre: Object - (Optional, default objNull) the garage centre as vehicle; will be deleted on opening","types":["Anything"],"since":null,"text":"params: Anything - (Optional, default `[]`) depending on *mode*, can be:\n- \"Open\": [fullGarage, garageCentre]\n  - fullGarage: Boolean - (Optional, default false)\n  - garageCentre: Object - (Optional, default objNull) the garage centre as vehicle; will be deleted on opening"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"}}],"examples":[{"text":"```sqf\n[] call BIS_fnc_garage;\n```","code":["[] call BIS_fnc_garage;"]},{"text":"```sqf\nplayer addAction [\"Open Garage\", {\n\n     // create a position 30 meters infront of the player\n    _pos = player getPos [30,getDir player];\n\n    // create empty helipad at the position and save it in the global variable BIS_fnc_garage_center\n    BIS_fnc_garage_center = createVehicle [\"Land_HelipadEmpty_F\", _pos, [], 0, \"CAN_COLLIDE\"];\n\n    [\"Open\", true] call BIS_fnc_garage;\n}];\n```","code":["player addAction [\"Open Garage\", {\n\n \t// create a position 30 meters infront of the player\n\t_pos = player getPos [30,getDir player];\n\n\t// create empty helipad at the position and save it in the global variable BIS_fnc_garage_center\n\tBIS_fnc_garage_center = createVehicle [\"Land_HelipadEmpty_F\", _pos, [], 0, \"CAN_COLLIDE\"];\n\n\t[\"Open\", true] call BIS_fnc_garage;\n}];"]},{"text":"```sqf\nplayer addAction [\"Open Garage\", {\n\n     // create a position 30 meters infront of the player\n    _pos = player getPos [30, getDir player];\n\n    // create empty helipad at the position\n    _vehicle = createVehicle [\"Land_HelipadEmpty_F\", _pos, [], 0, \"CAN_COLLIDE\"];\n\n    // pass created vehicle to function for use as position\n    [\"Open\", [true, _vehicle]] call BIS_fnc_garage;\n}];\n```","code":["player addAction [\"Open Garage\", {\n\n \t// create a position 30 meters infront of the player\n\t_pos = player getPos [30, getDir player];\n\n\t// create empty helipad at the position\n\t_vehicle = createVehicle [\"Land_HelipadEmpty_F\", _pos, [], 0, \"CAN_COLLIDE\"];\n\n\t// pass created vehicle to function for use as position\n\t[\"Open\", [true, _vehicle]] call BIS_fnc_garage;\n}];"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["BIS_fnc_arsenal","Arsenal"],"notes":[{"user":"Larrow","date":"2015-05-31T07:09:00Z","text":"Available namespace variables\n\n```sqf\nmissionNamespace\n    BIS_fnc_arsenal_center            // copy of BIS_fnc_garage_center\n    BIS_fnc_arsenal_fullGarage        // holds param 1 of \"open\" statement\n    BIS_fnc_arsenal_group            // Group spawned vehicle is created in, default players group\n    BIS_fnc_arsenal_type            // --- 0 - Arsenal, 1 - Garage\n    BIS_fnc_garage_center            // Hold a reference to an OBJECT of where to spawn selected garage vehicle\n    BIS_fnc_garage_centerType        // ? // default selected vehicle model from config\n    BIS_fnc_garage_data                // Array of vehicles for garage tabs - see below\n    BIS_fnc_garage_turretPaths        // ? // []\n\nuiNamespace\n    BIS_fnc_arsenal_cam                // null if arsenal is not open else holds reference to arsenal display\n    BIS_fnc_arsenal_toggleSpace        // ?\n    BIS_fnc_garage_defaultClass        // Default class to display\n    BIS_fnc_garage_stats            // min and max values of config [\"maxspeed\",\"armor\",\"fuelcapacity\",\"threat\"] of cfgVehicles >> crew\n```\n\nAvailable scripted eventHandlers\n\n```sqf\n// [namespace event is stored in, event name, passed variables]\n[missionNamespace, \"garageOpened\", [_display, _toggleSpace]]\n[missionNamespace, \"garageClosed\", [displayNull, uiNamespace getVariable [\"BIS_fnc_arsenal_toggleSpace\", false]]]\n```\n\nStructure of BIS_fnc_garage_data\n\n```sqf\nBIS_fnc_garage_data = [\n    // CARS\n    [\n        //model\n        \"\\a3\\soft_f\\offroad_01\\offroad_01_unarmed_f\",\n        // config paths of classes that use above model\n        [\n            config.bin/CfgVehicles/C_Offroad_01_F,\n            config.bin/CfgVehicles/B_G_Offroad_01_F\n        ],\n        \"\\a3\\soft_f\\mrap_02\\mrap_02_gmg_f\",\n        [\n            config.bin/CfgVehicles/O_MRAP_02_gmg_F\n        ]\n    ],\n    [],        // ARMOR\n    [],        // HELIS\n    [],        // PLANES\n    [],        // NAVAL\n    []        // STATICS\n]\n```"},{"user":".kju","date":"2018-05-01T14:40:00Z","text":"The above overview isn't fully correct:\n\n1. BIS_fnc_garage_centerType returns by default the model path of the \"default class\" \n\n```sqf\ngetText (configFile >> \"cfgvehicles\" >> _classDefault >> \"model\")\n```\n\n yet once a vehicle is selected it returns its class name.\n1. BIS_fnc_garage_center returns by default the player reference, yet otherwise the created vehicle object"}],"categories":["Arma 3: Functions","Arma 3: New Functions","Function Group: Broken Functions","Function Group: Vehicles","Functions","Introduced with Arma 3 version 1.42"],"docblock":null,"filled_from_docblock":[]}