SetObjectOrder

Category: Objects / Position
Since engine version: 4.9.1.0 GWE (extended in 4.9.5.0 CE)

Description

Ensures that an object is internally sorted before or after another specified object. In this way, you can e.g. ensure that an elevator case is always drawn and processed before its elevator structure.

Syntax

bool SetObjectOrder (object pObjBeforeOrAfter, object pSortObj, bool fAfter);

Parameters

pObjBeforeOrAfter:
Object before or after which pSortObj is to be inserted
pSortObj:
[opt] Object which is to be inserted before or after pObjBefore. Can be 0 in local calls.
fAfter:
[opt] If not 0, pSortObj will be inserted after object pObjBeforeOrAfter (and not before).

Remark

You should only resort objects of the same category, otherwise the internal handling mights get confused.
The actual resorting is done later but within the same frame as the script call.

Example

SetObjectOrder(FindObject(TRE1), FindObject(TRE2));
Places the first found tree of type TRE2 before the first found tree of type TRE1.
See also: Resort, ResortObjects
Sven2, April 2002