HasGold

From NWN Lexicon



Contents

[edit] HasGold(int, object)

Determines if a player has more than a certain amount of gold on them.

int HasGold(
    int nAmount,
    object oGoldHolder
);

[edit] Parameters

nAmount

The amount of gold to check.

oGoldHolder

The person to check how much gold they carry.


[edit] Description

Returns TRUE if oGoldHolder has nAmount or more gold on them, otherwise returns FALSE.



[edit] Remarks

This is a wrapper function for GetGold().

Does not remove any gold from the inventory during the check.

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

// This example will check the player who is currently speaking to see if they have enough
// gold to purchase something for 250 GP.
#include "nw_i0_plot"
 
int StartingConditional()
{
   // Do they have enough gold to buy it?
   if(HasGold(250, GetPCSpeaker()))
   {
      // They have enough money.  Do something here.
 
      // Return success.
      return TRUE;
   }
   else
   {
      // They are poor, make the NPC insult them.
 
      // Return failure.
      return FALSE;
   }
}

[edit] See Also

functions: 

GetGold



 author: Tom Cassiotis, editors: Charles Feduke, Mistress, Kolyana, additional contributor: Ivan Hawkes
 

Personal tools
Categories