Required EXP / Exp Maths

Okay, so currently I'm stuck trying to make an event do something based on the current percentage of exp the player has based on their current level.

The problem I'm having is I just cannot find that data anywhere to write the script.
$gameActors._data[X]._exp shows the current exp gained.... But I am unable to find the required exp to level.
$dataClasses[X] has EXP params, which the engine uses to set the curve. But without knowing the math used to determine that curve, these numbers are useless.

Currently I'm under the impression I'm left with 2 options.
1. Write out the required exp (all 99 levels) into an array (though I 'really' don't want to @.@😉.
2. Grab a plugin to use a custom exp formula (Not against this, but I'm unsure of how it'd effect balancing).

So could someone please enlighten me. Whether I have to go with options 1 or 2, or if they just happen to know the default exp formula that I can then write out for my use. (Google has failed me).

Help is much appreciated.



Edit: Never Mind, I found it. There was a prototype function that calculates it all for me. Which let me know where to look to find the math formula in rmmz_objects.js.

I keep forgetting about prototypes in JS. Shows how new I am. Thank you for your time everyone.
class.expForLevel(level) ?
Google didnt gave me the answer but provided a nice workaround which could be doable on a smal scope but maybe not suitable for a big one.
In this Thread:
I found this Workaround suggested by @Darken :
IDK if my solution is the roughly the same as GRS's. But when setting a character's level it'll set their EXP to what's required. You could duplicate a hero with the same exp table and have their level always = the real characters level but +1 and grab their exp from there.
class.expForLevel(level) ?
Yeah, I found it shortly (45mins) after and realized it was a prototype function. I'm still new to JS so I forget to check those. 🙁
class.expForLevel(level) ?
Hey, sorry if this request is an inconvenience, but I am completely new to this.

Can anyone offer a quick clarification of this? I tried using this in a test and I obviously have no idea what I am doing.

Do you replace "class" with a value? Otherwise, how do you define the class you want? And what value do you use? I looked in the database and tried a few different things, but I kept getting errors.

Do you replace "(level)" with a value of the level desired, like "(10)"?

Could anyone give an example using real values? Say, getting the XP needed for a Knight at Level 10?

Again, sorry if this is a basic, obvious question and if I am way off, no worries. I will keep trying to learn as I go.

Thanks!
Note that expForLevel is actually a function on Game_Actor, i.e. it should be used as "actor.expForLevel".

@kvngreeley - examples:
  • $gameActors.actor(1).expForLevel(5)
    Get total EXP required for actor ID 1 to reach level 5.

  • $gameParty.members()[0].expForLevel(5)
    Get total EXP required for the party member in position 0 (leader) to reach level 5.
There are also related functions, e.g.
  • $gameActors.actor(2).currentExp()
    Get current total EXP for actor ID 2.

  • $gameActors.members()[1].nextRequiredExp()
    Get EXP required for the party member in position 1 (first follower) to reach the next level.
You can find many script calls (including the above) and examples in the document linked here:

@GmOcean - in case it helps: prototype is basically just JavaScript's way of defining classes (details). A prototype is a "blueprint" to determine what each instance of that object has available to it.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/required-exp-exp-maths.144168/