Stats Generator V4.0

Okay, here's the part of the Level Generation script that I edited...

Content Hidden Spoiler
#--------------------------------------------------------------------------
# Begin SDK Log
#--------------------------------------------------------------------------
SDK.log('Stats That Level Up', 'Trickster', 2.0, '11/8/06')

#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.state('Stats That Level Up') == true
 
module Stats
  #--------------------------------------------------------------------------
  # * Maximum Level for actors syntax: actor_id => Max Level
  #--------------------------------------------------------------------------
  Max_Level = {1 => 255,
  2 => 255,
  3 => 255,
  4 => 255,
  5 => 255,
  6 => 255,
  7 => 255}
  #--------------------------------------------------------------------------
  # * Hp Curve Syntax actor_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  Hp_Curve_Actor = {1 => [80, 46000, 1, 255, 1, 2],
  2 => [100, 112000, 1, 255, 1, 2],
  3 => [90, 51350, 1, 255, 1, 2],
  4 => [100, 87600, 1, 255, 1, 2]}
  #--------------------------------------------------------------------------
  # * Hp Curve Syntax class_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  Hp_Curve_Class = {1 => [80, 46000, 1, 255, 1, 2],
  2 => [100, 112000, 1, 255, 1, 2],
  3 => [90, 51350, 1, 255, 1, 2], 
  4 => [100, 87600, 1, 255, 1, 2]
  }
  #--------------------------------------------------------------------------
  # * Sp Curve Syntax actor_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  Sp_Curve_Actor = {
  }
  #--------------------------------------------------------------------------
  # * Sp Curve Syntax class_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  Sp_Curve_Class = {
  }
  #--------------------------------------------------------------------------
  # * Exp Curve Type 0: Total 1: ΔLevel
  #--------------------------------------------------------------------------
  Exp_Curve_Type = 1
  #--------------------------------------------------------------------------
  # * Exp Curve Syntax actor_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  Exp_Curve_Actor = {1 => [10, 200, 2, 200, 1, 2],
  2 => [10, 200, 2, 200, 1, 2],
  3 => [10, 200, 1, 255, 1, 2],
  4 => [10, 200, 2, 255, 1, 2]}
  #--------------------------------------------------------------------------
  # * Exp Curve Syntax class_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  Exp_Curve_Class = {
  }
  #--------------------------------------------------------------------------
  # * Strength Curve Syntax actor_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  Str_Curve_Actor = {1 => [10, 2200, 1, 255, 1, 2],
  2 => [15, 4400, 1, 255, 1, 2],
  3 => [10, 2200, 1, 255, 1, 2],
  4 => [18, 5100, 1, 255, 1, 2]
  }
  #--------------------------------------------------------------------------
  # * Strength Curve Syntax class_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  Str_Curve_Class = {
  }
  #--------------------------------------------------------------------------
  # * Dexerity Curve Syntax actor_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  Dex_Curve_Actor = {1 => [12, 3100, 1, 255, 1, 2],
  2 => [8, 1100, 1, 255, 1, 2],
  3 => [13, 3350, 1, 255, 1, 2],
  4 => [16, 4960, 1, 255, 1, 2]
  }
  #--------------------------------------------------------------------------
  # * Dexerity Curve Syntax class_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  Dex_Curve_Class = {
  }
  #--------------------------------------------------------------------------
  # * Agility Curve Syntax actor_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  Agi_Curve_Actor = {1 => [18, 5050, 1, 255, 1, 2],
  2 => [4, 460, 1, 255, 1, 2],
  3 => [10, 2310, 1, 255, 1, 2],
  4 => [15, 4520, 1, 255, 1, 2]
  }
  #--------------------------------------------------------------------------
  # * Agility Curve Syntax class_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  Agi_Curve_Class = {
  }
  #--------------------------------------------------------------------------
  # * Intelligence Curve Syntax actor_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  Int_Curve_Actor = {1 => [13, 3260, 1, 255, 1, 2],
  2 => [6, 940, 1, 255, 1, 2],
  3 => [12, 3070, 1, 255, 1, 2],
  4 => [10, 2340, 1, 255, 1, 2]
  }
  #--------------------------------------------------------------------------
  # * Intelligence Curve Syntax class_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  Int_Curve_Class = {
  }
  #--------------------------------------------------------------------------
  # * Attack Curve Syntax actor_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  Atk_Curve_Actor = {1 => [10, 2200, 1, 255, 1, 2],
  2 => [15, 4400, 1, 255, 1, 2],
  3 => [10, 2200, 1, 255, 1, 2],
  4 => [18, 5100, 1, 255, 1, 2]
  }
  #--------------------------------------------------------------------------
  # * Attack Curve Syntax class_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  Atk_Curve_Class = {
  }
  #--------------------------------------------------------------------------
  # * P. Defense Curve Syntax actor_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  PDef_Curve_Actor = {1 => [8, 1240, 1, 255, 1, 2],
  2 => [20, 6150, 1, 255, 1, 2],
  3 => [14, 4120, 1, 255, 1, 2],
  4 => [12, 3080, 1, 255, 1, 2]
  }
  #--------------------------------------------------------------------------
  # * P. Defense Curve Syntax class_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  PDef_Curve_Class = {
  }
  #--------------------------------------------------------------------------
  # * M. Defense Curve Syntax actor_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  MDef_Curve_Actor = {1 => [12, 3050, 1, 255, 1, 2],
  2 => [6, 950, 1, 255, 1, 2],
  3 => [12, 3020, 1, 255, 1, 2],
  4 => [10, 2220, 1, 255, 1, 2]
  }
  #--------------------------------------------------------------------------
  # * M. Defense Curve Syntax class_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  MDef_Curve_Class = {
  }
  #--------------------------------------------------------------------------
  # * Evasion Curve Syntax actor_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  Eva_Curve_Actor = {
  }
  #--------------------------------------------------------------------------
  # * Evasion Curve Syntax class_id => [min, max, minlvl, maxlvl, early, late]
  #--------------------------------------------------------------------------
  Eva_Curve_Class = {
  }
