Aller au contenu

Photo

Need Help with NWNX Functions


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
_Guile

_Guile
  • Members
  • 685 messages
I'm not able to get the Max Hit Points to Set, for some reason...

#include "nwnx_funcs"

void main()
{
  object oPC = GetPCSpeaker();
  int nMax = GetMaxHitPoints(oPC);
  int nNext = nMax + 10;
  NWNXFuncs_SetMaxHitPoints(oPC, nNext);
}

Does Nothing (yes I'm hosting the module on a NWNX Lan Server)

Anyone know how this isn't working?

#2
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
It works (mostly) right with NPCs, who have a bonus HP data field that can be manipulated. Oddly, nMax + 10 was adding 11 HPs to the NPC I tested it with though. I couldn't get it to work at all with a PC.


NWNXFuncs_SetHitPointsByLevel(object oCreature, int iHP, int iLevel) -- that one will work for PCs, but I'm not sure you can use that to raise the HPs beyond what their max was at a given level without issues.
I think the particular check I'm thinking of is only done at level ups though, so with a level 40 character that might not ever become an issue.

Edit: This one might be useful as well, but I've never tried it.
void NWNXFuncs_ModHitPointsByLevel(object oCreature, int iHPMod, int iLevel);

Modifié par Failed.Bard, 23 septembre 2011 - 09:29 .


#3
_Guile

_Guile
  • Members
  • 685 messages
Thank you Failed.Bard, looks, like they will just have to settle for more HP for raised constitution.

Thanks. :D

#4
Baaleos

Baaleos
  • Members
  • 1 331 messages
It should be noted, that the nwnx SetMaxHitPoints by level function has a limitation of 255 hp per level.

If you try to raise your hit points per specific level, beyond this, it will wrap round, and return to 0 for that level.

I implimented a custom leveling system, that has your bioware level at level 1 always, but when your hp for level 1 approaches 255, then the system levels you to the next bioware level (2), which then provides you with an additional room for 255 more hp.

Its something along the lines of
x = CurrentMaxHP/255

if x >= CurrentBiowareLevel then we need to level up to the next bioware level.

Attempting to set MaxHP For a bioware level that you have not gained, will cause the server to crash.
Resolve this by
Leveling up to level 40, use Levelup henchman function, to do the leveling automatically.
Then de-level to level 1 again - This creates the fields and level stats structure, and can resolve the potential crashes.

Now the set hp at level function, shouldnt crash.

#5
_Guile

_Guile
  • Members
  • 685 messages
I'm not using it for henchmen, was going to use it in my Custom God Level System (bottom of the page)...

Anyway there was no need, as the PC gets 40 HP every time their constitution is raised by +2, so that's cool...