{"name":"BIS_fnc_initVehicle","operator":null,"title":"BIS fnc initVehicle","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_initVehicle","revid":363633,"updated":"2024-04-08T21:57:03Z","groups":["Vehicles"],"status":"ok","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":"local","effect":"global","server_exec":false},"exec":null,"description":"This function changes the textures, animation sources and/or mass of a given vehicle.\n\nUnless explicitly mentioned , the function will restore the initial state of every animation sources of the given object (see #Example 3).","syntaxes":[{"syntax":"[vehicle, variant, animations, mass] call BIS_fnc_initVehicle","since":null,"effect":null,"exec":null,"params":[{"name":"vehicle","type":"Object","optional":false,"default":null,"description":"vehicle to customize","types":["Object"],"since":null,"text":"vehicle: Object - vehicle to customize"},{"name":"variant","type":null,"optional":true,"default":"false","description":"Boolean - true to restore default texture source, false to skip texture source change\n- Array - texture sources with their probability in format `[\"textureSource1\", 0.5, \"textureSource2\", 0.5]`\n- String - variant class name - from `configFile >> \"CfgVehicles\"` or `missionConfigFile >> \"CfgVehicleTemplates\"` (see CfgVehicleTemplates)\n- Number - index of the texture source (same as the old system)","types":[],"since":null,"text":"variant: (Optional, default false)\n- Boolean - true to restore default texture source, false to skip texture source change\n- Array - texture sources with their probability in format `[\"textureSource1\", 0.5, \"textureSource2\", 0.5]`\n- String - variant class name - from `configFile >> \"CfgVehicles\"` or `missionConfigFile >> \"CfgVehicleTemplates\"` (see CfgVehicleTemplates)\n- Number - index of the texture source (same as the old system)"},{"name":"animations","type":null,"optional":true,"default":"false","description":"Boolean - true to restore init phase of every animation sources\n- Array - animation sources with their probability in format `[\"animationSource1\", 0.5, \"animationSource2\", 0.5]`\n\n> [!IMPORTANT]\n> If the first element is wrong, it will skip the rest of the animation sources!\n\n- String - variant class name - from `configFile >> \"CfgVehicles\"` or `missionConfigFile >> \"CfgVehicleTemplates\"` (see CfgVehicleTemplates)","types":[],"since":null,"text":"animations: (Optional, default false)\n- Boolean - true to restore init phase of every animation sources\n- Array - animation sources with their probability in format `[\"animationSource1\", 0.5, \"animationSource2\", 0.5]`\n\n> [!IMPORTANT]\n> If the first element is wrong, it will skip the rest of the animation sources!\n\n- String - variant class name - from `configFile >> \"CfgVehicles\"` or `missionConfigFile >> \"CfgVehicleTemplates\"` (see CfgVehicleTemplates)"},{"name":"mass","type":null,"optional":true,"default":"false","description":"Boolean - true to set the default mass, false to disable the mass change\n- Number - mass to remove/add to the vehicle","types":[],"since":null,"text":"mass: (Optional, default false)\n- Boolean - true to set the default mass, false to disable the mass change\n- Number - mass to remove/add to the vehicle"}],"returns":{"type":"Boolean","types":["Boolean"],"description":"function success or not","text":"Boolean - function success or not"}}],"examples":[{"text":"```sqf\nresult = [this, \"\", []] call BIS_fnc_initVehicle;\n```","code":["result = [this, \"\", []] call BIS_fnc_initVehicle;"]},{"text":"```sqf\nresult = [this, [\"MyTextureSource1\", 0.5, \"MyTextureSource2\", 0.6], []] call BIS_fnc_initVehicle;\n```","code":["result = [this, [\"MyTextureSource1\", 0.5, \"MyTextureSource2\", 0.6], []] call BIS_fnc_initVehicle;"]},{"text":"```sqf\nresult = [this, nil, [\"MyAnimationSource1\", 0.5, \"MyAnimationSource2\", 0.7]] call BIS_fnc_initVehicle;\n```","code":["result = [this, nil, [\"MyAnimationSource1\", 0.5, \"MyAnimationSource2\", 0.7]] call BIS_fnc_initVehicle;"]},{"text":"```sqf\n// randomise camo net options with 50% probability\n[vehicle player, false, [\"showcamonethull\", 0.5, \"showcamonetturret\", 0.5, \"showcamonetcannon\", 0.5, \"showslathull\", 0.5]] call BIS_fnc_initVehicle;\n```","code":["// randomise camo net options with 50% probability\n[vehicle player, false, [\"showcamonethull\", 0.5, \"showcamonetturret\", 0.5, \"showcamonetcannon\", 0.5, \"showslathull\", 0.5]] call BIS_fnc_initVehicle;"]},{"text":"```sqf\n// force show all camo net options. Use animationNames to get all available animation sources. Vehicles that don't support certain animations are simply ignored.\n[vehicle player, false, [\"showcamonethull\", 1, \"showcamonetturret\", 1, \"showcamonetcannon\", 1, \"showslathull\", 1]] call BIS_fnc_initVehicle;\n```","code":["// force show all camo net options. Use animationNames to get all available animation sources. Vehicles that don't support certain animations are simply ignored.\n[vehicle player, false, [\"showcamonethull\", 1, \"showcamonetturret\", 1, \"showcamonetcannon\", 1, \"showslathull\", 1]] call BIS_fnc_initVehicle;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["BIS_fnc_saveVehicle","BIS_fnc_loadVehicle","Arma 3: Vehicle Customisation"],"notes":[],"categories":["Arma 3: Functions","Arma 3: New Functions","Function Group: Vehicles","Functions","Functions: Global Effect","Introduced with Arma 3 version 1.42"],"docblock":null,"filled_from_docblock":[]}