PlotCanRemoveXP

From NWN Lexicon
Jump to: navigation, search


plotCanRemoveXP(int)

Returns TRUE if the player can afford to lose the indicated amount of XP without losing a level.

void plotCanRemoveXP(
    object oPC
    int nPenalty
);

Parameters

oPC

The character to check.

nPenalty

The amount of XP to check against.


Description

Returns TRUE if the player can afford to lose the indicated amount of XP without losing a level. Otherwise it returns FALSE.



Remarks

The formula this function tests against is: ((nHD * (nHD - 1)) / 2) * 1000; With nHD being oPC's hit dice .


Requirements

#include " nw_i0_plot "


Version

???

Example

// Lets' see if OBJECT_SELF can lose 5322 points of xp.
#include "nw_i0_plot"
 
void main()
{
   int nCheck = plotCanRemoveXP(OBJECT_SELF, 5322);
 
   if(TRUE == nCheck)
   {
      // Do stuff based on the fact the can lose the xp without losing a level.
   }
   else
   {
      // Do stuff based on the fact that they will lose a level if they lose the xp.
   }
}

See Also

functions: 

GetHitDice



author: Baragg, editors: Mistress, Kolyana