From NWN Lexicon
Revision as of 15:57, 24 December 2017 by Fp (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Determines the value of an item in gold pieces.

int GetGoldPieceValue(
    object oItem



The item to be appraised.


Returns the gold piece value of oItem, and 0 if oItem is not a valid item.

It can return 0 if the actual value is 0 because of the plot flag applied to items, or if it is lacking an amount of its stack needed (normally very low stacks of arrows, bullets and bolts).


If oItem is unidentified at the time you call this function, the base item cost will be returned. If you always want the identified price, use the function in the code sample. (Note, that function should not be edited to get the UNidentified cost of the item, since unidentifying an item will most likely cause equipped items to get unequipped).




// From the remarks above. This will get the identified value of
// oItem passed into this function.
int GetIdentifiedGoldPieceValue(object oItem)
    // Initial flag
    int bIdentified=GetIdentified(oItem);
    // If not already, set to identfied
    if (!bIdentified) SetIdentified(oItem, TRUE);
    // Get the GP value
    int nGP=GetGoldPieceValue(oItem);
    // Re-set the identification flag to its original
    SetIdentified(oItem, bIdentified);
    // Return the correct value
    return nGP;

See Also



 author: Tom Cassiotis, editor: Jasperre, additional contributor(s): Lilac Soul