BIS fnc initVehicle: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " <h3 style="display:none">Notes</h3> <dl class="command_description"> <!-- Note Section BEGIN --> <!-- Note Section END --> </dl>" to "")
m (Text replacement - " *\| *([Cc]omments|COMMENTS|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments \("local" or "global"\)|Multiplayer Effects \("local" or "global"\)|Multiplayer Execution \("server" o...)
Line 1: Line 1:
{{Function|Comments=
{{Function


| arma3 |Game name=
| arma3


|1.42|Game version=
|1.42


|arg= local |Argument=
|arg= local |Argument=
Line 9: Line 9:
|eff= global |Effect=
|eff= global |Effect=


|gr1 = Vehicles |GROUP1=
|gr1 = Vehicles


| This function changes the textures, animation sources and/or mass of a given vehicle.<br>
| This function changes the textures, animation sources and/or mass of a given vehicle.<br>
Line 60: Line 60:
result = [this, true, true, true] call bis_fnc_initVehicle;
result = [this, true, true, true] call bis_fnc_initVehicle;
-->
-->
|Description=


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


|p1= vehicle: [[Object]] - vehicle to customize |Parameter 1=
| [vehicle, variant, animations, mass] call [[BIS_fnc_initVehicle]]
 
|p1= vehicle: [[Object]] - vehicle to customize


|p2= variant: (Optional, default [[false]])
|p2= variant: (Optional, default [[false]])
Line 70: Line 70:
* [[Array]] - Array of texture sources with their probability, to format {{Inline code|["textureSource1", 0.5, "textureSource2", 0.5]}}
* [[Array]] - Array of texture sources with their probability, to format {{Inline code|["textureSource1", 0.5, "textureSource2", 0.5]}}
* [[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 the <tt>[[configFile]] >> [[CfgVehicles]]</tt> or from the <tt>[[missionConfigFile]] >> [[Description.ext#CfgVehicleTemplates|CfgVehicleTemplates]]</tt>
* [[Number]] - index of the texture source (same as the old system) |Parameter 2=
* [[Number]] - index of the texture source (same as the old system)


|p3= animations: (Optional, default [[false]])
|p3= animations: (Optional, default [[false]])
Line 76: Line 76:
* [[Array]] - Array of animation sources with their probability, to format {{Inline code|["animationSource1", 0.5, "animationSource2", 0.5]}}<br>'''NOTE:''' if the first element is wrong, it will skip the rest of the animation sources
* [[Array]] - Array of animation sources with their probability, to format {{Inline code|["animationSource1", 0.5, "animationSource2", 0.5]}}<br>'''NOTE:''' 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 the <tt>[[configFile]] >> [[CfgVehicles]]</tt> or from the <tt>[[missionConfigFile]] >> [[Description.ext#CfgVehicleTemplates|CfgVehicleTemplates]]</tt>
|Parameter 3=
 


|p4= mass: (Optional, default [[false]])
|p4= mass: (Optional, default [[false]])
* [[Boolean]] - [[true]] to set the default mass, [[false]] to disable the mass change
* [[Boolean]] - [[true]] to set the default mass, [[false]] to disable the mass change
* [[Number]] - mass to remove/add to the vehicle
* [[Number]] - mass to remove/add to the vehicle
|Parameter 4=


| [[Boolean]] - function success or not |Return value=


|x1= <code>result = [<nowiki/>[[this]], "", []] [[call]] [[BIS_fnc_initVehicle]];</code> |Example 1=
| [[Boolean]] - function success or not
 
|x1= <code>result = [<nowiki/>[[this]], "", []] [[call]] [[BIS_fnc_initVehicle]];</code>


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


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


|x4= <code>[[this]] [[setVariable]] ["'''BIS_fnc_initVehicle_customization'''", [[false]], [[false]]]; {{codecomment|// set in an init field}}</code> |Example 4=
|x4= <code>[[this]] [[setVariable]] ["'''BIS_fnc_initVehicle_customization'''", [[false]], [[false]]]; {{codecomment|// set in an init field}}</code>


| [[Vehicle Customization (VhC)]], [[Description.ext#CfgVehicleTemplates|CfgVehicleTemplates]], [[Description.ext#disableRandomization|disableRandomization]] |See also=
| [[Vehicle Customization (VhC)]], [[Description.ext#CfgVehicleTemplates|CfgVehicleTemplates]], [[Description.ext#disableRandomization|disableRandomization]]
}}
}}



Revision as of 23:12, 17 January 2021

Hover & click on the images for description

Description

Description:
This function changes the textures, animation sources and/or mass of a given vehicle.
The use of BIS_fnc_initVehicle_customization variable in a vehicle's init field is possible (see Example 4)
Unless explicitly mentioned (see Example 3), the function will restore the initial state of every animation sources of the given object.

Additional information:

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)
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:
this setVariable ["BIS_fnc_initVehicle_customization", false, false]; // set in an init field

Additional Information

See also:
Vehicle Customization (VhC)CfgVehicleTemplatesdisableRandomization

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


Bottom Section

Posted on December 1, 2018 - 00:25 (UTC)
HazJ
Randomise camo net options with 50% probability: result = [vehicle player, FALSE, ["showcamonethull", 0.5, "showcamonetturret", 0.5, "showcamonetcannon", 0.5, "showslathull", 0.5]] call BIS_fnc_initVehicle; Force show all camo net options: result = [vehicle player, FALSE, ["showcamonethull", 1, "showcamonetturret", 1, "showcamonetcannon", 1, "showslathull", 1]] call BIS_fnc_initVehicle; Use animationNames to get all available animation sources. Vehicles that don't support certain animations are simply ignored.