TakeGold(int, object, int)

From NWN Lexicon
Jump to: navigation, search

Removes a given amount of gold from the targets inventory, and optionally removes it from the game.

void TakeGold(
    int nAmount,
    object oGoldHolder,
    int bDestroy = TRUE
);

Parameters

nAmount
The amount of gold to take.
oGoldHolder
The object to take the gold from.
bDestroy
Should the amount taken be removed from the game? (Default: TRUE)

Description

Removes nAmount gold from oGoldHolder and removes it from the game world. Can optionally be called to give the gold to the caller.

The caller needs to be a non-area and non-module object for it to work correctly. It can be the creature passed into oCreatureToTakeFrom, of course.

Remarks

Function can be found in nw_i0_plot.nss on line 44 and in nw_i0_tool.nss on line 55.

A very simple function which merely takes the passed in parameters and calls the TakeGoldFromCreature() function using those same parameters. It is also defined exactly the same in two different include files. This is also the unfortunate reason why you can't include those two files in the same script.

If the function caller (OBJECT_SELF) is the module or an area, this function will fail. If you want to use this function in an area or module event (like an area's OnEnter), you can use AssignCommand() or ExecuteScript() to assign the function to another object. Alternatively, since it works on triggers, you can just paint a trigger around the arrival area to get the same effect.

Requirements

#include "nw_i0_tool"

Version

1.22

See Also

functions:  TakeNumItems


author: John Shuell, editors: Lilac Soul, Mistress