[Ace] Adding Experience Rate modifier to a parameter script

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
This is what I have now:

#--------#Script By: Bloodmorphed#Difficulty Script v1.0##Change Log:#v1.0#Simple version. Checks difficulty and multiplies based on the difficulty, also#easily modified.####--------#-----------------# Determines what variable, and the multiplier based on difficulty## Feel free to edit these. Make sure you are using the right variable!#-----------------module Blood  Difficulty_Settings = { #don't touch     :easy => [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5],     :normal => [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],     :hard => [2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0],     :insane => [4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0],    } #don't touch   #--------------------------------------------------------------  # Variable to use.  #--------------------------------------------------------------  module Variable    Difficulty_Variable = 100     # Which variable to use? Default is 100  end #ends variableend #ends Blood #===============================================================================class Game_Enemy#===============================================================================  #-----------------------------------------------------------------------------  # List Of Aliased Methods  #-----------------------------------------------------------------------------  alias :bloody_param :param  #-----------------------------------------------------------------------------  # Method to determine value of enemies params based on difficulty.  #-----------------------------------------------------------------------------   def param(param_id)    case $game_variables[Blood::Variable::Difficulty_Variable]      when 0        (bloody_param(param_id) * Blood::Difficulty_Settings[:easy][param_id]).to_i      when 1        (bloody_param(param_id) * Blood::Difficulty_Settings[:normal][param_id]).to_i      when 2        (bloody_param(param_id) * Blood::Difficulty_Settings[:hard][param_id]).to_i      when 3        (bloody_param(param_id) * Blood::Difficulty_Settings[:insane][param_id]).to_i    end #ends case  end #ends defend #ends class
Thank you Dekita for that!

But the way it's set up now, I have no idea how to do sparams, which is where the Experience Rate is.... 
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,202
First Language
Binary
Primarily Uses
RMMZ
no need to modify the sparams directly if you only wish to modify the exr rate. Just modify the 'exp' method within the game_enemy class directly, like this

  #--------------------------------------------------------------------------  # * Get Experience  #--------------------------------------------------------------------------  alias :exp_alias :exp  def exp    case $game_variables[500]    when 0 then exp_alias * Blood::Exp_Setting[:easy]    when 1 #...    end  endObviously you would have to make a new hash for the exp difficulty modifications within your module. :)
 
Last edited by a moderator:

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
Final Script:

#--------#Script By: Bloodmorphed#Difficulty Script v1.0##Change Log:#v1.0#Simple version. Checks difficulty and multiplies based on the difficulty, also#easily modified.####--------#-----------------# Determines what variable, and the multiplier based on difficulty## Feel free to edit these. Make sure you are using the right variable!#-----------------module Blood  Difficulty_Settings = { #don't touch     :easy => [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5],     :normal => [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],     :hard => [2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0],     :insane => [4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0],    } #don't touch     Exp_Settings = { #don't touch    :easy => 0.5,    :normal => 1,    :hard => 2,    :insane => 4,  }# don't touch   #--------------------------------------------------------------  # Variable to use.  #--------------------------------------------------------------  module Variable    Difficulty_Variable = 100     # Which variable to use? Default is 100  end #ends variableend #ends Blood #===============================================================================class Game_Enemy#===============================================================================  #-----------------------------------------------------------------------------  # List Of Aliased Methods  #-----------------------------------------------------------------------------  alias :bloody_param :param  #-----------------------------------------------------------------------------  # Method to determine value of enemies params based on difficulty.  #-----------------------------------------------------------------------------   def param(param_id)    case $game_variables[Blood::Variable::Difficulty_Variable]      when 0        (bloody_param(param_id) * Blood::Difficulty_Settings[:easy][param_id]).to_i      when 1        (bloody_param(param_id) * Blood::Difficulty_Settings[:normal][param_id]).to_i      when 2        (bloody_param(param_id) * Blood::Difficulty_Settings[:hard][param_id]).to_i      when 3        (bloody_param(param_id) * Blood::Difficulty_Settings[:insane][param_id]).to_i    end #ends case  end #ends def   #--------------------------------------------------------------------------  # * Get Experience  #--------------------------------------------------------------------------  alias :blood_exp :exp  def exp    case $game_variables[500]    when 0 then blood_exp * Blood::Exp_Settings[:easy]    when 1 then blood_exp * Blood::Exp_Settings[:normal]    when 2 then blood_exp * Blood::Exp_Settings[:hard]    when 3 then blood_exp * Blood::Exp_Settings[:insane]    end #end case  end #end defend #ends class
Thank you Dekita so much! Especially for being patient with me
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Yep, that's what I did in mine too! Though, one warning...this will round the number down (or at least it did in mine), so if the calculation ever gives 0.5 for instance, it will give 0 EXP. Just something to keep in mind for your easy setting.
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,202
First Language
Binary
Primarily Uses
RMMZ
Some things I would maybe do, just to make it flow a little neater, would be

