GetBlockingDoor()

From NWN Lexicon

Determines the door that is blocking a creature.

Contents

[edit] Description

Returns the last blocking door encountered by the caller of this function or OBJECT_INVALID if the caller is not a valid creature.

[edit] Remarks

As of 1.60, the OnBlocked event will fire for creatures being blocked by another creature. GetBlockingDoor() will therefore either return a Creature or a Door in the OnBlocked event.

GetIsDoorActionPossible() will return FALSE with creatures, so the default OnBlocked event will in no way be affected.

[edit] Version

1.22

[edit] Example

//::///////////////////////////////////////////////
//:: Default On Heartbeat
//:: NW_C2_DEFAULTE
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
   This will cause blocked creatures to open
   or smash down doors depending on int and
   str.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Nov 23, 2001
//:://////////////////////////////////////////////
 
void main()
{
    object oDoor = GetBlockingDoor();
 
    if (GetAbilityScore(OBJECT_SELF, ABILITY_INTELLIGENCE) >= 5)
    {
        if (GetIsDoorActionPossible(oDoor, DOOR_ACTION_OPEN) && GetAbilityScore(OBJECT_SELF, ABILITY_INTELLIGENCE) >= 7)
        {
            DoDoorAction(oDoor, DOOR_ACTION_OPEN);
        }
        else if (GetIsDoorActionPossible(oDoor, DOOR_ACTION_BASH))
        {
            DoDoorAction(oDoor, DOOR_ACTION_BASH);
        }
    }
}

[edit] See Also

functions:  ActionOpenDoor, ActionUnlockObject
events:  OnBlocked Event


author: Tom Cassiotis, editor: Jasperre, additional contributor(s): Jasperre

Personal tools
Categories