GetModuleItemAcquiredFrom()

From NWN Lexicon
Jump to: navigation, search

Get the last owner of the item acquired on an OnAcquiredItem event.

Description

Returns the object that last owned the item in an OnAcquireItem event (even if the item was set on the ground between ownership).

Remarks

As GetModuleItemAcquired has an error component, it should also be possible for this function to fail; be aware that triggering the OnAcquireItem event manually may cause an error in this function.

Version

1.29

Example

// this will find the name of the creature the item was acquired
// from in an OnAcquiredItem event.
void main()
{
    object a = GetModuleItemAcquired();
    if (a == OBJECT_INVALID)
        SendMessageToPC(GetFirstPC(),"OOPS A CRASH ME THINKS");
    else
    {
        SendMessageToPC(GetFirstPC(),GetTag(a));
        a = GetModuleItemAcquiredFrom();
        if (a == OBJECT_INVALID)
            SendMessageToPC(GetFirstPC(),"And was picked up off the ground");
        else
            SendMessageToPC(GetFirstPC(),"And was taken off " + GetTag(a));
    }
}

See Also

functions:  GetModuleItemLostBy, GetModuleItemAcquired, GetModuleItemAcquiredBy
events:  OnUnAcquireItem Event


 author: GoLeM, editor: Charles Feduke, additional contributor(s): Eric Zaat