GetCurrentInteractionTarget

From NWN Lexicon
Jump to navigationJump to search


GetCurrentInteractionTarget()

Get the caller's current interaction target.

Description

Get the caller's current interaction target.



Remarks

Returns the local object stored in "NW_ANIM_TARGET". If not found returns OBJECT_INVALID.

Requirements

#include " x0_i0_anims "


Version

???

Example

// Find out what object we are interacting with and do different things depending on the type of object it is.
#include "x0_i0_anims"

void main()
{
    // Get what object the caller is interacting with.
    object oThing = GetCurrentInteractionTarget();

    // Validate that the caller has a current interaction object.
    if(OBJECT_INVALID != oThing)
    {
        // Figure out what type of object it is.
        int nType = GetObjectType(oThing);

        // Do different things depending on the object's type.
        switch(nType)
        {
            case OBJECT_TYPE_CREATURE:
                // Do creature related stuff here.
                break;  
            case OBJECT_TYPE_PLACEABLE:
                // Do placeable related stuff here.
                break;
            // ...    
            // List other object types that you might want here as additional case statements.  
            // ...    
            default:
                // Generically deal with any other object types here if you want.
                break;            
        }
    }
}

See Also

functions: 

SetCurrentInteractionTarget



author: Baragg, editor: Mistress