end
Expand to see the code.


It works like this, but when the max levels were set to 999, I couldn't open my project, because the script was hanging.

The scripts I am using are...dubealex's Advanced Message Script, these Level Generation and Limit Breaking Scripts, and Fomar0153's Party Changing Script. Everything but the AMS is below the SDK and above Main.
I see, the script is hanging error, it's taking too long to process going from level 1 to level 999 or some very high number and if Graphics.update isn't called within a certain amount of time it will give you that error. I will try and find a workaround or a fix for this, but until then don't set the levels too high.

EDIT: Well I don't recommend setting the level greater than 255 It is a triple loop (One for initialization actors, Second running through levels, and Third running through each stat) and increasing the level will increase the time it takes by alot, I'll have to rewrite the script not using .parameters , but instead using the Level_Generation object to directly get the values for level x, so that will allow you to have very high levels w/o increasing load times.
Major Update, Guys

I have changed the formulas around again (All formulas are now derived from the cubic polynomial a * x ^ 3 + b * x ^ 2 + c * x + d rather than a * x ^ 2 + b * x + c). This change allows you to set a middle level to a value, and also gives two new curves (early -> late and late -> early at the middle level the curve will change growth rate)

I have also improved the calculation methods so they may run a bit faster, but I still do not recommend that you have very high levels since I wasn't focused on that in this update

The Syntax for this script has changed, sorry for the inconvenience here it is
Quote:
Format for Curve Constants
[min, mid, max, minL, midL, maxL, early, late, steady, curve1, curve2, int]

Where:
min - the minimum value of the stat
mid - the middle value at midL
max - the maximum value of the stat
minL - the minimum level
midL - the middle level (stat will be mid here)
maxL - the maximum level
early - the early influence
late - the late influence
steady - the steady influence
curve1 - the early->late influence
curve2 - the late->early influence
int - if true returns integers


