BIS fnc initVehicle: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[[cC]ategory:[fF]unctions\|\{\{uc:[a-z A-Z_]*\}\}\]\]" to "")
m (Text replacement - "[[Arma 3: Vehicle Customization" to "[[Arma 3: Vehicle Customisation")
 
(24 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{RV|type=function
{{RV|type=function


| arma3
|game1= arma3
 
|version1= 1.42
|1.42


|arg= local
|arg= local
Line 9: Line 8:
|eff= global
|eff= global


|gr1 = Vehicles
|gr1= Vehicles


| This function changes the textures, animation sources and/or mass of a given vehicle.
|descr= This function changes the textures, animation sources and/or mass of a given vehicle.<br>
* Unless explicitly mentioned , the function will restore the initial state of every animation sources of the given object ('''Example 3''').  
Unless explicitly mentioned , the function will restore the initial state of every animation sources of the given object (see {{Link|#Example 3}}).


| [vehicle, variant, animations, mass] call [[BIS_fnc_initVehicle]]
|s1= [vehicle, variant, animations, mass] call [[BIS_fnc_initVehicle]]


|p1= vehicle: [[Object]] - vehicle to customize
|p1= vehicle: [[Object]] - vehicle to customize
Line 20: Line 19:
|p2= variant: (Optional, default [[false]])
|p2= variant: (Optional, default [[false]])
* [[Boolean]] - [[true]] to restore default texture source, [[false]] to skip texture source change
* [[Boolean]] - [[true]] to restore default texture source, [[false]] to skip texture source change
* [[Array]] - Array of texture sources with their probability, to format {{Inline code|["textureSource1", 0.5, "textureSource2", 0.5]}}
* [[Array]] - texture sources with their probability in format <sqf inline>["textureSource1", 0.5, "textureSource2", 0.5]</sqf>
* [[String]] - Variant class name - from the <tt>[[configFile]] >> [[CfgVehicles]]</tt> or from the <tt>[[missionConfigFile]] >> [[Description.ext#CfgVehicleTemplates|CfgVehicleTemplates]]</tt>
* [[String]] - variant class name - from <sqf inline>configFile >> "CfgVehicles"</sqf> or <sqf inline>missionConfigFile >> "CfgVehicleTemplates"</sqf> (see [[Description.ext#CfgVehicleTemplates|CfgVehicleTemplates]])
* [[Number]] - index of the texture source (same as the old system)
* [[Number]] - index of the texture source (same as the old system)


|p3= animations: (Optional, default [[false]])
|p3= animations: (Optional, default [[false]])
* [[Boolean]] - [[true]] to restore init phase of every animation sources
* [[Boolean]] - [[true]] to restore init phase of every animation sources
* [[Array]] - Array of animation sources with their probability, to format {{Inline code|["animationSource1", 0.5, "animationSource2", 0.5]}}
* [[Array]] - animation sources with their probability in format <sqf inline>["animationSource1", 0.5, "animationSource2", 0.5]</sqf>{{Feature|important|
{{Important|If the first element is wrong, it will skip the rest of the animation sources!}}
If the first element is wrong, it will skip the rest of the animation sources!}}
* [[String]] - variant class name - from the <tt>[[configFile]] >> [[CfgVehicles]]</tt> or from the <tt>[[missionConfigFile]] >> [[Description.ext#CfgVehicleTemplates|CfgVehicleTemplates]]</tt>
* [[String]] - variant class name - from <sqf inline>configFile >> "CfgVehicles"</sqf> or <sqf inline>missionConfigFile >> "CfgVehicleTemplates"</sqf> (see [[Description.ext#CfgVehicleTemplates|CfgVehicleTemplates]])


|p4= mass: (Optional, default [[false]])
|p4= mass: (Optional, default [[false]])
Line 34: Line 33:
* [[Number]] - mass to remove/add to the vehicle
* [[Number]] - mass to remove/add to the vehicle


| [[Boolean]] - function success or not
|r1= [[Boolean]] - function success or not


|x1= <code>result = [<nowiki/>[[this]], "", []] [[call]] [[BIS_fnc_initVehicle]];</code>
|x1= <sqf>result = [this, "", []] call BIS_fnc_initVehicle;</sqf>


|x2= <code>result = [<nowiki/>[[this]], ["MyTextureSource1", 0.5, "MyTextureSource2", 0.6], []] [[call]] [[BIS_fnc_initVehicle]];</code>
|x2= <sqf>result = [this, ["MyTextureSource1", 0.5, "MyTextureSource2", 0.6], []] call BIS_fnc_initVehicle;</sqf>


|x3= <code>result = [<nowiki/>[[this]], [[nil]], ["MyAnimationSource1", 0.5, "MyAnimationSource2", 0.7]] [[call]] [[BIS_fnc_initVehicle]];</code>
|x3= <sqf>result = [this, nil, ["MyAnimationSource1", 0.5, "MyAnimationSource2", 0.7]] call BIS_fnc_initVehicle;</sqf>


|x4= <code>{{cc|Randomise camo net options with 50% probability}}
|x4= <sqf>
<nowiki>[</nowiki>[[vehicle]] [[player]], [[false]], ["showcamonethull", 0.5, "showcamonetturret", 0.5, "showcamonetcannon", 0.5, "showslathull", 0.5]] [[call]] [[BIS_fnc_initVehicle]];</code>
// randomise camo net options with 50% probability
| [[Arma 3 Vehicle Customization]] [[Description.ext#CfgVehicleTemplates|CfgVehicleTemplates]] [[Description.ext#disableRandomization|disableRandomization]] [http://dev.arma3.com/post/oprep-vehicle-customization OPREP]
[vehicle player, false, ["showcamonethull", 0.5, "showcamonetturret", 0.5, "showcamonetcannon", 0.5, "showslathull", 0.5]] call BIS_fnc_initVehicle;
</sqf>


|x6= <code>{{cc|Force show all camo net options. Use [[animationNames]] to get all available animation sources. Vehicles that don't support certain animations are simply ignored.}}
|x6= <sqf>
<nowiki>[</nowiki>[[vehicle]] [[player]], [[false]], ["showcamonethull", 1, "showcamonetturret", 1, "showcamonetcannon", 1, "showslathull", 1]] [[call]] [[BIS_fnc_initVehicle]];
// force show all camo net options. Use animationNames to get all available animation sources. Vehicles that don't support certain animations are simply ignored.
</code>
[vehicle player, false, ["showcamonethull", 1, "showcamonetturret", 1, "showcamonetcannon", 1, "showslathull", 1]] call BIS_fnc_initVehicle;
</sqf>


|seealso= [[BIS_fnc_saveVehicle]] [[BIS_fnc_loadVehicle]] [[Arma 3: Vehicle Customisation]]
}}
}}
[[Category:{{Name|arma3}}: Functions|{{uc:initVehicle}}]]

Latest revision as of 22:57, 8 April 2024

Hover & click on the images for description

Description

Description:
This function changes the textures, animation sources and/or mass of a given vehicle.
Unless explicitly mentioned , the function will restore the initial state of every animation sources of the given object (see Example 3).
Execution:
call
Groups:
Vehicles

Syntax

Syntax:
[vehicle, variant, animations, mass] call BIS_fnc_initVehicle
Parameters:
vehicle: Object - vehicle to customize
variant: (Optional, default false)
animations: (Optional, default false)
  • Boolean - true to restore init phase of every animation sources
  • Array - animation sources with their probability in format ["animationSource1", 0.5, "animationSource2", 0.5]
    If the first element is wrong, it will skip the rest of the animation sources!
  • String - variant class name - from configFile >> "CfgVehicles" or missionConfigFile >> "CfgVehicleTemplates" (see CfgVehicleTemplates)
mass: (Optional, default false)
  • Boolean - true to set the default mass, false to disable the mass change
  • Number - mass to remove/add to the vehicle
Return Value:
Boolean - function success or not

Examples

Example 1:
result = [this, "", []] call BIS_fnc_initVehicle;
Example 2:
result = [this, ["MyTextureSource1", 0.5, "MyTextureSource2", 0.6], []] call BIS_fnc_initVehicle;
Example 3:
result = [this, nil, ["MyAnimationSource1", 0.5, "MyAnimationSource2", 0.7]] call BIS_fnc_initVehicle;
Example 4:
// randomise camo net options with 50% probability [vehicle player, false, ["showcamonethull", 0.5, "showcamonetturret", 0.5, "showcamonetcannon", 0.5, "showslathull", 0.5]] call BIS_fnc_initVehicle;
Example 6:
// force show all camo net options. Use animationNames to get all available animation sources. Vehicles that don't support certain animations are simply ignored. [vehicle player, false, ["showcamonethull", 1, "showcamonetturret", 1, "showcamonetcannon", 1, "showslathull", 1]] call BIS_fnc_initVehicle;

Additional Information

See also:
BIS_fnc_saveVehicle BIS_fnc_loadVehicle Arma 3: Vehicle Customisation

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note