D&D Style Point Buy Attribute System

Even though I know that multiple attribute leveling scripts already exist, none of them fit my requirements well enough to continue using them. Currently I'm using V's Level Up Stats.

What I need is a copy of the D&D point buy system. Star Wars: Knights of the Old Republic uses such a system, and that system is what I want to replicate.

To copy/paste from the KOTOR strategy wiki, this how the point buy system works:

"Each of the six physical attributes is at 8, with 30 points to invest in them. Any attribute can be increased to a maximum of 18 at this time, but beyond 14 there are increased point costs:"

1700545237003.png


This needs to happen in a screen accessible from the in-game menu.

The level up/point buy screen would show the attributes that can be raised/lowered, the points available to spend, arrows/symbols for increasing/decreasing attributes, and an area showing how much an attribute would cost to increase. It also needs to be able to switch between members in the party.

I would also like to be able to make a script call to open this screen. Once the player allocates their points, their attributes are set that way. Point buy only happens at level 1 to set your initial attributes.

This screen will also incorporate the normal attribute leveling too. I would like to be able to set it to how many attribute points characters can gain on level up and also set how many level ups it takes to gain attribute points. For instance, characters getting one attribute point to spend every four levels.

I know it's a lot and there might be something I'm forgetting to mention. If someone is willing to take on this project, I'll be super grateful!
Using a script from miguel8884, I modified it to cover the basics of what you want.
Try it out and let me know if it works as desired.
I'm impressed! Most of the basics are there. I actually like that the point buy system only works on the main character, which means I can set the initial attribute blocks of party members.

I found an issue. When I try to increase points in the scene after it's called by script, it gives me an error. I don't get the error if I try to increase points from the menu scene.

Untitled.png

1700716891203.png


Can I have the right arrow be changed from a keystroke to an icon or picture? I'm using a font which doesn't have a right facing arrow, so I am making do with a dash and "greater than" symbol.

1700719092901.png



Some things I would add:
  • Showing the character's name, maybe to the left of the HP gauge. It's confusing if players don't know which character they are increasing the attributes for.
  • A way to gain back points in case the player accidentally puts a point in an attribute. Their attribute choices would "lock" after leaving the menu (or maybe have an "accept distribution" selection to finalize choices).
  • The "normal leveling" system I mentioned in my initial post. The player would be able to switch between party members for this. I would also be able to se the maximum level attributes can be increased to. 18 is only the max for the initial point buy.
I'm impressed! Most of the basics are there. I actually like that the point buy system only works on the main character, which means I can set the initial attribute blocks of party members.

I found an issue. When I try to increase points in the scene after it's called by script, it gives me an error. I don't get the error if I try to increase points from the menu scene.
I missed a part. You should be able to switch between actors. Unless you really want it to only be the main character.
Fixed the error

Can I have the right arrow be changed from a keystroke to an icon or picture? I'm using a font which doesn't have a right facing arrow, so I am making do with a dash and "greater than" symbol.
Added icon option

Some things I would add:
  • Showing the character's name, maybe to the left of the HP gauge. It's confusing if players don't know which character they are increasing the attributes for.
  • A way to gain back points in case the player accidentally puts a point in an attribute. Their attribute choices would "lock" after leaving the menu (or maybe have an "accept distribution" selection to finalize choices).
  • The "normal leveling" system I mentioned in my initial post. The player would be able to switch between party members for this. I would also be able to se the maximum level attributes can be increased to. 18 is only the max for the initial point buy.
Added Character name and class to param window

I'll have to do more to be able to revert points. Stand by.

Can you explain in detail the 'see maximum level attributes' only for initial?
I need to understand this.

I'll update the script post when you explain more and I get it finished.
1700748681121.png


Will you be adjusting for profession and race?

Adjusting the windows
1700759027119.png
You should be able to switch between actors. Unless you really want it to only be the main character.
I would prefer only the main character being able to use the point buy system at level 1. All other party members will start with chosen attributes and can only increase attributes through the normal leveling system.

Can you explain in detail the 'see maximum level attributes' only for initial?
I need to understand this.
When the player starts at level 1, I want them to have an attribute limit of 18 when using the point buy system. When they level up past level 1, then the normal leveling system takes over and the maximum points allowed to be put into an attribute is raised to 30.

Level 1: Point Buy system is used. 18 is the maximum an attribute can be raised.

Level 2+: Normal leveling system is used. 30 (or whatever number, usually 20 or higher) is the maximum an attribute can be raised.

Does that all make sense?

Will you be adjusting for profession and race?
All party members, regardless of race or profession, will use the six attributes.
I would prefer only the main character being able to use the point buy system at level 1. All other party members will start with chosen attributes and can only increase attributes through the normal leveling system.
If they can use this system after level 1 then I won't block it for any. The way around it would be for you to assign their starting stats and not have any actors with starting points. and give the starting points to the main actor.

