GetLastOpenedBy(object)

From NWN Lexicon
Jump to navigationJump to search

Get the last creature that opened the given object.

object GetLastOpenedBy(
    object oObject = OBJECT_SELF
)

Parameters

oObject
The object (door, placeable or store) to inspect for the last opener (default: OBJECT_SELF)


Description

Get the last creature that opened oObject.

Returns OBJECT_INVALID if the caller is not a valid door, placeable, or store.


Version

This function was updated in 1.89.8193.37 of NWN:EE. VM: Added oObject parameter to GetLastOpenedBy().


Example

//Kill everyone who opens me if they don't have a certain
//local variable set. Goes OnOpen.

void main()
{
    object oPC = GetLastOpenedBy();

    if (GetLocalInt(oPC, "may_open")) return;

    effect eDeath = EffectDeath();

    DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oPC));
}

See Also

functions: 

GetLastUsedBy



 author: John Shuell, editor: Lilac Soul