GetTrapCreator(object)

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

object GetTrapCreator(
    object oTrapObject
);

Parameters

oTrapObject

a placeable, door or trigger


Description

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



Remarks

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


Version

1.22

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);
    }
}

See Also

functions: GetIsTrapped | GetLastTrapDetected | GetTrapBaseType | GetTrapDetectable | GetTrapDetectDC | GetTrapDetectedBy | GetTrapDisarmable | GetTrapDisarmDC | GetTrapFlagged | GetTrapKeyTag | GetTrapOneShot | SetTrapDetectedBy | SetTrapDisabled
categories: Traps Functions
events: OnDisarm Event | OnTrapTriggered Event


 author: Jody Fletcher, editor: Jasperre