When the player starts at level 1, I want them to have an attribute limit of 18 when using the point buy system. When they level up past level 1, then the normal leveling system takes over and the maximum points allowed to be put into an attribute is raised to 30.
Done, you will just have to add on the stages where the points will increase in cost. I currently have them set to 22 with the max at 24. so adjust as you see fit.

Level 1: Point Buy system is used. 18 is the maximum an attribute can be raised.

Level 2+: Normal leveling system is used. 30 (or whatever number, usually 20 or higher) is the maximum an attribute can be raised.

Does that all make sense?
all good.
But this script does not give points when leveling up. I could maybe add it in if you don't have something to give points when leveling.

All party members, regardless of race or profession, will use the six attributes.
What I meant was ...
Human starts with all 8's.
Elf has 10 int the rest 8
Dwarf has 10 strength the rest 8
etc
for example.

If all start at 8 and they can adjust as you see fit, then we are all good. It's because you're only adjusting the main character, but if you had a character build system then you would need to account for race abilities and such.
(yes I played D&D)

I found another issue. If I go into the point buy screen a second time after initially spending all the points, it won't allow me to press escape to leave.

If they can use this system after level 1 then I won't block it for any. The way around it would be for you to assign their starting stats and not have any actors with starting points. and give the starting points to the main actor.
That makes sense. I didn't think of that solution and it should work great!

all good.
But this script does not give points when leveling up. I could maybe add it in if you don't have something to give points when leveling.
I intended for the point buy system to only be used at the beginning of the game, to customize the player's attributes at level 1.

After the initial 30 points are allocated, it would switch to the normal leveling system for the rest of the game.

