GetModuleItemAcquired()

From NWN Lexicon
Jump to: navigation, search

Get the item acquired on an OnAcquiredItem event.

Description

Returns the object that was just picked up or acquired in an OnAcquiredItem event.

Usually you'd expect OBJECT_INVALID to mean an error state; except it occurs when gold is acquired (there is a "gold item" the game uses, but when obtained it must transform into the players gold integer). In this case you can use GetModuleItemAcquiredStackSize to get the amount of gold obtained. There is no equivalent for dropping gold.

Version

1.22

Example

// This will find the name of the item acquired 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));
}

See Also

functions: 

GetModuleItemLostBy

events: 

OnUnAcquireItem Event



 author: GoLeM, editor: Kristian Markon