BIS fnc initVehicle: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<code>([^<]*)<nowiki>\[<\/nowiki>\[\[([a-zA-Z0-9_]+)\]\](.*)<\/code>" to "<code>$1$2$3</code>")
m (Some wiki formatting)
Line 10: Line 10:
|gr1= Vehicles
|gr1= Vehicles


|descr= 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}}).


|s1= [vehicle, variant, animations, mass] call [[BIS_fnc_initVehicle]]
|s1= [vehicle, variant, animations, mass] call [[BIS_fnc_initVehicle]]
Line 35: Line 35:
|r1= [[Boolean]] - function success or not
|r1= [[Boolean]] - function success or not


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


|x2= <code>result = [<nowiki/>[[Magic Variables#this_2|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/>[[Magic Variables#this_2|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>// Randomise camo net options with 50% probability
|x4= <sqf>
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
|seealso= [[Arma 3: Vehicle Customization]] [[Description.ext#CfgVehicleTemplates|CfgVehicleTemplates]] [[Description.ext#disableRandomization|disableRandomization]] {{ExternalLink|link= http://dev.arma3.com/post/oprep-vehicle-customization|text= OPREP}} [[BIS_fnc_getVehicleCustomization]]
[vehicle player, false, ["showcamonethull", 0.5, "showcamonetturret", 0.5, "showcamonetcannon", 0.5, "showslathull", 0.5]] call BIS_fnc_initVehicle;
</sqf>


|x6= <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.
|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>
}}
}}

Revision as of 13:05, 13 July 2022

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 - 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:
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:
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