object.place_at_me

a.k.a. object.create_object

This function spawns a new object as close to the context object (the one you call the function on) as possible. The new object will face in the same general direction as the context object. (It will have the same yaw rotation by default; if you pass the absolute_orientation flag, then the new object will also copy the context object's roll and pitch rotations.)

You can optionally create the new object at a position offset from the context object's location. The offset you specify is applied relative to the general direction that the context object is facing in. By default, the offset only takes the context object's yaw rotation into account; if you pass the absolute_orientation flag, then the full rotation is accounted for. In this system, the X-offset represents "forward" and th Z-offset represents "upward."

This function returns object.

Arguments

type

The type of object to create. If this is not a valid object type, then the return value is no_object.

label

A string literal containing the name of a Forge label, or an integer constant denoting the index of a Forge label in the game variant's label list.

flags

The word none, or one or more of the following flags separated with the | symbol:

never_garbage_collect
Prevents the created object from being garbage-collected.
suppress_effect
Unknown.
absolute_orientation
By default, new objects are created with the same yaw rotation as the context object, and the offset is applied relative to the context object's yaw rotation. This flag forces the context object's roll and pitch rotations to be taken into account as well.
x

The X-coordinate of a position offset. Allowed values are integer constants between -128 and 127, inclusive, where 10 is equal to one Forge unit.

y

The Y-coordinate of a position offset. Allowed values are integer constants between -128 and 127, inclusive, where 10 is equal to one Forge unit.

z

The Z-coordinate of a position offset. Allowed values are integer constants between -128 and 127, inclusive, where 10 is equal to one Forge unit.

variant-string-id

A variation to apply to the created object, if the object type supports it.

Example

--
-- Spawn a Spartan with Kat's armor:
--
global.object[0] = global.object[1].place_at_me(spartan, none, never_garbage_collect, 0, 0, 0, kat)

Notes

See also