BIS fnc spawnObjects: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (template:command argument fix)
m (Some wiki formatting)
 
(31 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma3
____________________________________________________________________________________________
|version1= 1.00


| arma3 |= Game name
|gr1= Object Manipulation


|1.00|= Game version
|descr= Create a stack of objects at given position or on top of given object (eg. table).
____________________________________________________________________________________________


| Create a stack of objects at given position or on top of given object (eg. table). |DESCRIPTION=
|s1= [position, className, count, offsetMatrix, offsetDir, dirNoise, enableSimulation] call [[BIS_fnc_spawnObjects]]
____________________________________________________________________________________________


| [position, className, count, offsetMatrix, offsetDir, dirNoise, enableSimulation] call [[BIS_fnc_spawnObjects]] |SYNTAX=
|p1= position: [[Array]] format [[Position#PositionASL|PositionASL]], or [[Array]] as [referenceObject, placement]
 
|p1= position: [[PositionASL]], or [[Array]] as [referenceObject, placement]
* referenceObject: [[Object]]
* referenceObject: [[Object]]
* placement: [[String]] - can be:
* placement: [[String]] - can be:
Line 19: Line 16:
** "TOP" = top of the objects boundingbox
** "TOP" = top of the objects boundingbox
** "GROUND" = sitting just on the ground
** "GROUND" = sitting just on the ground
** "ROADWAY" = sitting just on the ground |PARAMETER1=
** "ROADWAY" = sitting just on the ground


|p2= className: [[String]] - class of the object(s) to spawn; all will use the same class |PARAMETER2=
|p2= className: [[String]] - class of the object(s) to spawn; all will use the same class


|p3= count: [[Number]] (Optional, default: 1) - how many objects will be spawned |PARAMETER3=
|p3= count: [[Number]] - (Optional, default: 1) how many objects will be spawned


|p4= offsetMatrix: [[Array]] (Optional, default: [0,0,0]) - starting spawning position offset |PARAMETER4=
|p4= offsetMatrix: [[Array]] - (Optional, default: [0,0,0]) starting spawning position offset


|p5= offsetDir: [[Number]] (Optional, default: 0) - starting spawning direction offset |PARAMETER5=
|p5= offsetDir: [[Number]] - (Optional, default: 0) starting spawning direction offset


|p6= dirNoise: [[Code]] (Optional, default: {0}) - spawned object direction delta from the starting direction, defined as code returning dir delta value |PARAMETER6=
|p6= dirNoise: [[Code]] - (Optional, default: {0}) spawned object direction delta from the starting direction, defined as code returning dir delta value


|p7= enableSimulation: [[Boolean]] (Optional, default: false) - shall the simulation of the spawned objects be enabled or not |PARAMETER7=
|p7= enableSimulation: [[Boolean]] - (Optional, default: false) shall the simulation of the spawned objects be enabled or not


| [[Array]] of created [[Object|Objects]] |RETURNVALUE=
|r1= [[Array]] of created [[Object]]s
____________________________________________________________________________________________


|x1= <code>_randomPos = [([[random]] 0.2) -0.1, ([[random]] 0.2) -0.1, 0];
|x1= <sqf>
_objects = <nowiki>[</nowiki>[_table, "TOP"], "Box_NATO_Wps_F", 3, _randomPos,([[random]] 20)-10] [[call]] [[BIS_fnc_spawnObjects]];</code> |EXAMPLE1=
private _randomPos = [(random 0.2) -0.1, (random 0.2) -0.1, 0];
____________________________________________________________________________________________
_objects = [[_table, "TOP"], "Box_NATO_Wps_F", 3, _randomPos,(random 20)-10] call BIS_fnc_spawnObjects;
 
</sqf>
| [[createVehicle]], [[createSimpleObject]], [[enableSimulation]] |SEEALSO=


|seealso= [[createVehicle]] [[createSimpleObject]] [[enableSimulation]]
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Objects|{{uc:spawnObjects}}]]
[[Category:Functions|{{uc:spawnObjects}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:spawnObjects}}]]

Latest revision as of 15:40, 13 July 2022

Hover & click on the images for description

Description

Description:
Create a stack of objects at given position or on top of given object (eg. table).
Execution:
call
Groups:
Object Manipulation

Syntax

Syntax:
[position, className, count, offsetMatrix, offsetDir, dirNoise, enableSimulation] call BIS_fnc_spawnObjects
Parameters:
position: Array format PositionASL, or Array as [referenceObject, placement]
  • referenceObject: Object
  • placement: String - can be:
    • "BOTTOM" = at the bottom of the object
    • "TOP" = top of the objects boundingbox
    • "GROUND" = sitting just on the ground
    • "ROADWAY" = sitting just on the ground
className: String - class of the object(s) to spawn; all will use the same class
count: Number - (Optional, default: 1) how many objects will be spawned
offsetMatrix: Array - (Optional, default: [0,0,0]) starting spawning position offset
offsetDir: Number - (Optional, default: 0) starting spawning direction offset
dirNoise: Code - (Optional, default: {0}) spawned object direction delta from the starting direction, defined as code returning dir delta value
enableSimulation: Boolean - (Optional, default: false) shall the simulation of the spawned objects be enabled or not
Return Value:
Array of created Objects

Examples

Example 1:
private _randomPos = [(random 0.2) -0.1, (random 0.2) -0.1, 0]; _objects = [[_table, "TOP"], "Box_NATO_Wps_F", 3, _randomPos,(random 20)-10] call BIS_fnc_spawnObjects;

Additional Information

See also:
createVehicle createSimpleObject enableSimulation

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