GetTrapCreator

From NWN Lexicon



Contents

[edit] GetTrapCreator(object)

Returns the name of the creature that set the specific trap.

object GetTrapCreator(
    object oTrapObject
);

[edit] Parameters

oTrapObject

a placeable, door or trigger


[edit] Description

Get the creator of oTrapObject, the creature that set the trap.
Returns OBJECT_INVALID if oTrapObject was created in the toolset.



[edit] Remarks

Only PC's can set traps, and therefore, this will always be a PC.


[edit] Version

1.22

[edit] Example

// On Disarm: If the trap creator is a valid PC, we give 10 XP because it is hard to disarm, as long as they didn't place it!
void main()
{
    // Trap is us
    object oTrap = OBJECT_SELF;
    // Get creator
    object oCreator = GetTrapCreator(oTrap);
    object oDisarmer = GetLastDisarmed();
 
    // Check if the creator is a PC, and not the disarmer
    if(GetIsObjectValid(oCreator) &&
       GetIsPC(oCreator) &&
       oCreator != oDisarmer)
    {
        // Award 10XP
        GiveXPToCreature(oDisarmer, 10);
    }
}

[edit] See Also

functions: 

SetTrapDisabled

events: 

OnTrapTriggered Event



 author: Jody Fletcher, editor: Jasperre
 

Personal tools
Categories