Hime's Custom EXP Curves?

Status
Not open for further replies.

Evil_Nazgul0616

Veteran
Veteran
Joined
Aug 29, 2013
Messages
79
Reaction score
0
First Language
English
Primarily Uses
Does anyone happen to have a copy of this script floating around on their system that I can use? The dropbox link for that particular script is not working and the script is not on Hime's site unlike most of their other scripts.

If not, then can somebody link me to an alternative? I need exp curves that are exponential and polynomial functions of the actor's level. (For instance, one curve is "exp to reach level = (that level)^3")
 

Nantas

- Game developer -
Veteran
Joined
Jan 7, 2017
Messages
209
Reaction score
138
First Language
French
Primarily Uses
RMMV
You can use Yanfly's Class Parameter plugin to do that. Just go to http://yanfly.moe/ and find it :)
 

Nantas

- Game developer -
Veteran
Joined
Jan 7, 2017
Messages
209
Reaction score
138
First Language
French
Primarily Uses
RMMV
Oh my god sorry I should look above the thread before answering :o
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
I have no idea how that script looks like, it is one of the few scripts I never even looked at, but here is how you can make your own exp formulas:
Code:
class Game_Actor < Game_Battler
 
  def exp_for_level(level)
    self.class.exp_for_level(level) # <-- Default way
  end

end
I just took the default method to show you where you need to adjust the thing.
You can simply remove that line (or keep it as a backup), and add your own formulas there.
The level argument will be an integer, and that defines for which level you check the EXP.

You can code there whatever you want but there are a few rules you must follow, or you will break the game:
  • The result of the method must return a positive (or 0) integer number.
  • Higher levels must require more EXP than lower levels.
These are the ones coming to mind now.

In case you want to make different EXP formulas for different actors, you can use the @actor_id instance variable to check for the actor's ID, and set a different formula for them based on that. For example:
Code:
class Game_Actor < Game_Battler
 
  def exp_for_level(level)
    case @actor_id
    when 1 # Formula for Actor 1
      # Insert formula here
    when 2 # Formula for Actor 2
      # Insert formula here
    else # Formula for any other actors
      # Insert formula here
    end
  end

end
You can also check for the class ID instead, if that works better, just use @class_id instead of @actor_id.
 

Evil_Nazgul0616

Veteran
Veteran
Joined
Aug 29, 2013
Messages
79
Reaction score
0
First Language
English
Primarily Uses
I have no idea how that script looks like, it is one of the few scripts I never even looked at, but here is how you can make your own exp formulas:
Code:
class Game_Actor < Game_Battler
 
  def exp_for_level(level)
    self.class.exp_for_level(level) # <-- Default way
  end

end
I just took the default method to show you where you need to adjust the thing.
You can simply remove that line (or keep it as a backup), and add your own formulas there.
The level argument will be an integer, and that defines for which level you check the EXP.

You can code there whatever you want but there are a few rules you must follow, or you will break the game:
  • The result of the method must return a positive (or 0) integer number.
  • Higher levels must require more EXP than lower levels.
These are the ones coming to mind now.

In case you want to make different EXP formulas for different actors, you can use the @actor_id instance variable to check for the actor's ID, and set a different formula for them based on that. For example:
Code:
class Game_Actor < Game_Battler
 
  def exp_for_level(level)
    case @actor_id
    when 1 # Formula for Actor 1
      # Insert formula here
    when 2 # Formula for Actor 2
      # Insert formula here
    else # Formula for any other actors
      # Insert formula here
    end
  end

end
You can also check for the class ID instead, if that works better, just use @class_id instead of @actor_id.
Is there a way to implement this with note tags? I'm planning on having five different exp formulas with multiple classes using each formula. I already have 22+ classes.

Also just to clarify, should I put that code as it's own separate snippet, or did you mean that I should find where that code is and replace it? (I'm currently away from my computer, and will be for about 7 hours, so I can't test either option at the moment :rswt)
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
You can use the same formula for multiple classes if you want to, just use more than 1 class ID after the when keyword separated by commas.

Examples:
when 1, 2, 3, 4, 5 # For Class 1 to 5
when 6..12 # For Class 6 to 12

This lets you customize the EXP formula for each actors/classes the same way a note-tag would, except you only use pure and direct code without the need to convert anything.

Ohh, and yeah, the snippet goes into a separate slot. Never edit the default scripts unless you are absolutely sure that you won't mess anything up. Even than, it's always safer to edit/make custom scripts.
 

Evil_Nazgul0616

Veteran
Veteran
Joined
Aug 29, 2013
Messages
79
Reaction score
0
First Language
English
Primarily Uses
You can use the same formula for multiple classes if you want to, just use more than 1 class ID after the when keyword separated by commas.

