# Character level and HP?

## Recommended Posts

So i'm a relative novice and was just wondering what determines how much HP a character gains each time they level up. I understand strength has a lot to do with it but have noticed characters on equal strength gain different amounts of HP.

##### Share on other sites

It would appear that there is a random factor involved in the HP gained with each level. Here is the relevant code:

Code:
`// This array is used in the code, but declared elsewhere.short skill_bonus[21] = {-3,-3,-2,-1,0,0,1,1,1,2,2,2,3,3,3,3,4,4,4,5,5};while (univ.party[pc_num].experience >= (univ.party[pc_num].level * (univ.party[pc_num].get_tnl()))) {    play_sound(7);    univ.party[pc_num].level++;    sprintf ((char *) c_line, "  %s is level %d!  ",(char *) univ.party[pc_num].name.c_str(),univ.party[pc_num].level);    add_string_to_buf((char *) c_line);		    univ.party[pc_num].skill_pts += (univ.party[pc_num].level < 20) ? 5 : 4;    add_hp = (univ.party[pc_num].level < 26) ? get_ran(1,2,6) + skill_bonus[univ.party[pc_num].skills[0]]        : max (skill_bonus[univ.party[pc_num].skills[0]],0);    if (add_hp < 0)        add_hp = 0;    univ.party[pc_num].max_health += add_hp;    if (univ.party[pc_num].max_health > 250)        univ.party[pc_num].max_health = 250;    univ.party[pc_num].cur_health += add_hp;    if (univ.party[pc_num].cur_health > 250)        univ.party[pc_num].cur_health = 250;    put_pc_screen();}`

Translated into English, this means the following: if the PC is below level 26, a random number from 2 to 5 is added to the skill bonus obtained from your strength, which is a number from -2 to 5. (If I'm not mistaken, the -3 entry would apply if your strength were 0, which isn't possible.) So, you gain between 0 and 10 health, with higher strength ensuring a higher gain. However, once you hit level 26 or above, the random factor is gone, and you just get your strength bonus added to your max health, which is a number from 0 to 5 depending on your strength.

...Another interesting thing to notice here is that you only get 4 skill points per level once you hit level 20. I never noticed that before.

##### Share on other sites

Brilliant thanks for that. At least there's not some unknown way to get higher HP gains it's just random.

Thanks for the help.

##### Share on other sites

Originally Posted By: Celtic Minstrel
If I'm not mistaken, the -3 entry would apply if your strength were 0, which isn't possible

Based on the skill_bonus array, it also apply if you have 1 strength.

Originally Posted By: Celtic Minstrel
So, you gain between 0 and 10 health, with higher strength ensuring a higher gain.

Exact, except that the random roll is inclusive, so the max is 6 and with the 5 max bonus, the gain is between 0 and 11, until level 26 is reached.

Originally Posted By: Celtic Minstrel
Another interesting thing to notice here is that you only get 4 skill points per level once you hit level 20. I never noticed that before.

Neither do i, but it's in the Windows code as well ... Must be that at such level, the visit to the trainer is less frequent

Chokboyz
##### Share on other sites

Originally Posted By: Chokboyz
Exact, except that the random roll is inclusive,
Oh, really? That's unusual... I just assumed it would follow standard conventions. And it's been a few months since I worked on the code, so I must've forgotten that quirk (if I ever knew it).

...I should probably take a look to make sure I haven't broken that behaviour, since I might have rewritten the get_ran function to use std::rand() instead of Quickdraw's Random() function.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.