It may look like alot but really it is pretty simple, for example, If you want a late curve for levels 1 - 20 middle level 12, minimum value 10 maximum value 200 middle value 70 then you would type

[1, 12, 20, 10, 70, 200, 0, 1, 0, 0, 0]

(Note the last three arguments aren't required since 0 is the default)

how about I make it an early -> late curve

[1, 12, 20, 10, 70, 200, 0, 0, 0, 1, 0]

how about a 1 to 1 mix of the early curve and the late -> early curve

[1, 12, 20, 10, 70, 200, 1, 0, 0, 0, 1]


Example Table of the Curves

Condition:
min = 10, mid = 50, max = 100, minlevel = 1, midlevel = 4, maxlevel = 10
Early | Late | Steady | E -> L | L -> E
   10     10      10       10       10
   24     18      20       21       18
   37     32      30       35       32
   50     50      50       50       50
   60     68      50       64       60
   70     85      60       78       70
   79     98      70       90       79
   87    100      80       98       87
   94    [COLOR=Red]107[/COLOR]      90      100       94
  100    [COLOR=Red]108[/COLOR]     100      [COLOR=Red]101 [/COLOR]     100
Expand to see the code.


The Red Colored numbers means that its over the max, don't fret stuff like this happens, the script automatically rounds it down to the max if it happens to go over.

Also I've spent All Day yesturday debugging the new formulas so you better had enjoy this update :thumb:
Trickster I have a question about this script.
What I'm wanting to do is I want my party(individual PC) to level to 200(witch I got down with trial and error) but I want there exp to only go to 100 and after gaining 100 exp your exp meter/bar/or % resets to 0 but you still regain the level.
Is this possible with this script?
If not I could just go with the normal gathering exp from monsters bit.
Tho I am just wanderin
You can "Trick" the system

Set the Exp Option to just generate the value 100

Add this in a new script above main

class Game_Actor
  #--------------------------------------------------------------------------
  # * Get EXP String
  #--------------------------------------------------------------------------
  def level_exp_s
    return @exp_list[@level+1] > 0 ? (@exp-@exp_list[@level]).to_s : "-------"
  end
end

class Window_Base
  #--------------------------------------------------------------------------
  # * Draw EXP
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_actor_exp(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 24, 32, "E")
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 24, y, 84, 32, actor.level_exp_s, 2)
    self.contents.draw_text(x + 108, y, 12, 32, "/", 1)
    self.contents.draw_text(x + 120, y, 84, 32, actor.next_rest_exp_s)
  end
end
Expand to see the code.


Is is the effect you wanted?

With this it shows

Exp Gained for the level / Exp Left to Next Level
I was wandering if I'm doing this right.
This is the code line I'm using with some changes to the first 3 numbers:
(SP Curve Class)
1 => [30, 392, 784, 1, 100, 200, 0, 0, 0, 1, 0],
Excuse me, but I think it works well when you set your stats as small number, but when it deals with large numbers, it gets weird. Especially for Exp. I tried, but it doesn't show the expected result. For example, I set 1st actor's Exp curve like this:
  #--------------------------------------------------------------------------
  # * Exp Curve Type 0: Total 1: ΔLevel
  #--------------------------------------------------------------------------
  Exp_Curve_Type = 0
  #--------------------------------------------------------------------------
  # * Exp Curve Syntax
  #   - syntax: actor_id => [stat curve]
  #--------------------------------------------------------------------------
  Exp_Curve_Actor = {
  1 => [25, 250000, 3000000, 1, 50, 99, 0, 1, 1, 0, 0]
  }
Expand to see the code.

And then, I raised 1st actor's level by 1 via event. Instead of level 2, the actor's level is now 16.(when I changed values, I got lv33, lv60, even lv94..) Is there something wrong?
yes, it is not wise to set stuff too high. Am I am still contemplating wherever or not to allow for very high numbers (numbers > 32,167) because the Table class has a limit to what can be stored in it and it is very hard to find a workaround for it.

Try the ΔLevel option and define the Exp curve that way if you still have trouble wait for the next version
Updated to Version 4.0

