Skip to content

Commit

Permalink
MaxLevel: Readme addition for Next Level xp workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikgit committed Oct 14, 2024
1 parent bd6577f commit cb20860
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions Plugins/MaxLevel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ This plugin extends the maximum level possibility from 40 to 60. The plugin prov
* The `NWNX_ELC` plugin is also needed to bypass the level restriction. No configuration is necessary though, merely loading this plugin is sufficient.

## Issues
* Spellcasters may not change spells when levelling up
* Next Level XP on Character Sheet shows an incorrect value
* Spellcasters may not change spells when levelling up.
* Next Level XP on Character Sheet shows an incorrect value. For a possible workaround see below.

## Setup
* Define your max levels variable in your server environment.
Expand All @@ -34,3 +34,26 @@ export NWNX_MAXLEVEL_MAX=45
45 46 0xFFFFFFF
```
* (Optional) Edit the class spell gain 2da files to provide more spells as levels progress. These are **cls_spgn_???.2da**. The spell known 2da is not worth changing as there's currently no client interface for PCs to change their known spells past level 40.

## Next Level XP workaround
Beginning at level 40 the xp value shown on the character sheet after "Next Level:" is incorrect.
This can be worked around with, with a tlk override for the strref 315 "Next Level" that also pushes the xp value out of view by use of a new line `\n`.
With NWNX this can be done per player and can show the actual value of xp needed for the next level so that it looks as usual.
```c
// Todo: Do something to get the PC object as oPC.
int nLevel = GetHitDice(oPC);
if (nLevel < 40)
{
// In case of a level down the override might not be needed anymore.
NWNX_Player_SetTlkOverride(oPC, 315, "");
}
else
{
string sNextLevel = IntToString((nLevel + 1) * nLevel * 500);
// The line above assumes you followed the same pattern of xp progression as the first 40 levels.
// If not, read from exptable.2da or do what you have to do to get the correct xp value for the next level.
NWNX_Player_SetTlkOverride(oPC, 315, "Next Level: " + sNextLevel + "\n");
}
```
Code like the above could for example be run in the base game events `EVENT_SCRIPT_MODULE_ON_CLIENT_ENTER`, `EVENT_SCRIPT_MODULE_ON_PLAYER_LEVEL_UP` and the NWNX event `NWNX_ON_LEVEL_DOWN_AFTER`.
An alternative would be the nwnx event before opening the character sheet `NWNX_ON_CHARACTER_SHEET_OPEN_BEFORE`.

0 comments on commit cb20860

Please sign in to comment.