Page tree
Skip to end of metadata
Go to start of metadata



Introduced in

Version:3.9.0

Description

Description:

Moves an existing weapon / vehicle component to another slot or slot position. If the target slot is occupied, the original component is replaced.

Note: Moving items between different objects or items is not currently possible.

Syntax

Syntax:component moveComponentToSlot [parent, slot, position]
Parameters:
  • component: String - The component class name or the Object to copy.
  • parent: Object - The parent object to add the new component to.
  • slot: String - The slot to add the new component to.
  • position: Number - The rail position index.
Return Value:Object - The moved component, objNull if the command fails (it is not forced).

Alternative Syntax

Syntax:component moveComponentToSlot [parent, slot, position, [offset X, offset Y, offset Z], [rotation X, rotation Y, rotation Z], [scale X, scale Y, scale Z]] (V17.4.0+)
Parameters:
  • component: String - The component class name or the Object to copy.
  • parent: Object - The parent object to add the new component to.
  • slot: String - The slot to add the new component to.
  • position: Number - The rail position index.
  • [offset X, offset Y, offset Z]: Array of Number - The offset in meters.
  • [rotation X, rotation Y, rotation Z]: Array of Number - The rotation angles in degrees.
  • [scale X, scale Y, scale Z]: Array of Number - The scale as a coefficient.
Return Value:Object - The moved component, objNull if the command fails (it is not forced).

Examples

Examples:_movedOptic = _optic moveComponentToSlot [_rifle, "optics", 1]

Additional Information

See also: addComponentToSlot, getComponents, addWeapon, getWeaponObjects
Multiplayer: 
Problems: 

Notes