Examples:
when 1, 2, 3, 4, 5 # For Class 1 to 5
when 6..12 # For Class 6 to 12

This lets you customize the EXP formula for each actors/classes the same way a note-tag would, except you only use pure and direct code without the need to convert anything.

Ohh, and yeah, the snippet goes into a separate slot. Never edit the default scripts unless you are absolutely sure that you won't mess anything up. Even than, it's always safer to edit/make custom scripts.
Ok, so it seems to be working so far...

but having the formula as "level^3" causes the actor to level up much faster than expected (gaining 8 exp at level 1 causes the actor to go from level 1 to level 7, where it should have only gone to level 2 (required exp = 2^3 = 8))


EDIT:
Writing the formula as "level * level * level" causes it to work properly, but as you can see this looks messy compared to a simple exponent...

EDIT #2:
Is there a way to force the total experience accumulated exp at level 1 to always be zero while still following the same formulas I specify? One of the experience formulas I'm using causes -54 exp at level 1 (oddly this doesn't show up in troop battle testing)
 
Last edited:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
Ohh, sorry, forgot to reply yesterday.

In case you really wrote level^3 as a formula, that is NOT how you do what you want in Ruby.
That should be level**3 instead.

You can always put this right at the beginning of the method:
Code:
return 0 if level == 1
This will make sure that it returns 0 for every formula on level 1.

And in case you need a simple debug print of the EXP values for your levels, you can use this little script:

Code:
module Graph

  def self.show(min,max,aid)
    (min..max).each do |lvl|
      text_data($game_actors[aid],lvl)
    end
  end

  def self.text_data(actor,lvl)
    tx1 = actor.exp_for_level(lvl+1) - actor.exp_for_level(lvl)
    tx2 = actor.exp_for_level(lvl)
    v1 = sprintf("%*s", 8, tx1.to_s)
    v2 = sprintf("%*s", 8, tx2.to_s)
    t1 = sprintf("%*s", 3, lvl.to_s)
    t2 = sprintf("%*s", 3, (lvl+1).to_s)
    puts "Total XP to LVL #{t1}: #{v2},\tFrom LVL #{t1} to LVL #{t2}: #{v1}"
  end
 
end
Put this snippet anywhere you want on the script list.
Use it in the game with this script call:
Code:
Graph.show(low,high,actor_id)
Replace low with the lowest level you want to see.
Replace high with the highest level you want to see.
Replace actor_id with the ID of the actor you want to see.

You need to enable the console to see the debug prints, so if you haven't yet, make sure to enable it in the editor.
The script call will print the total EXP needed to achieve the levels and the EXP between 2 levels as well.
 
Last edited:

Evil_Nazgul0616

Veteran
Veteran
Joined
Aug 29, 2013
Messages
79
Reaction score
0
First Language
English
Primarily Uses
Ohh, sorry, forgot to reply yesterday.

In case you really wrote level^3 as a formula, that is NOT how you do what you want in Ruby.
That should be level**3 instead.

You can always put this right at the beginning of the method:
Code:
return 0 if level == 1
This will make sure that it returns 0 for every formula on level 1.

And in case you need a simple debug print of the EXP values for your levels, you can use this little script:

Code:
module Graph

  def self.show(min,max,aid)
    (min..max).each do |lvl|
      text_data($game_actors[aid],lvl)
    end
  end

  def self.text_data(actor,lvl)
    tx1 = actor.exp_for_level(lvl+1) - actor.exp_for_level(lvl)
    tx2 = actor.exp_for_level(lvl)
    v1 = sprintf("%*s", 8, tx1.to_s)
    v2 = sprintf("%*s", 8, tx2.to_s)
    t1 = sprintf("%*s", 3, lvl.to_s)
    t2 = sprintf("%*s", 3, (lvl+1).to_s)
    puts "Total XP to LVL #{t1}: #{v2},\tFrom LVL #{t1} to LVL #{t2}: #{v1}"
  end
 
end
Put this snippet anywhere you want on the script list.
Use it in the game with this script call:
Code:
Graph.show(low,high,actor_id)
Replace low with the lowest level you want to see.
Replace high with the highest level you want to see.
Replace actor_id with the ID of the actor you want to see.

You need to enable the console to see the debug prints, so if you haven't yet, make sure to enable it in the editor.
The script call will print the total EXP needed to achieve the levels and the EXP between 2 levels as well.
Thank you so much! It works perfectly now.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,859
Messages
1,017,030
Members
137,566
Latest member
Fl0shVS
Top