HasItem

From NWN Lexicon
Jump to: navigation, search


HasItem(object, string)

Determines if a creature possesses an item.

int HasItem(
    object oCreature,
    string sTag
);

Parameters

oCreature

The creature to check if they possess an item.

sTag

The item's tag to search for.


Description

Returns TRUE if oCreature possesses an item with the tag sTag, otherwise returns FALSE.



Remarks

This is simply a wrapper for GetItemPossessedBy().

This function is also present in the exact same format in both nw_i0_tool . Code duplication verified in version 1.69.


Requirements

#include " nw_i0_tool "

Version

1.22

Example

// Checks to see if the speaking PC possesses an item TAGGED as "Jarls_Head".
#include "nw_i0_plot"
 
void main()
{
   object oPC = GetLastSpeaker();
 
   if(HasItem(oPC, "Jarls_Head") == TRUE) 
   {
      // The PCSpeaker has Jarls_Head.
      // Do stuff here based on the PC possessing the object "Jarls_Head".
 
   } 
   else 
   {
     // The PCSpeaker does not have Jarls_Head.
     // Do stuff here based on the PC NOT possessing the object "Jarls_Head".
   }
}

See Also

functions: 

GetItemPossessedBy



 author: Tom Cassiotis, editors: Mistress, Kolyana