Beamdog / nwn-issues

Neverwinter Nights: Enhanced Edition Technical Bug Tracker
http://nwn.beamdog.com
31 stars 1 forks source link

Racialtypes.2da custom races ability bonus can mess up with ruleset.2da CHARGEN_BASE_ABILITY_MIN_PRIMARY when adding a value higher than +2 to an ability of a race which is also the primary ability of the class you are picking #363

Open TomRotfl opened 3 years ago

TomRotfl commented 3 years ago

To Reproduce

1) Modify a racial ability bonus in racialtypes.2da (In this example, take Elf, modify IntAdjust to 6 to add +6 (or -6, the problem persists), during character creation) 2) Load the module, and while creating a new character, pick Wizard as class (we need a class which primary cast ability matches with a modified ability from the race we took) 3) You now end up with a value of INT which is set to 11 by default in the engine (regardless if the value set in the race increases or decreases the value for more than 3, while it should be 14 instead (8 + 6 racial bonus, or 2 if 8 - 6) 3a) Also, if +6 is added, the remaining 3 points are added to the pool of points left to appy, and so potentially removing the meaning of that race (see attached screen). 3b) Also, unless you set the INT value manually to 24 (the maximum, 18 + 6 racial bonus), the ELC will refuse the character.

NOTE: if you instead select a class that has as primary ability another ability and not the one boosted in racialtypes.2da, the INT value is properly set to 14, and everything else work fine (see attached screen).

So the issue is specifically with primary cast abilities and races that apply changes to those abilities

Specifics

If needed, describe the bug

There is a problem while giving races a bonus to an ability that corresponds to a class primary cast ability, in example: wizard. If you select wizard during character creation it sets automatically the value at 11 regardless of the value +- set on the race you took. The problem arises when you modify a race to have an Intelligence boost bonus > 2, in this example, we gave Elf a boost to Intelligence of +6. So, during character creation, theoretically, the Intelligence bonus has to be set automatically at 14 (8 + 6 Racial bonus). It works fine in all cases when you pick other classes BUT when you select Wizard as class (which has as primary cast ability INT), in that case the value is set to 11 by default, leaving 3 points out that you can use on other abilities (and so potentially break the meaning of that race). It also causes ELC to refuse the character unless you set the Intelligence value manually to the maximum (18 + 6 Racial bonus).

Attached screenshots. Please let me know if more is needed, i can provide more data or tools for you to understand and solve the issue.

wiz other

virusman commented 3 years ago

Can you post a test module? The fewer additional steps to reproduce, the better. Ideally a test module along with: 1) what happens; 2) what should happen instead and why.

TomRotfl commented 3 years ago

Can you post a test module? The fewer additional steps to reproduce, the better. Ideally a test module along with: 1) what happens; 2) what should happen instead and why.

Attached there is a zip archive with the following files on it race_test.zip

  1. Human race has under IntAdjust the value 6 (so INT is boosted +6 during character creation)
  2. Half-Elf race has under IntAdjust the value -6 (so INT is nerfed -6 during character creation)

How to use:

  1. Add the racialtypes.2da into the override folder
  2. Add the race_test.mod module into the module folder
  3. Run the game
  4. Run the module locally

Now, i prepared 4 different tests:

RACE WITH INT BOOST TEST:

  1. Create a human character and pick wizard as class. You will notice that the INT value is only 11, while it should be 14 (8 default + 6 race boost). The remaining 3 points are left in the pool of the points to assign (which means, a character could abuse the +6 by creating this character, and use the remaining 3 points elsewhere) human_wizard

  2. Create a human character and pick anything BUT wizard as class. You will notice that the INT value is properly raised at 14 (8 default + 6 race boost). The remaining points in the pool are correct, and everything else look fine. human_fighter

RACE WITH INT NERF TEST:

  1. Create a half-elf character and pick wizard as class. You will notice that the INT value is kept at 11, while it should be 2 (8 default - 6 race nerf). The points needed to go from 2 to 11 (9), are taken from the points in the pool by the engine, which "should" be more, since it would cost more than 9 points to go from a base ability of 2 to 11 (it should cost 13 points), the same as going from 8 to 17 for a normal ability without buffs/debuffs. half-elf_wizard

  2. Create a half-elf character and pick anything BUT wizard as class. You will notice that the INT value is properly reduced to 2 (8 default - 6 race nerf). The remaining points in the pool are correct, if you try to raise the points from 2 to 11, it takes 13 points from the pool as it should, and everything else look fine. half-elf_fighter

Conclusions: The problem occurs ONLY when a race is modified/added and a statistic used as primary cast ability by a class is modified for that race (either positively or negatively).

Why is this a problem: In my case, as example, i wanted to create a race, with wizard as favored class, with the value of INT boosted, and currently, it is not possible. This is applicable to different other use cases as well.

Please let me know if more is needed from your side.

ID99374836576228 commented 5 months ago

Setting CHARGEN_BASE_ABILITY_MIN_PRIMARY to -1 in ruleset.2da seem to be a decent workaround for this issue. The downside is that the minimum primary ability is no longer enforced leading to possibilities like creating spell-casters which do not satisfy requirements on level 1 spells.

TomRotfl commented 5 months ago

So far I have worked around that thanks to the NWNX plugin that allows me to hook the ELC and run my custom code. The solution you propose would allow the character to login, but it would still ignore the race specified modifier to be imposed, thus it still requires an external plugin to make the check. Thanks for the info though, helpful!

ID99374836576228 commented 5 months ago

So far I have worked around that thanks to the NWNX plugin that allows me to hook the ELC and run my custom code. The solution you propose would allow the character to login, but it would still ignore the race specified modifier to be imposed, thus it still requires an external plugin to make the check. Thanks for the info though, helpful!

In my tests, all the racial modifiers are applied correctly with the setting I've described. I.e. both adjustments up and adjustments down beyond 2 on a primary stat are working correctly. This means that all racial modifiers are enforced correctly at character creation and the points pool is unaffected. For instance, if the race has STR +6 adjustment and chooses the Fighter class, it starts with 14 STR and it's impossible to adjust it down and the points pool sits correctly at 30.

As I've mentioned, the only downside is that if no racial modifiers are in play on a primary spell-casting stat, PC starts with the sheet of 8 spell-casting stat and has a choice to not distribute any points there (admittedly, that's a very odd choice - but technically still possible). In that case there could be issues with spell-casting.

EDIT

This seems to be not a workable solution after all. It only functions properly for non spell-casting classes. For spell-casters, the game seem to ignore PrimaryAbil and consider SpellCastingAbil in classses.2da. With setting CHARGEN_BASE_ABILITY_MIN_PRIMARY to -1 the results are really bad for those classes as the game indeed wraps it over on the unsigned integer type and sets the ability to 255.

Now that I've tested it better, it seems there's no simple workaround through just using 2DA. Apologies for confusion.