HasItem

From NWN Lexicon


Contents

[edit] HasItem(object, string)

Determines if a creature possesses an item.

int HasItem(
    object oCreature,
    string sTag
);

[edit] Parameters

oCreature

The creature to check if they possess an item.

sTag

The item's tag to search for.


[edit] Description

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



[edit] 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.


[edit] Requirements

#include " nw_i0_tool "

[edit] Version

1.22

[edit] 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".
   }
}

[edit] See Also

functions: 

GetItemPossessedBy



 author: Tom Cassiotis, editors: Mistress, Kolyana
 

Personal tools
Categories