GetTrapBaseType

From NWN Lexicon



Contents

[edit] GetTrapBaseType(object)

Determines the type (i.e. frost, spike, etc.) of a trap.

int GetTrapBaseType(
    object oTrapObject
);

[edit] Parameters

oTrapObject

a placeable, door or trigger


[edit] Description

Get the trap base type (TRAP_BASE_TYPE_*) of oTrapObject.

See traps.2da for the actual reference numbers for the constants.



[edit] Remarks

This cannot be used to check a trap item (which a PC uses to place a trap down) and its type. It can only be done by checking the item property or checking the name.


[edit] Version

1.22

[edit] Example

// Check what sort of trap the nearest trap is to us (an NPC) and if it
// is a fire one, speak some catchy line! Could be a heartbeat add-on.
void main()
{
    // Get nearest trap detected by us
    object oTrap = GetNearestTrapToObject(OBJECT_SELF, TRUE);
 
    // Check type of trap
    int nTrapType = GetTrapBaseType(oTrap);
 
    // Need a fire one for catchy line.
    if(nTrapType == TRAP_BASE_TYPE_AVERAGE_FIRE ||
       nTrapType == TRAP_BASE_TYPE_DEADLY_FIRE ||
       nTrapType == TRAP_BASE_TYPE_EPIC_FIRE ||
       nTrapType == TRAP_BASE_TYPE_MINOR_FIRE ||
       nTrapType == TRAP_BASE_TYPE_STRONG_FIRE)
    {
        // Catchy line from notorious amount of traps NPC's always walk into
        SpeakString("Hey, I'm going to be on fire soon, baby!");
    }
}

[edit] See Also

functions: 

SetTrapDisabled

constants: 

TRAP_BASE_TYPE_* Constants

events: 

OnTrapTriggered Event



 author: Jody Fletcher, editor: Jasperre
 

Personal tools
Categories