Skip to content

AddHitPoints Permanently. Is there a way?

HillyanHillyan Member Posts: 22
Hi, i have a pw from 12 years, i use prc/cep/cmp/cpp/ctp/bcm and many other haks without problems, with customized spells and prc spells.

I'm not a scripter but doing all alone, i've learned a lot.
I'm italian; my english could not be so correct.

Now i have a problem; i've searched on google and tried every workaround possible.
I use nwnx but not Leto. I don't use a myswl db;

is there a way to add permanently hitpoints to characters? I know how to identify control classes, how to script a legendary levels of my own creation, with a conversation. I never, NEVER achieve to add hit points via script.

I use nwnx to add and modify ability score, skill score, feats.
I can't add hit points. Do you know how to do this? I've opened hgll of funkyswerve. It's a great work; i've read several funky scripts but i don't use leto.
Is there another way? A function? a workaround?

Please, give me a tip.

Comments

  • SherincallSherincall Member Posts: 387
    Assuming this is for EE, look in nwnx_creature.nss, there's:
    // Gets the maximum hit points for creature for level. int NWNX_Creature_GetMaxHitPointsByLevel(object creature, int level); // Sets the maximum hit points for creature for level to nValue. void NWNX_Creature_SetMaxHitPointsByLevel(object creature, int level, int value);
  • HillyanHillyan Member Posts: 22
    It's not for the ee but that function is already in 1.69 nwnx.
    I try to explain better :)
    I would like to to add some X hitpoints to a player when he gains a legendary level (in conversation). I've done a script that after the eventual choice of ability/feat/skill, gets the current hitpoints, gets the hitpoints that the player should take on normal levelup (control class type + con mod + toughness feat) and gives me a total of hitpoints the player should have after leveling.

    I need a function to add some X hitpoints or a function that sets the maximum hitpoints of the player to a value X.

    In that function sherincall, there is the level int and i don't understand how to script it, because i made the legendary level system and i've a variable system, nothing more. If i put on int level the number 42 for example, i think it will not work
  • SherincallSherincall Member Posts: 387
    Creatures get their HP on a per-level basis, you cannot modify their total HP. This is so that when they lose a level, you know how much HP they need to lose.

    The level needs to be 1-40 for this work, and they need to have that level. So you can either modify it for level 1 (so they never lose it when losing levels) or for last level so they do.

    Just note that if you have e.g. level 40 fighter with 400hp, and you want to set their HP to 600, doing this:
    NWNX_Creature_SetMaxHitPointsByLevel(oPC, 1, 600);
    will make them have 990hp - 600 at level 1, and 10 at each level 2-40. Instead you need to set that level's max HP to desired max minus current max.
  • HillyanHillyan Member Posts: 22
    Thank you for your explanation. It is as i was thinking about.
    If i want to add hit points at every level after 40(i use levels made by me from 41 to 100), so Leto is the only option available? There is no function in nwnx that Adds hit points permanently as it is for modify ability score function.

    Someone can suggest me a way trhough Leto?
  • ShadooowShadooow Member Posts: 402
    My nwnx_patch can do that but it is available only for 1.69 - though the code can be easily ported to EE-nwnx (by someone else than me...).

    Basically creature/players max hitpoints are influenced by two local variables:
    HP_BONUS int X
    HP_% int X

    Both variables can contain negative number, HP_BONUS simply adds value to the max hitpoints, HP_% will add X% of the max hp to the max hp, ie: if player has 100hp and HP_% = 20 then his hitpoints will be 120. The percentual variable is calculated after maxhitpoints were modified by HP_BONUS variable.

    I even made new itemproperties to increase/decrease hitpoints that are using these variables but they are not part of the nwnx_patch plugin.
  • HillyanHillyan Member Posts: 22
    You should have a reward for this. Thank to you and also to sherincall. I will try and let you know here :)
  • SherincallSherincall Member Posts: 387
    Hillyan said:

    Thank you for your explanation. It is as i was thinking about.
    If i want to add hit points at every level after 40(i use levels made by me from 41 to 100), so Leto is the only option available? There is no function in nwnx that Adds hit points permanently as it is for modify ability score function.

    Someone can suggest me a way trhough Leto?

    You don't really have levels after 40 - the engine is limited to 40 levels in several places. You probably just have the players go through the 39->40 levelup screen, apply the bonuses to level 39 or something, then delevel them and have them levelup 39->40 again.
    In which case you want to apply the bonus to some level 1-39. If you support losing levels, you need to keep track of bonuses separately, so you only remove part of it when a player loses level e.g. 66.
  • HillyanHillyan Member Posts: 22
    Hi again shadoow. I've installed nwncx to my client side. Nwnx was already installed because i use it server and client side.

    I've dowloaded the patch.
    I've put the nwnx_patch.dll in my nwn main folder. How can i have in my toolset the new functions ?? (with the beautiful hp_bonus int). Is there something i have to do?
  • ShadooowShadooow Member Posts: 402
    as I said this works on variable, just add variable HP_BONUS to player with value you wish

    assuming you downloaded latest version it will work

    the plugin has regular functions for use too but i forgot to add the nwscript files into last version so to get them you need to download this but do not replace nwnx_patch, as this is the latest version and contain bugs - use this one
  • HillyanHillyan Member Posts: 22
    IT WORKS

    Ok, thanks. Just a last question. Every player will have to download the nwncx? I've added the latest nwnx patch to my client and to remote hosting server and it works. Now i wandering what files players will have to download. (NOW WE CAN USE PRC CLASSES FROM THE FIRST LEVEL thanks to that patch)
  • HillyanHillyan Member Posts: 22
    They most have only the patch or only the nwncx? I'm a bit confused after all my attempt to make it work.
  • ShadooowShadooow Member Posts: 402
    edited May 2018
    For this feature no they don't need nwncx_patch. That would be needed for custom spellcaster claasses.
  • ShadooowShadooow Member Posts: 402
    Hillyan said:

    Now i wandering what files players will have to download. (NOW WE CAN USE PRC CLASSES FROM THE FIRST LEVEL thanks to that patch)

    Ah yes this is feature of nwncx_patch, as long as preloading hak packs so you can select PRC feats and spells at lvl 1. So your players should be recommended to use nwncx + nwncx_patch but it is not required for most of nwnx_patch features.
  • HillyanHillyan Member Posts: 22
    I'm glad to say thanks you shadoow and also sherincall for your time and (without money) support. Great thanks for you and nwn. :)
  • ShadooowShadooow Member Posts: 402
    Just heads up.

    I started experimenting with this myself due to your interest. It seems there is small drawback, probably unwanted. I made itemproperty bonus hitpoints and while it works, after unequipping, the current hitpoints stays unchanged, I think expected behavior is to reduce current hp to match max hp after unequip.

    While this can be fixed via scripting (and there is a perfect function for that: NWNXPatch_SetCurrentHitPoints) I will try to fix this inside plugin.
  • HillyanHillyan Member Posts: 22
    Don't worry shadoow, i use it without problems via conversation.
    If a player take levels after 40 in my system, they have a conversation, similar to the conversation scripted fy funkyswerve for Higher ground. I've scripter from zero by myself my system. Everytime they take a level, they have bonus similar to normal levels (before 40), bonus to BAB every x levels (tier 1, 2, 3 classes - fighters, half-casters and casters), bonus to HP (thanks to you) based on constitution modifier and hit dice of the classes (i use prc so 200 classes different hit dice, grouped in groups), a feat every x levels, and skill points, together with bonus to abilities, every x levels.

    so i don't use your plugin with items. I use the function in a script in a conversation and it's a permanent modification.

    It's perfect.

    My problem now is that i would like to host a version of my mod also in NWN ee and this is a problem because now i use nwnx, nwnx patches, nwncx and i don't think that someone will ever port this for EE.
    :)
  • HillyanHillyan Member Posts: 22
    My host is windows. The problem it's this :) i forgot to write this important thing. Nwnx is ready for linux but it's not for windows and now i use also nwncx and your patches. I don't know how to host also in ee (i will not stop to host in 1.69 because some of my players don't want to buy ee)
  • ShadooowShadooow Member Posts: 402
    Yes thats problem, I suppose you could workaround this and script the bonus hp via temporary hitpoints and multiple hooks in spells and events to make sure that when player lost the temporary hp over max and gets healed he gets new temporary hp. Ugly solution but if thats the only thing you need nwnx for then it might be worth it.

    Or you can try that docker thingy, I didn't get into this myself but if I understand it correctly it should be a one-click-virtualmachine-linux server for windows. (But afaik this max hp modification isn't available on linux anyway)
Sign In or Register to comment.