BIS fnc initVehicle: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (some minor fixes)
(merged note into examples and various other formatting tweaks)
Line 11: Line 11:
|gr1 = Vehicles
|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.
The use of '''BIS_fnc_initVehicle_customization''' variable in a vehicle's init field is possible (see '''Example 4''')
* The use of '''BIS_fnc_initVehicle_customization''' variable in a vehicle's init field is possible ('''Example 4''').
{{Informative|Unless explicitly mentioned (see '''Example 3'''), the function will restore the initial state of every animation sources of the given object.}}
* Unless explicitly mentioned , the function will restore the initial state of every animation sources of the given object ('''Example 3''').  
 
'''Additional information:'''
* [http://dev.arma3.com/post/oprep-vehicle-customization OPREP]
* [[Arma 3 Vehicle Customization]]


| [vehicle, variant, animations, mass] call [[BIS_fnc_initVehicle]]
| [vehicle, variant, animations, mass] call [[BIS_fnc_initVehicle]]
Line 31: Line 27:
|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]}}<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]}}
{{Important|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>


Line 48: Line 45:
|x4= <code>[[this]] [[setVariable]] ["'''BIS_fnc_initVehicle_customization'''", [[false]], [[false]]]; {{codecomment|// set in an init field}}</code>
|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]]
|x5= <code>{{cc|Randomise camo net options with 50% probability}}
}}
<nowiki>[</nowiki>[[vehicle]] [[player]], [[false]], ["showcamonethull", 0.5, "showcamonetturret", 0.5, "showcamonetcannon", 0.5, "showslathull", 0.5]] [[call]] [[BIS_fnc_initVehicle]];</code>
| [[Arma 3 Vehicle Customization]] [[Description.ext#CfgVehicleTemplates|CfgVehicleTemplates]] [[Description.ext#disableRandomization|disableRandomization]] [http://dev.arma3.com/post/oprep-vehicle-customization OPREP]


|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.}}
<nowiki>[</nowiki>[[vehicle]] [[player]], [[false]], ["showcamonethull", 1, "showcamonetturret", 1, "showcamonetcannon", 1, "showslathull", 1]] [[call]] [[BIS_fnc_initVehicle]];
</code>


}}


[[Category:Functions|{{uc:initVehicle}}]]
[[Category:Functions|{{uc:initVehicle}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:initVehicle}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:initVehicle}}]]
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on December 1, 2018 - 00:25 (UTC)</dd>
<dt class="note">[[User:HazJ|HazJ]]</dt>
<dd class="note">
Randomise camo net options with 50% probability:
<code>result = [vehicle player, FALSE, ["showcamonethull", 0.5, "showcamonetturret", 0.5, "showcamonetcannon", 0.5, "showslathull", 0.5]] [[call]] [[BIS_fnc_initVehicle]];</code>
Force show all camo net options:
<code>result = [vehicle player, FALSE, ["showcamonethull", 1, "showcamonetturret", 1, "showcamonetcannon", 1, "showslathull", 1]] [[call]] [[BIS_fnc_initVehicle]];</code>
Use [[animationNames]] to get all available animation sources. Vehicles that don't support certain animations are simply ignored.
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Revision as of 16:17, 29 January 2021

Hover & click on the images for description

Description

Description:
Description needed
Execution:
call
Groups:
Vehicles

Syntax

Syntax:
Syntax needed
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 - Array of animation sources with their probability, to format ["animationSource1", 0.5, "animationSource2", 0.5]
If the first element is wrong, it will skip the rest of the animation sources!
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:
Return value needed

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
Example 5:
// 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:
See also needed

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