(Properties) |
|||
Line 48: | Line 48: | ||
myObj.position = {20, 80, -350}; | myObj.position = {20, 80, -350}; | ||
</pre> | </pre> | ||
=== yaw === | |||
* Get or set | |||
* Gets or sets the object's yaw (float) | |||
* Usage example: <code>myObj.yaw = 120.0;</code> | |||
=== radius === | |||
* Get or set | |||
* Gets or sets the object's radius / world width (float) | |||
* Usage example: <code>myObj.radius = 1.5;</code> | |||
=== worldWidth === | |||
* Get or set | |||
* Gets or sets the object's radius / world width (float) | |||
* Usage example: <code>myObj.worldWidth = 1.5; // this is the same as radius</code> | |||
=== height === | |||
* Get or set | |||
* Gets or sets the object's height / world height (float) | |||
* Usage example: <code>myObj.height = 9.5;</code> | |||
=== worldHeight === | |||
* Get or set | |||
* Gets or sets the object's height / world height (float) | |||
* Usage example: <code>myObj.worldHeight = 9.5; // this is the same as height</code> |
Revision as of 04:23, 30 August 2025
Object Script enables manipulation of objects via ForceScript.
Naming of objects
TFE introduces the ability to name objects, so that they can be referenced by the scripting system. Names may be up to 32 characters and are case insensitive like sector names.
Objects are named in the .O file as shown here:
/* 006 SEWERBUG.WAX */ CLASS: SPRITE DATA: 3 X: 232.00 Y: 0.00 Z: 264.00 PCH: 0.00 YAW: 0.00 ROL: 0.00 DIFF: 1 SEQ LOGIC: SEWER1 NAME: sewer-creature2 SEQEND /* 007 REMOTE.WAX */ CLASS: SPRITE DATA: 2 X: 280.00 Y: 0.00 Z: 232.00 PCH: 0.00 YAW: 0.00 ROL: 0.00 DIFF: 1 SEQ LOGIC: REMOTE NAME: cool-remote SEQEND /* 008 MOUSEBOT.3DO */ CLASS: 3D DATA: 2 X: 256.00 Y: 0.00 Z: 232.00 PCH: 0.00 YAW: 0.00 ROL: 0.00 DIFF: 1 SEQ LOGIC: MOUSEBOT NAME: mouse4 SEQEND
Getting objects by name
To get objects by their name, use the methods in the Level Script API.
getObject
getObjectsByName
Object Properties
sector
- Get only
- Gets the object's current sector (
Sector
) - Usage example:
Sector troopSector = my_trooper.sector
position
- Get or set
- Gets or sets the object's position (float3)
- Usage example: move the object to coordinates x20, y80, z-350
myObj.position = {20, 80, -350};
yaw
- Get or set
- Gets or sets the object's yaw (float)
- Usage example:
myObj.yaw = 120.0;
radius
- Get or set
- Gets or sets the object's radius / world width (float)
- Usage example:
myObj.radius = 1.5;
worldWidth
- Get or set
- Gets or sets the object's radius / world width (float)
- Usage example:
myObj.worldWidth = 1.5; // this is the same as radius
height
- Get or set
- Gets or sets the object's height / world height (float)
- Usage example:
myObj.height = 9.5;
worldHeight
- Get or set
- Gets or sets the object's height / world height (float)
- Usage example:
myObj.worldHeight = 9.5; // this is the same as height