GetClickingObject()

From NWN Lexicon
Jump to: navigation, search

Used in the OnClick event to return the clicking object.

Description

Use this in a trigger's OnClick event script or a placeable or doors OnFailToOpen event to get the object that last clicked on it. This is identical to GetEnteringObject.


Remarks

The reason for it being identical to GetEnteringObject() is that triggers, or course, can be said to be clicked on, or entered, when a transition is used.

This function is of course not meant to be used outside certain events, as it can return long dead or invalid creatures.


Version

1.62

Example

// cause a PC that attempts to open a locked door to utter
// some nonsense about requiring a key in a door's OnFailToOpen
// event
void main()
{
    object oPC = GetClickingObject();
 
    if (GetIsObjectValid(oPC))
        AssignCommand(oPC, SpeakString("I need to find the key..."));
    else
        SpeakString("NO VALID TEMP PC");
}

See Also

functions: 

GetEnteringObject

events: 

OnClick Event

OnFailToOpen Event



 author: Ryan Hunt, editor: Jasperre, additional contributor(s): Fred Brent, Charles Feduke, Jasperre