object.place_at_me
a.k.a. object.create_objectThis 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
If the context object is facing almost exactly nose-up or nose-down, and you don't use the absolute_orientation flag, then the game engine will position and rotate the new object as though the context object were completely un-rotated: the new object's local forward vector will exactly match the world X-axis, and the position offsets you specify will act as world-relative X-, Y-, and Z-coordinates.
The new object will be created as close to the context object as possible. It may not be created exactly at the context object, even if one or both of the objects are non-solid. To create one object exactly at another object, attach the created object to the basis object and then detach it.
If the context object doesn't exist (i.e. is no_object), then no object will be created, and the return value will be no_object.