1 - change the name of Difficulty_Settings in the module to 'Param_Settings' or something more descriptive.

2 - make a method for calling "(bloody_param(param_id) * Blood::Difficulty_Settings[:easy][param_id]).to_i"

something like this...

  def param(param_id)    case $game_variables[Blood::Variable::Difficulty_Variable]    when 0 then (bloody_param(param_id) * param_diff_mod:)easy,param_id)).to_i    #...    end #ends case  end #ends def   def param_diff_mod(type,param_id)    Blood::Difficulty_Settings[type][param_id]  endAlso - seeing as its a difficulty script, you could modify the gold as well. like, harder setting = less gold gained. using the 'gold' method in Game_Enemy would be fine for that :)

Edit:

Yep, that's what I did in mine too! Though, one warning...this will round the number down (or at least it did in mine), so if the calculation ever gives 0.5 for instance, it will give 0 EXP. Just something to keep in mind for your easy setting.
That would only happen if you where trying to give 1 exp or less before the modification though :)
 
Last edited by a moderator:

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
That would only happen if you where trying to give 1 exp or less before the modification though :)
Which I actually do in my game. I wanted really slow leveling in my game, and the way RPGMaker has us modify the EXP curve is pretty crazy in my opinion, so I just settled on using the default curve, but a lot of 1 exp monsters early on in the game. But, if he doesn't have any 1 EXP monsters in his game, nothing to worry about!

Edit: Also, if you have say 4 1 EXP monsters, the battle gives 0 EXP, not 2 like you at first expect. This is because it first computes the EXP per battler as 1 * 0.5, or 0, then 4 * 0 = 0 total EXP earned. I actually have my insane difficulty on 50% of EXP earned, and this very thing happens in the game, but that was also my intended effect as well.

Here my code if you are curious. Maybe something to compare with when you are done? Its not documented yet, but the rest of it is done. http://pastebin.com/GavUmfst
 
Last edited by a moderator:

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,202
First Language
Binary
Primarily Uses
RMMZ
Personally, I prefer the pokemon style exp calculations. I guess that is why I've written so many scripts to change things to their calculations :p

Also, @bgillisp, there is not need for you to overwrite any of those methods within your script imo. You could raise overall compatibility by simply aliasing the old method and using that in your formulas.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Hmmm...I'd be interested in how to make it work with an alias, as calling the old function at all has it return the old value, with no calculations. Maybe call it and store it? Is that what you would recommend?
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,202
First Language
Binary
Primarily Uses
RMMZ
I would just use the alias directly within the new formula.its going to retun a value anyway, so it can easily be calculated.

Something like...

alias :exp_alias :expdef exp  ((exp_alias * Modifier_Value)+1).to_iendThe plus 1 would ensure your will always gain at least 1 exp :)
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Didn't think of that, thanks!
 

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
Nice! Well I added gold, and put the +1 thingy, so it wouldn't reach 0.

I think this script is as good as it can be, minus the little simple mod you did to it Dekita. I really don't see a point doing that right now, unless I plan on making a lot more edits.

Thanks again for your help!
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,202
First Language
Binary
Primarily Uses
RMMZ
No problem :)
As I said, param modifications are my absolute favorite :D
 

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

Latest Threads

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,854
Messages
1,016,998
Members
137,562
Latest member
tamedeathman
Top