Difference between revisions of "GetModuleItemAcquiredFrom"

From NWN Lexicon
Jump to: navigation, search
m (Wikified article formatting)
 
Line 1: Line 1:
=GetModuleItemAcquiredFrom()=
 
 
 
Get the last owner of the item acquired on an OnAcquiredItem event.
 
Get the last owner of the item acquired on an OnAcquiredItem event.
  
Line 7: Line 5:
 
</nwscript>
 
</nwscript>
  
====Description====
+
===Description===
 +
Returns the object that last owned the item in an [[OnAcquireItem]] event (even if the item was set on the ground between ownership).
  
Returns the object that last owned the item in an OnAcquiredItem 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.
<br /><br />
 
 
 
====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.
 
 
 
<br />
 
 
 
====Version====
 
  
 +
===Version===
 
1.29
 
1.29
  
====Example====
+
===Example===
 
 
 
<nwscript>
 
<nwscript>
 
// this will find the name of the creature the item was acquired
 
// this will find the name of the creature the item was acquired
Line 31: Line 21:
 
{
 
{
 
     object a = GetModuleItemAcquired();
 
     object a = GetModuleItemAcquired();
     if(a == OBJECT_INVALID)
+
     if (a == OBJECT_INVALID)
 
         SendMessageToPC(GetFirstPC(),"OOPS A CRASH ME THINKS");
 
         SendMessageToPC(GetFirstPC(),"OOPS A CRASH ME THINKS");
     else {
+
     else
 +
    {
 
         SendMessageToPC(GetFirstPC(),GetTag(a));
 
         SendMessageToPC(GetFirstPC(),GetTag(a));
 
         a = GetModuleItemAcquiredFrom();
 
         a = GetModuleItemAcquiredFrom();
         if(a == OBJECT_INVALID)
+
         if (a == OBJECT_INVALID)
 
             SendMessageToPC(GetFirstPC(),"And was picked up off the ground");
 
             SendMessageToPC(GetFirstPC(),"And was picked up off the ground");
 
         else
 
         else
 
             SendMessageToPC(GetFirstPC(),"And was taken off " + GetTag(a));
 
             SendMessageToPC(GetFirstPC(),"And was taken off " + GetTag(a));
        }
+
    }
 
}
 
}
 
</nwscript>
 
</nwscript>
  
====See Also====
+
===See Also===
  
 
{| class="seealso"
 
{| class="seealso"
 
| width="1px" align="right" valign="top" | <font color="gray">functions: </font>
 
| width="1px" align="right" valign="top" | <font color="gray">functions: </font>
|
+
| [[GetModuleItemLostBy]], [[GetModuleItemAcquired]], [[GetModuleItemAcquiredBy]]
[[ GetModuleItemLostBy  | GetModuleItemLostBy ]]
 
|-
 
 
|-
 
|-
 
| width="1px" align="right" valign="top" | <font color="gray">events: </font>
 
| width="1px" align="right" valign="top" | <font color="gray">events: </font>
|
+
| [[OnUnAcquireItem|OnUnAcquireItem Event]]
[[ OnUnAcquireItem | OnUnAcquireItem Event ]]
+
|}<br />
|}
 
 
 
<br />
 
 
----
 
----
<font color="gray">  author: GoLeM, editor: Charles Feduke, additional contributor(s): Eric Zaat</font><br />  <br />
+
<font color="gray">  author: GoLeM, editor: Charles Feduke, additional contributor(s): Eric Zaat</font>
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:Inventory_Functions]]
 
[[Category:Inventory_Functions]]
[[Category:Module_Functions]]
+
[[Category:Module_Functions]]{{DISPLAYTITLE:GetModuleItemAcquiredFrom()}}

Latest revision as of 01:43, 18 February 2018

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