Seph and I have rewrote the Level_Generator class it has a few more functions

I rewrote the script based on that and I have included two options to create the level table and save it so then you may turn on the load option so that it can be loaded without settign up the table again, which means you may now have superhugehighlevels if you follow what I just stated

you may now however have superhugehigh1000000000stats as the table class can not hold integers that high
Hey Trickster. I think understand the numbers for for stat curves. I just don't understand the amount of numbers for the EXP curve? Now I know you've updated the system since your last post on page one maybe the math changed. Can you help explain that to me. I don't think that question was answered. Otherwise I think this script well be really useful to my project.
what do you mean numbers of the EXP curve it is all setup the same way

#--------------------------------------------------------------------------
# * Exp Curve Type 0: Total 1: ΔLevel
#--------------------------------------------------------------------------
Exp_Curve_Type = 1

If you meant that setting that to 0 will make it behave like this

values generated [10, 30, 50, 100]
Exp values [10, 30, 50, 100]

and setting it to 1 will make it behave like this
values generated [10, 30, 50, 100]
Exp values [10, 40, 90, 190]

The first uses the values generated as the values of the exp table the second generates the amount of exp to just get to the next level the change in the amount of exp per level do not set the values for the curve too high when using this or you will have some high numbers for the later levels
Alright thanks it was a little bit more confusing to me, I'm pretty new to scripts. I'm using it in my project right now it works pretty good.
Thanks, if you have any trouble let me know
hey, do you know what conflicts and causes the error: 'nil cannot be coerced into Fixnum' its the script 'Stats Generator' on line 384.

Yours, Sam.
samamanjaro;235334 wrote:
hey, do you know what conflicts and causes the error: 'nil cannot be coerced into Fixnum' its the script 'Stats Generator' on line 384.

Yours, Sam.


How would I know, you are the one using it I am just the creator :-/

Give me more information than that (the line where the error occured, other scripts you are using, etc.)
I get the error when ever I try to access a menu or window that wants to display Stat information. I am using scripts like Multi-Equip, MOG's Menu System,
f0tz's AntiLag, Shadows, Particle Engine, Mr.Mo Squad ABS.
Care to send me a demo of it conflicting please?
Hey, I really like this script, Trick the problem is the stats generation script references itself to Actorstats.rxdata, and I don't have a copy of that. I've checked the demo data files and it doesn't seem to have it either. Any help?
  #--------------------------------------------------------------------------
  # * Save Tables
  #     Saves Actor Stat Tables for faster loading
  #     Saved to Data/ActorStats.rxdata
  #     Set to false when you encrypt your project
  #--------------------------------------------------------------------------
  Save_Tables = false
  #--------------------------------------------------------------------------
  # * Load Tables
  #     Loads Actor Stat Tables for quick loading
  #     Loaded from Data/ActorStats.rxdata
  #     Set Save Tables to true run project and then you may set this to true
  #     If you change any of the below values you must save the tables again
  #--------------------------------------------------------------------------
  Load_Tables = false
Expand to see the code.


you will get a copy of that file if you turn Save_Tables to true after you have it done that and run your project once set it to false and set Load_Tables to true. and your startup time should decrease since all of the stuff is generated and all it has to do is update the actor data

don't set Load_Tables to true if you don't have that file because it doesn't work that way

also don't set Save_Tables to true and then encrypt your game that will cause an error if I remember correctly
Yep, that seemed to do it. Thanks.
[QUOTE=samamanjaro;235334]hey, do you know what conflicts and causes the error: 'nil cannot be coerced into Fixnum' its the script 'Stats Generator' on line 384.

Yours, Sam.[/QUOTE]

Sorry for digging up an old thread, but I'm finding I'm experiencing this problem too; though on line 375.

The only scripts I'm using aside from this one is the HP/SP/Level Limit Break and the Dynamic Enemies script.

The problem doesn't occur when my characters are under the default maximum level (99), but when I level up beyond 100 it occurs as soon as I've finished submitting battle orders for every party member.

:(

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=6599