GetParentRef

From the Oblivion ConstructionSet Wiki
Revision as of 21:00, 21 March 2008 by imported>DragoonWraith (changing v1.0 to 1.0 for consistency)
Jump to navigation Jump to search

Syntax:

set refVar to GetParentRef

Returns the calling object's parent reference (0 if no parent).

The "parent reference" is the reference set in the "Enable Parent" tab of the reference edit dialog. While the dialog appears to only concerned with the enabling state, this function means that its also useful for linking any two references together.

The common use of reference linking is in the scripts of traps, where the trigger ref (push plate, trip string, or a trigger zone) has the actual trap mechanism (mace trap, log trap, darts) as the parent. However, the function can be used in any case in which a generic object needs a relationship with another object. (E.g., place a bunch of cat references where each cat will follow its parent ref.)

If you need to link more than two objects, you can sometimes daisy chain multiple objects together. E.g., if it's desired for a trip wire to activate two separate trap objects, then set the parent ref of the trip wire to one trap, and then set that trap to have the other trap as its parent and have first trap activate its parent when it is activated. (See also Traps.)