BG3-Community-Library-Team / BG3-Community-Library

Baldur's Gate 3 Community Library exists to provide a common collection of Spells, Scripts, Items, Statuses, Passives, and other useful material that will assist modders in creating new content.
MIT License
92 stars 208 forks source link

DecreaseMaxHP function #89

Open violencepierre opened 1 year ago

violencepierre commented 1 year ago

Is your feature request related to a problem? Please describe. IncreaseMaxHP has a weird behavior with negative percentages. If you use negative percent, game treats it as if you're using deducting 1 hp instead. Tested with a character that has a 100 hp, the expectation was 95 (5% max hp deduction), but I got 99. However, if positive, you get 105 hp.

Describe the solution you'd like A similar function that does the same thing but takes percentages.

Describe alternatives you've considered A jank idea I had was to just multiply MaxHP by the percent I want, divide by 100, and that's my negative integer input for IncreaseMaxHP(). This is working, but then I'll have to put a condition that the caster's hp is not equal to anything that will make MaxHP negative. So far this is working but I'd like to think there's a better solution lol

Additional context My homebrew class needs to pay max hp tax for each invocation active, that will last as long as next long rest.

violencepierre commented 1 year ago

Im trippin, the function works for negatives. it's just using your original maxhp on your level, that's why even if i increase my max hp to 100 using boosts, it's still taking 1, becuase the 8 times .05 is .4, which game makes as 1

NellsRelo commented 1 year ago

Interesting, so the MaxHP value is tied to the combined Class level HPs, rather than the character's current maximum health, if I'm understanding correctly? Not totally sure how to go about making it work more intuitively, but maybe the Script Extender could help here. Could create a table that maps modified the actual MaxHP to characters, and reference that value rather than the coded-inMaxHP value, potentially. Not sure if it would work, but would be useful