Difference between revisions of "GetParentRef"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Fella
imported>DragoonWraith
(changing v1.0 to 1.0 for consistency)
Line 11: Line 11:
   
   
[[Category: Functions]]
[[Category: Functions]]
[[Category:Functions (CS)]]
[[Category: Functions (CS)]]
[[Category: Functions (CS 1.0)]]
[[Category: Functions (CS 1.0)]]
[[Category: Record Variable Functions]]
[[Category: Record Variable Functions]]
[[Category: Record Variable Functions (CS v1.0)]]
[[Category: Record Variable Functions (CS 1.0)]]

Revision as of 21:00, 21 March 2008

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.)