GetModuleItemAcquiredFrom

From NWN Lexicon

Contents

[edit] GetModuleItemAcquiredFrom()

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

[edit] Description

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



[edit] Remarks

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


[edit] Version

1.29

[edit] 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));
        }
}

[edit] See Also

functions: 

GetModuleItemLostBy

events: 

OnUnAcquireItem Event



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

Personal tools
Categories