The normal leveling can share most of the same screen details. The only difference is that increasing attributes would only cost 1 point, but you only get 1 point to spend every 4 levels (or however many it's configured for). This would apply to all party members. This is also where the attribute maximum would be raised to 20+.

I don't know if this would have to be another script or if it could be included. Sorry if I wasn't more clear about how the normal leveling system is separate from the point buy system! I'm super appreciative of all your help so far!

What I meant was ...
Human starts with all 8's.
Elf has 10 int the rest 8
Dwarf has 10 strength the rest 8
etc
for example.

If all start at 8 and they can adjust as you see fit, then we are all good. It's because you're only adjusting the main character, but if you had a character build system then you would need to account for race abilities and such.
(yes I played D&D)
I understand what you mean now. I'm not having multiple races select-able for the main character, so I only need the one set where it starts with all 8's.
If I go into the point buy screen a second time after initially spending all the points, it won't allow me to press escape to leave.
I'm not getting that.
I added a feature that if the actor in the party has points to spend, then you have to spend them unless the cost is higher than the points left.

I intended for the point buy system to only be used at the beginning of the game, to customize the player's attributes at level 1.

After the initial 30 points are allocated, it would switch to the normal leveling system for the rest of the game.

The normal leveling can share most of the same screen details. The only difference is that increasing attributes would only cost 1 point, but you only get 1 point to spend every 4 levels (or however many it's configured for). This would apply to all party members. This is also where the attribute maximum would be raised to 20+.

I don't know if this would have to be another script or if it could be included. Sorry if I wasn't more clear about how the normal leveling system is separate from the point buy system! I'm super appreciative of all your help so far!
I think I'll need to make a custom script for your game and not a generic one for most people wanting this.
Will this stat distribution be only for the main player? Will the main player always be in position 0 (the front of the party)?I can remove a lot of things I've built in. So mostly the first version of the script.

How many point would an actor get when leveling up?
Does every actor get these points?

Will this stat distribution be only for the main player? Will the main player always be in position 0 (the front of the party)?I can remove a lot of things I've built in. So mostly the first version of the script.
If you are talking about the point buy system, it will only be for the main character at level 1.

if you are talking about the normal leveling system, that is for the whole party and future party members who will join.

The player should always be at the head of the party. I haven't done or planned anything that changes the formation yet.


How many point would an actor get when leveling up?
Does every actor get these points?
Each actor will gain 1 point every 4 levels, so by level 20, they will have gotten 5 points. Every actor in the party does get these points.
Then either this system I made is a one time use or needs a lot of changes.

So I'm guessing that you want the point buy system to function for level one. with the increase cost for then, but after gaining points later at level 4 it will only cost 1 point?

Honestly it's getting a little annoying because I am trying to make what you want but you're not explaining in detail.
Because I don't know if you have another point system for the levels 4, 8, etc. or if you are wanting this script to work for all of it?
Getting information for what you want is getting pretty hard. After all of this I have an idea of what you want but I also thought I knew what you wanted for every other version of the script.

Please explain the process and how the script will work. for either just level 1 for the main character or for all levels.

I hope this covers all your requirements. If not you need to give a detailed process. Step by step.
I've done some initial testing and all works.
can only enter points for the main actor for the first time.
Points are only given to the main actor at the start
Max points after the initial 18 limit is in the config (30)
Points have the increase cost for the initial allocation, then 1 cost after that.
Actor gains 1 point every 4 levels.
EDIT: Hold on, I just noticed you edited your previous post. I'll check it out!


I'm really sorry for for the confusion! It's my fault for mixing the other leveling system I had in mind with the point buy system. I thought it would be simpler for them both to share the same graphical layout.

Then either this system I made is a one time use or needs a lot of changes.

The point buy system is a one time use.

As it currently stands, the point buy system you've made is almost perfect. Can you please add back in the feature that forces the player to spend all their points? I noticed that was taken out. Otherwise, I'm really happy with your work!

Because I don't know if you have another point system for the levels 4, 8, etc. or if you are wanting this script to work for all of it?

I don't have another point system for levels 4, 8, etc. To make this easier for both of us, I'll just make a separate topic for the other point system and that can be a different script (unless you believe it's better to make that system and the point buy into one script).

Once again, I'm really sorry for confusing you and making a mess of this.
The point buy system is a one time use.
Well now I think it does all you want. after the initial point expenditure it will work as a one point system.
As it currently stands, the point buy system you've made is almost perfect. Can you please add back in the feature that forces the player to spend all their points? I noticed that was taken out. Otherwise, I'm really happy with your work!
Do you mean every time? As it stands now it forces you to spend the initial points, after that it's optional.
I don't have another point system for levels 4, 8, etc. To make this easier for both of us, I'll just make a separate topic for the other point system and that can be a different script (unless you believe it's better to make that system and the point buy into one script).
Did you try the script I just posted above? and read the notes above it?
Once again, I'm really sorry for confusing you and making a mess of this.
It is just one of my pet peeves. Getting information in pieces.
Did you try the script I just posted above? and read the notes above it?
I posted that reply before I saw your post edit with the newest script.

So far your newest version works amazing and I love it! 😤

There's a weird issue where a party member's maximum health increases every time I open and close the normal in-game menu, once they get to level 10 and beyond.

It's related to this bit of script which I added to a different D&D script. It increases max hp when the defense parameter is increased.

Ruby:
  # Behold the Power of Constitution
  #--------------------------------------------------------------------------
  # * overwrite method: mhp
  #--------------------------------------------------------------------------
  def mhp;  param(0)+(((self.def-10)/2)*5).to_i;   end # MHP

Do you know if this could have an incompatibility with your script?
Do you know if this could have an incompatibility with your script?
I can test this, if I know more about that script.
What class is that method in?

Actually looking at it more I can see how it would cause issues.
But still depending on where it is located would make the difference.
If it in a class or called by a method that is influenced by my script then yes it would be an incompatibility.
No idea if you can provide this other script. if you could it would help.
I can test this, if I know more about that script.
What class is that method in?

Actually looking at it more I can see how it would cause issues.
But still depending on where it is located would make the difference.
If it in a class or called by a method that is influenced by my script then yes it would be an incompatibility.
No idea if you can provide this other script. if you could it would help.
Here's the class it's in.

Spoiler: Class
Ruby:
#==============================================================================
# ¡ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler

  # Returns the default proficiency calculation for the actor.  This is used
  # in chance to hit, class saving throws, setting skill DCs, skill checks,
  # and calculating the hit bonus on the status screen.  If you don't want
  # characters to have a proficiency bonus or you want it to be different by
  # class, modify this method.  Since it's located in Game_Actor, you can pull
  # class and level information directly from self.
  #--------------------------------------------------------------------------
  # * new method: proficiency
  #--------------------------------------------------------------------------
  def proficiency
    return (level+1)/4+1
  end
 
  # Behold the Power of Constitution
  #--------------------------------------------------------------------------
  # * overwrite method: mhp
  #--------------------------------------------------------------------------
  def mhp;  param(0)+(((self.def-10)/2)*5).to_i;   end # MHP


end # Game_Actor


Here's the overall script itself. This script was never actually finished by the author, but it works well enough for my purposes.

Spoiler: D&D script
Ruby:
#==============================================================================
#
# D&D Core Rules Engine Ace v1.0
# Written by Kyutaru
# -- Last Updated: 2014.01.15
# -- Level: Easy, Normal
# -- Requires: n/a
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This is the core engine for D&D Core Rules, made for RPG Maker VX Ace.
# This script changes the core battle mechanics to the standard d20 system.
# All the core rules will be in this document.  Rules that are overwritten by
# certain class abilities will be in the Class document for that class.
#
# -----------------------------------------------------------------------------
# Hit Rate and Evasion Rate (+Magical Evasion Rate)
# -----------------------------------------------------------------------------
# - In order to accomodate all of the D&D stats, hit rate and evasion rate will
# substitute for Attack Bonus and Armor Class.  Effects that boost Strength or
# Dexterity will automatically boost hit chance depending on class.  Magical
# Evasion Rate is also used here for ranged or melee touch attacks.  Hit rate
# can now exceed 100% so if you are planning on making something immune to
# magic, give it at least three magic evasion features and ensure no magical
# attacks are set to Certain Hit or have perfect hit symphonies.  Reflect still
# works as a magic barrier and Counterattack has been replaced with miss chance.
#
# -----------------------------------------------------------------------------
# THAC0 (To Hit Armor Class 0)
# -----------------------------------------------------------------------------
# - Chance to hit is no longer a definite value.  It is a comparison of the
# difference between your Hit Rate and the target's Evasion Rate (or for magic
# attacks, the target's Magical Evasion Rate).  This value is balanced around
# Armor Class 0, the point at which you have a guaranteed chance to hit (except
# for critical misses).  All battlers are assumed to have an armor class of 10
# unless their evasion is adjusted so there will be a 50% chance of hitting an
# enemy with no Hit Rate or Evasion Rate modifications.  For creatures with
# negative Attack Bonuses or Armor Class lower than 10, use negative rates.
# Note: by default, Hit Rate is only added to PHYSICAL attacks.  Magical attacks
# will only benefit from the ability modifier and proficiency of the user.  This
# means any custom effects that boost hit rate directly will NOT affect magical
# hit abilities.  This allows you to bless your weapons with improved hit chance
# that doesn't suddenly make your fireball more accurate.
#
# -----------------------------------------------------------------------------
# Critical Miss
# -----------------------------------------------------------------------------
# - Critical misses are represented accurately.  No matter how high your chance
# to land a hit becomes, you will always have a 5% chance to miss.  For skills
# that have 100% hit rates, use perfect hit symphonies or Certain Hit.
#
# -----------------------------------------------------------------------------
# Critical Hits / Damage
# -----------------------------------------------------------------------------
# - Critical hits are also represented accurately.  If you land a hit, the roll
# will be compared to your Critical Chance, which represents your threat range.
# Critical damage is determined by weapon type.  You may add more weapon types,
# just copy the scripting and edit the values.  Unlike hit and evasion, there is
# no default value for critical chance so make sure all actors are given at
# least 5% crit chance or they will not be able to critically hit.  I left this
# feature in case you wanted to disable critical hits entirely.
#
# -----------------------------------------------------------------------------
# Counterattack (CNT) and Ethereal Effects
# -----------------------------------------------------------------------------
# - With Evasion Rate no longer controlling evading, counterattack has been
# removed and now controls ethereal effects (blur, displacement, ghost, etc).
# Simply enter the miss chance into the CNT parameter and it will operate just
# like the old Evasion Rate/Magical Evasion Rate.  This will have no effect on
# perfect hit symphonies.  Accuracy must be a factor for miss chance to apply.
#
# -----------------------------------------------------------------------------
# Ability Checks and Saving Throws
# -----------------------------------------------------------------------------
# - Abilities are stored in a hash referenced by keys, along with their strings
# and numerical paramater id.  You can add more abilities to the hash if you
# want more than six stats.  Just ensure each one has its own key and parameter
# reference or you might see weird math occurring.  You can use rolld20 to
# perform the roll and add whatever modifiers (including ability) that you see
# fit to add.  The method rolld20 also has a built in Advantage and Disadvantage
# mechanic which is optional to use and allows you to grant the user a reroll
# to either keep the higher or lower number.  Saving Throws automatically add
# the class proficiency bonus to the GOOD saves of that class as determined by
# the CLASS_TYPE hash (see Class Attributes below).  Like rolld20, saving throws
# may have Advantage or Disadvantage.  The proper format for saving throws is:
# -- saving_throw(user, item, ability, dc, type="NONE", adv=false, disad=false)
#   Where:  user = the attacker
#           item = the skill or item
#           ability = the hash key (colon plus first three letters of ability)
#           dc = the Difficulty Class
# Type exists for custom saving throw types such as Mind Affecting, however this
# requires custom scripting within this method to use.  There are an infinite
# number of types you can choose so implement your own effects here.  To add
# advantage or disadvantage to the check, replace adv or disad with true.
#
# -----------------------------------------------------------------------------
# Class Attributes
# -----------------------------------------------------------------------------
# Special class properties are also defined within the Dragons module.  You can
# add new classes by adding more keys, more class id references, and whatever
# attributes you see fit (just add them after existing ones for compability).
# By default, the class attributes given are as follows:
# -- class_id => key, save1, save2, skill mod, attack mod
#   Where:  class_id = the id number of the class, used as the hash key
#           key = the class identification key, used as an identifier
#           save1 = the first good save of the class, proficiency is added
#           save2 = the second good save of the class, proficiency is added
#           skill mod = the modifier used for magical attack hit calculations
#           attack mod = the modifier used for physical attack hit calculations
# You can give a class one or none good saves by entering a blank string.  The
# skill and attack mods are for skills that use Physical Hit or Magical Hit and
# will not apply to Certain Hit skills.  You can also override the attribute
# used for any skill using the note box tag <hit calc: x> where x is the string
# version of the hash key tied to the ability score.
# Example: <hit calc: dex> would make that skill use Dexterity to calculate hit
# chance instead of whatever the class skill/attack mods were.  Since weapons
# can also have custom skills for their normal attack using Yanfly's WAR script,
# you can give individual weapons their own attribute for hit chance.
#
# -----------------------------------------------------------------------------
# Weapon and Skill Attacks
# -----------------------------------------------------------------------------
# By default, weapon and skill attacks will use the modifiers associated with
# the class of the attacking actor, one for physical hits and one for magical
# hits.  Enemies by default will use Strength to calculate physical hits and
# Intelligence to calculate magical hits.  These can all be customized using
# <hit calc: x> tags in the skill or enemy note box.  Weapons can be customized
# by first creating a weapon attack skill replacement using Yanfly Engine's
# Weapon Attack Replace script (see script for details).  Damage is never
# directly modified for obvious reasons.  To modify damage by ability, have the
# attacker object call the mod method with a hash key reference to the ability
# you want to use for damage.  This goes into the custom damage formula box.
# Example: a.mod(:str) will add the attacker's strength modifier to the damage.
#
# -----------------------------------------------------------------------------
# Constitution and Hitpoints
# -----------------------------------------------------------------------------
# By default, Constitution will boost or lower the actor's maximum hitpoints.
# Note that this is maximum hitpoints only!  You will still need to restore the
# difference with a healing spell.  If you do not want Constitution to boost
# hitpoints, search below for the mhp method and comment it out or delete it.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
# To make this script work correctly with YEA - Battle Engine Ace, you have to
# put this script before YEA - Battle Engine Ace.
#
#==============================================================================

module Dragons

  # Controls the ability checks including saving throws
  # Usage = :ability => ["Ability String", paramID]
  # Saving throws and ability checks will reference the check variable
  # and return the string to be parsed with class saves.
  ABILITY_CHECK ={
    :str  => ["STR", 2],   # Strength checks
    :ref  => ["REF", 6],   # Dexterity checks -> Reflexes Checks
    :bod  => ["BOD", 3],   # Constitution checks -> Body Checks
    :int  => ["INT", 4],   # Intelligence checks
    :wil  => ["WIL", 5],   # Wisdom checks -> Willpower Checks
    :cha  => ["CHA", 7],   # Charisma checks
  } # Do not remove this.

  # This defines the classes and their characteristics, more can be added.
  # Saving throws and other checks where class is pertinent will reference
  # class_id and return the class array.  The array contains all basic stat
  # modifiers of the class including the two good saves, the primary ability
  # score used for skill DCs, and the score that affects hit chance/damage.
  CLASS_TYPE ={
  # ID  =>  [ Type,     Save1, Save2, Skill, Attack ]
    1   =>  [:wanderer,  "REF", "BOD", :int, :ref],
    2   =>  [:streetwarrior,  "STR", "BOD", :int, :str],
    3   =>  [:techhead,  "REF", "BOD", :int, :ref],
    9   =>  [:securityrobot,"REF", "BOD", :int, :ref],
    10  =>  [:streetwarrior,  "STR", "BOD", :int, :str],
    12  =>  [:techhead,  "REF", "BOD", :int, :ref],
  } # Do not remove this.

  # Do not remove this, it's for parsing notetags
  HIT_CALC = /<(?:HIT_CALC|hit calc):[ ]*(.*)>/i
  #HIT_BONUS = /<(?:HIT_BONUS|hit bonus):[ ](\d+)>/i

end # Dragons

#==============================================================================
# ¡ Game_BattlerBase
#==============================================================================

class Game_BattlerBase

  #--------------------------------------------------------------------------
  # * Constants (Starting Number of Buff/Debuff Icons)
  #--------------------------------------------------------------------------
  ICON_BUFF_START       = 10096   # buff (16 icons)
  ICON_DEBUFF_START     = 10112   # debuff (16 icons)

end # Game_BattlerBase

#==============================================================================
# ¡ Game_Battler
#==============================================================================

class Game_Battler < Game_BattlerBase

  # This defines the d20 roll mechanic.  A separate method is used in order
  # to enable special modifiers including Advantage and Disadvantage that
  # would be tedious to replicate over and over again.  Since this is for
  # battlers only, it is located in the Game_Battler class.  Attempts to call
  # this method from outside of battle may fail.
  #--------------------------------------------------------------------------
  # * new method: rolld20
  #--------------------------------------------------------------------------
  def rolld20(advantage=false, disadvantage=false)
    roll = 1+rand(20)
    # Advantages and Disadvantages cancel each other out
    if advantage && disadvantage
      return roll
    # Advantages are rolled again, keep the higher roll
    elsif advantage
      roll2 = 1+rand(20)
      roll = roll2 if roll2 > roll
    # Disadvantages are rolled again, keep the lower roll
    elsif disadvantage
      roll2 = 1+rand(20)
      roll = roll2 if roll2 < roll
    end
    return roll
  end # NEVER remove this!!!

  # What would Dungeons and Dragons be without the ability to roll a horde of
  # different dice with different numbers of sides and max values?
  # Comes with the ability to maximize the dice total, which you can set to a
  # variable for custom on-off switching.  Returns the total.
  #--------------------------------------------------------------------------
  # * new method: roll
  #--------------------------------------------------------------------------
  def roll(quantity=1, sides=100, maximize=false)
    total = 0
    return quantity * sides if maximize
    while quantity > 0
      total += 1+rand(sides)
      quantity -= 1
    end
    return total
  end

  # Returns whether or not the target made its saving throw.  The target is
  # whatever object called this method.  The user is the one attacking the
  # target.  The ability is the hash key tied to the ability score being saved
  # against.  The dc is the Difficulty Class of the check, the goal for success.
  # Optional saving throw types can be submitted for check customization.
  # This facilitates being able to modify the saving throw result according
  # to its type (example: if you have +4 vs mind-affecting skills).  It also
  # allows you to render certain mobs immune to certain types of skills.
  # Example: skills of type MIND_AFFECTING might be ineffective vs Undead.
  #--------------------------------------------------------------------------
  # * new method: saving_throw
  #--------------------------------------------------------------------------
  def saving_throw(user, ability, dc, type="NONE", adv=false, disad=false)
    score = Dragons::ABILITY_CHECK[ability]
    roll = rolld20(adv, disad) + mod(ability)
    if actor?
      save = Dragons::CLASS_TYPE[class_id]
      if (save[1]==score[0] or save[2]==score[0]); roll += proficiency; end
      end
    result = roll >= dc
    return result
  end

  # Sets the difficulty class automatically for typical class skills and spells.
  # The default formula is Skill Attribute + Proficiency + 8.  You can modify
  # the formula here to affect all standard DCs or just use custom DCs when
  # calling saving_throw.  This is mostly for spellcasting classes.  Custom DC
  # calls are easily done with a base plus the mod method.  This script is ONLY
  # intended for Actors.  Enemies tend to have set Difficulty Classes that are
  # independent of level and gear scaling, use mod for them.  If you happen to
  # submit an enemy to this method, such as if the skill is used by both actors
  # and enemies, the method will calculate the DC as 10 + the enemy's skillmod.
  # Note: It is assumed that only skills will call a skillDC method so this
  # method will call current_action to get the attacker's skill.  Items are
  # the other usable base item and they tend to have fixed DC checks.
  #--------------------------------------------------------------------------
  # * new method: skillDC
  #--------------------------------------------------------------------------
  def skillDC(user)
    item = user.current_action.item
    bonus = user.mod(user.skillmod(user.get_hit_calc(user, item)))
    if user.enemy?  # If it's an enemy, get rid of it with the default calc
      dc = 10 + bonus
    else # It should be an actor at this point, see below if it fails
      dc = 8 + user.proficiency + bonus
    end
    # The DC will be set at this point.  If you have skillDC in the damage
    # formula and nothing happens or it comes back as NULL, an error occured.
    # Errors in the damage formula will not crash the game so be sure your
    # syntax is correct when entering these methods into the damage formula.
    return dc
  end

  # Returns the ability score modifier equivalent to the hash key passed as
  # an argument.  Hash are defined in the Dragons module.  They're simply a
  # colon (:) followed by the first three letters of the ability score.
  # Example -- :str, :dex, :con, :int, :wis, :cha
  #--------------------------------------------------------------------------
  # * new method: mod - short for ability modifier
  #--------------------------------------------------------------------------
  def mod(key)
    return (param(Dragons::ABILITY_CHECK[key][1])-10)/2
  end

  # Returns the key tied to the ability score used by this actor's class for
  # physical attacks. This is used in conjuction with the mod(key) method.
  # Enemies have no class so they will return a default of Strength as their
  # hit modifier.  You can override the default modifiers and select your own
  # by passing any of the hash keys as an argument.  This exists for custom
  # scripts that don't use the standard method of calculating hit chance.
  # Be warned that the default modifier will affect the hit rate of all enemies.
  # To override hitmods by enemy OR by skill, see get_hit_calc below.
  #--------------------------------------------------------------------------
  # * new method: hitmod - short for ability score that applies to Physical Hit
  #--------------------------------------------------------------------------
  def hitmod(override=nil)
    modifier = :ref
    modifier = Dragons::CLASS_TYPE[class_id][4] if actor?
    modifier = override unless override==nil
    return modifier
  end

  # Returns the key tied to the ability score used by this actor's class for
  # magical attacks. This is used in conjuction with the mod(key) method.
  # Enemies have no class so they will return a default of Intelligence as their
  # hit modifier.  You can override the default modifiers and select your own
  # by passing any of the hash keys as an argument.  This exists for custom
  # scripts that don't use the standard method of calculating hit chance.
  # Currently, the skillmod REPLACES the normal hit bonus for magical attacks.
  # As magical attacks can be reflected, it is recommended to only use this for
  # actual magical attacks that require a chance to hit (not certain hit).
  # Instead of normal Armor Class, the defense of the target will be equal to
  # a base of 10 plus their magic evasion, making most targets easier to hit.
  # To override hitmods by enemy OR by skill, see get_hit_calc below.
  #--------------------------------------------------------------------------
  # * new method: skillmod - short for ability score that applies to Magic Hit
  #--------------------------------------------------------------------------
  def skillmod(override=nil)
    modifier = :int
    modifier = Dragons::CLASS_TYPE[class_id][3] if actor?
    modifier = override unless override==nil
    return modifier
  end

  # Default attack bonus is calculated according to one of two attributes.
  # Each class has two attributes defined for physical and magical attacks.
  # For more complicated attacks or for special attacks that use different
  # rulings, use a Certain Hit skill with a custom damage formula with a
  # conditional and assign an override.  Alternatively, to override individual
  # enemies or skills to use a different ability score, see get_hit_calc below.
  #--------------------------------------------------------------------------
  # * new method: attack_bonus
  #--------------------------------------------------------------------------
  def attack_bonus(user, item, override=nil)
    base = (item_hit(user, item)*20).to_i
    base += user.mod(user.hitmod(override)) if item.physical?
    base += user.mod(user.skillmod(override)) if item.magical?
    if user.actor?; base += user.proficiency; end
    return base
  end

  #--------------------------------------------------------------------------
  # * new method: armor_class
  #--------------------------------------------------------------------------
  def armor_class(user, item)
    base = 10 + (item_eva(user, item)*20).to_i
    return base
  end

  #--------------------------------------------------------------------------
  # * new method: critical_hit
  #--------------------------------------------------------------------------
  def critical_hit(user, item)
    base = 20 - (item_cri(user, item)*20).to_i
    return base
  end

  # This governs the overrides seen in attack_bonus, hitmod, and skillmod.
  # In order to use it, place the following string into the note box of any
  # enemy or skill.  Actors can already have custom hit formulas by class.
  # <hit calc: x> where x = str, dex, con, int, wis, or cha.
  # Example: <hit calc: dex> would change the hit modifier to dex for a skill.
  # To change the hit modifier for an individual weapon, use the Yanfly Engine
  # script Weapon Attack Replace to create a unique skill for that weapon.
  # Then you can force that skill to use a different ability modifier.
  # Note: this method eventually leads to ABILITY_CHECK in the Dragons module
  # so the string key entered into notes must exist as a key there.  You can
  # add your own custom stats and calculations by adding new keys to the hash.
  # Returns the symbol (i.e :dex) associated with the ability modifier.
  #--------------------------------------------------------------------------
  # * new method: get_hit_calc
  #--------------------------------------------------------------------------
  def get_hit_calc(user, item)
    type = nil
    if user.enemy?
      type = user.enemy.hit_calc.to_sym unless user.enemy.hit_calc==nil
    end
    type = item.hit_calc.to_sym unless item.hit_calc==nil
    return type
  end

  #--------------------------------------------------------------------------
  # * new method: item_thaco
  #--------------------------------------------------------------------------
  def item_thaco(user, item, d20)
    # New hit formula breaks Certain Hit abilities, this corrects that.
    return false if item.hit_type==0
    # New hit formula breaks item success rates, this corrects that.
    return true if item.success_rate<(rand(100)+1)
    if d20 == 20
      return false
    elsif d20 == 1
      return true
    return true
    end # Simulates critical successes and failures
    attackbonus = attack_bonus(user, item, get_hit_calc(user, item))
    armorclass = armor_class(user, item)
    thaco = d20 + attackbonus
    didattackmiss = thaco < armorclass
    hit = didattackmiss ? " MISS!" : " HIT!"
    return didattackmiss
  end

  #--------------------------------------------------------------------------
  # * overwrite method: item_apply
  #--------------------------------------------------------------------------
  def item_apply(user, item)
    roll = rolld20
    @result.clear
    @result.used = item_test(user, item)
    @result.missed = (@result.used && item_thaco(user, item, roll))
    @result.evaded = ([email protected] && rand < cnt)
    if @result.hit?
      unless item.damage.none?
        @result.critical = (roll > critical_hit(user, item))
        make_damage_value(user, item)
        execute_damage(user)
      end
      item.effects.each {|effect| item_effect_apply(user, item, effect) }
      item_user_effect(user, item)
    end
  end
 
    #--------------------------------------------------------------------------
  # * overwrite method: apply_critical
  #--------------------------------------------------------------------------
  def apply_critical(damage, user)
    type = [0]
    if user.actor?; type = user.weapons.collect{|wep| wep.wtype_id}; end
    case type[0]
    when 8 # These are the weapon types with x3 damage multiplier
      damage * 3; else; damage * 2; end
  end

  #--------------------------------------------------------------------------
  # * overwrite method: make_damage_value
  #--------------------------------------------------------------------------
  def make_damage_value(user, item)
    value = item.damage.eval(user, self, $game_variables)
    value *= item_element_rate(user, item)
    value *= pdr if item.physical?
    value *= mdr if item.magical?
    value *= rec if item.damage.recover?
    value = apply_variance(value, item.damage.variance)
    value = apply_guard(value)
    @result.make_damage(value.to_i, item)
  end

  #--------------------------------------------------------------------------
  # * overwrite method: item_hit
  #--------------------------------------------------------------------------
  def item_hit(user, item)
    rate = 0.0                          # Success rate is now part of thaco
    rate += user.hit if item.physical?  # Physical Attack Modifier
    return rate                         # Return calculated hit rate
  end

  #--------------------------------------------------------------------------
  # * overwrite method: item_cnt
  #--------------------------------------------------------------------------
  def item_cnt(user, item)
    return 0 # Disables counterattacks, CNT is now used for ethereal effects
  end

end # Game_Battler

#==============================================================================
# ¡ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler

  # Returns the default proficiency calculation for the actor.  This is used
  # in chance to hit, class saving throws, setting skill DCs, skill checks,
  # and calculating the hit bonus on the status screen.  If you don't want
  # characters to have a proficiency bonus or you want it to be different by
  # class, modify this method.  Since it's located in Game_Actor, you can pull
  # class and level information directly from self.
  #--------------------------------------------------------------------------
  # * new method: proficiency
  #--------------------------------------------------------------------------
  def proficiency
    return (level+1)/4+1
  end
 
  # Behold the Power of Constitution
  #--------------------------------------------------------------------------
  # * overwrite method: mhp
  #--------------------------------------------------------------------------
  def mhp;  param(0)+(((self.def-10)/2)*5).to_i;   end # MHP


end # Game_Actor

#==============================================================================
# ¡ DataManager
#==============================================================================

module DataManager
 
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_hit_calc load_database; end
  def self.load_database
    load_database_hit_calc
    load_notetags_hit_calc
  end
 
  #--------------------------------------------------------------------------
  # new method: load_notetags_hit_calc
  #--------------------------------------------------------------------------
  def self.load_notetags_hit_calc
    groups = [$data_enemies, $data_skills]
    for group in groups
      for obj in group
        next if obj.nil?
        obj.load_notetags_hit_calc
      end
    end
  end
 
end # DataManager

#==============================================================================
# ¡ RPG::BaseItem
#==============================================================================

class RPG::BaseItem
 
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :hit_calc
 
  #--------------------------------------------------------------------------
  # common cache: load_notetags_war
  #--------------------------------------------------------------------------
  def load_notetags_hit_calc
    #@hit_calc = nil
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when Dragons::HIT_CALC
        @hit_calc = $1.to_s
      end
    }
  end

end # RPG::BaseItem
There's a weird issue where a party member's maximum health increases every time I open and close the normal in-game menu, once they get to level 10 and beyond.
I'm not seeing that problem at all.
I did just find a bug in my script. I updated the post above.
Bug was when you get to level 4 and spend your one point on a stat that would have cost 3 initially, if you put the point in it and took it away you get 3 points back. So add one, get 3 back. Causing you to toggle back and forth and gaining 2 points every time.
Fixed.

Otherwise I'm not seeing any changes to the HP. I do see the hp change when I add dexterity stat points.
Here's a video showing it in action. Pay attention to Derek's MHP.

Here's a video showing it in action. Pay attention to Derek's MHP.


So what are the skills learned. Are any passive? Thick Skin sounds like something that would give a bonus.
So what are the skills learned. Are any passive? Thick Skin sounds like something that would give a bonus.
Those are passive. The Thick skin feat has a passive state that reduces damage taken by 1 point and that class learns three levels of the feat.

EDIT: I just took out your script and the issue persists...I'll have to figure this out.
I figured it out! It was related to the common event that only affected Derek at level 10.

Anyway, thank you so much for your help and patience with making this script! If I come across any other issues, I'll let you know.

I really can't thank you enough for all your help! 🙏

Original thread: https://forums.rpgmakerweb.com/threads/d-d-style-point-buy-attribute-system.163167/