[Ace] Difficulty Script v5.0 **UPDATED****NEW**

Vandril

Warper
Member
Joined
Jun 3, 2013
Messages
4
Reaction score
0
First Language
English
Primarily Uses
Hey! I do love what you've done with this script. The ability to handle each attribute's modifier individually is a stroke of genius and was exactly what I was looking for!

In my testing of the script, I found a simple bug. The way you ensured stats never hit 0 despite the modifier was by adding one to the return value. This happens whether the stat is 0 or not. If the multiplier is 1.0 (as is the case with my normal mode), due to that last-second addition, all stats are increased by 1 above what they are intended to be.

I coded in a little fix for you in the way I thought best to handle it.

In your script's param(param_id) function for the Game_Enemy class, I rewrote it as:

    def param(param_id)      eps = Blood::Enemy::param_Settings      diff = eps.keys[$game_variables[Blood::Variable::Enemy_Variable]]      newVal = (bloody_param(param_id) * eps[diff][param_id]).to_i      if newVal == 0        newVal += 1      end      return (newVal)    end #ends defLikewise, I did something similar for your Game_Actor class' param(param_id) function:

    def param(param_id)      aps = Blood::Actor::param_Settings      diff = aps.keys[$game_variables[Blood::Variable::Actor_Variable]]      newVal = (bloody_param(param_id) * aps[diff][param_id] + 1).to_i      if newVal == 0        newVal += 1      end      return (newVal)    end #ends defI tested these changes by using a 0.0 multiplier on stats (making the stats 0, of course) and then checking them. It worked. As well, the script not longer added 1 to any of the stats unless the stat was 0, so the 1.0 multiplier works properly, and other multiplier values are now more precise.

Many thanks for this wonderful script, friend!
 

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
Huh, how interesting, I never knew that bug was there. Lol, thanks for the fix though, I'll put it in there later :p . Also thanks for liking it so :p
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
There is no need to do all that to fix that little issue.


Changing the line in question to this:

return [bloody_param(param_id) * eps[diff][param_id], 1].max.to_iWill solve it.
Do the same for the actor param line, and there will be no +1 increase if it is not needed.
 

Vandril

Warper
Member
Joined
Jun 3, 2013
Messages
4
Reaction score
0
First Language
English
Primarily Uses
Ah! That's much cleaner, Sixth! Thanks for that information. I'm actually not familiar with ruby (I only know what I learned from context clues), so I didn't even consider trying to figure out its max syntax.

And I'm glad I could help, Bloodmorphed. :)

I learned something new about the usage of this script. It's possible to change the difficulty variable on Turn 0 (And possibly other turns, too - haven't tested those) of a Troop battle and have the stats change properly. It would, theoretically, be possible to assign forced-difficulties to certain enemies. For example, maybe you want a certain already-easy boss to not become completely trivial on lower difficulties, you should be able to enforce a difficulty specifically for that boss. The only thing one really carefully consider how to do this is how to change the difficulty value back to what it was once the battle ends, which is easily done in fights called by events (ie. most bosses).

This is why I love this script. So much customizeability and flexibility. :3
 

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
I never understood what the .max thing did 100%. Also wouldn't that 1 there make it to where they cant put it as 0?
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
Look at these examples:

[12, 3].maxThis would return 12, because it is higher than 3.
Code:
[15,34,22].max
This would return 34, because that is the highest number from the array.

So, looking at the code in question:

[bloody_param(param_id) * eps[diff][param_id], 1].max.to_iIf the resulted calculations for the param modification is less than 1, than the returned value will be exactly 1, because that would be the highest number in the array.
But if the result is higher than 1, than that would be returned, because that is the highest number in the array. And it will be returned without any modification, unlike your current code, which would add +1 to the end result regardless of the outcome of the param calculations.


Using .min does the opposite, it returns the lowest number from the array. This can be used also to cap certain stats, if needed. Like ATK is capped at 9999, HP is capped at 99999, and so on. 


It's just a little bit of extra you could add to your script if you want, an option to make a cap on the stats.
 
Last edited by a moderator:

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
Huh, interesting, thanks for the explanation.
 

crbox

Warper
Member
Joined
Nov 15, 2014
Messages
3
Reaction score
0
First Language
english
Primarily Uses
Am I the only one who sees your code has one huge horizontal line? Kind of a mess to rearrange.


EDIT:  Did you upload it on a standard platform like pastebin or something?
 
Last edited by a moderator:

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
Am I the only one who sees your code has one huge horizontal line? Kind of a mess to rearrange.


EDIT:  Did you upload it on a standard platform like pastebin or something?
I had there at one point, and it seems the new updates to the website made it all one single horizontal line.


As I'm mainly using Unity engine now I don't really mess with this website much, as you can tell by the 11 day delay on the reply. But I'll see what I can do.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
For those who need this, here is the script with more or less good format:

#=============================================================================#
#Script By: Bloodmorphed
#Difficulty Script v3.5
##Change Log:
#v5.0
# This is a decently big change. This version completely enables full
#customization. There is no longer set in stone rules, if you want higher then
#4 difficulties all you have to do is add them! I have also enabled you to use
#more then 4 battlers for difficulties. You just have to change it where it
#is needed.
#It's Located in Script: Game_Party (Line 72) Change the return 4 to whatever.
## Now a little bit how it works now.
# Param_Settings = { #don't touch
# Corresponding Params:
# MHP, MMP, ATK, DEF, MAT, MDF, AGI, LUK
# :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
# This is the old way I have it, it will stay the same... unless you want to
#change it. You can even change the name of them, for example :easy could be
#renamed to :normal
### Here is an example:
# Param_Settings = { #don't touch
# Corresponding Params:
# MHP, MMP, ATK, DEF, MAT, MDF, AGI, LUK
# :normal => [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5],
# :medium => [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],
# :impossible = > [6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0],
# } #don't touch
## See how I changed the name of two, AND created another one? Yup that works.
#Now, while this will work seamlessly for using the Party, very easily, you
#have to know what the variable you will be corrisponds to what.
##```NOTICE````NOTICE!!!!!!
#If you change ANYTHING on one thing, you MUST change it on everything!
#(otherwise you will either get errors, or weird changes)
#If you re-name :easy in one thing, you must re-name it in all things. if you also
#make a new difficulty, such as :impossible above, you MUST make it every where else, as well.
#Everything must have the same order as well! If it is:
#:normal :medium :hard in one category it must be the same for every category.
#For example you cant have it like this :medium :normal :hard in one category and the other way in another!
### Let's say this is our Enemy settings, which is set to 99 variable by default.
## When this is set to 0 it pulls from :normal
# 1 = :medium
# 2 = :hard
# See, easy, right? So be sure to if you do this by events and not party to
#use the right setting you want to!
###v4.0
#Condensed the script down some (reduced some line lengths.)
#Added an option to use the party size for the difficulty.
##v3.6
#Removed the "+1" from gold and XP to avoid confusion and so that if you put
#0 in the database for XP or Gold it will be 0 rather then 1.
##v3.5
#Added TP Settings. CAUTION: Try not to set them higher then 5! It will get
#broken past that! Based on actor getting hit only!
###v3.0
#I've added Actor params, and you can now disable Actor edits, and Enemy edits.
#Putting these both to false will disable the script, if needed.
## Note:
# You can use this script as you please, as long as you give credit! This
# script was made possible by massive help from Dekita.
##=============================================================================
##=============================================================================
## Param_Settings is each param that will be modified. You may edit these as
# you please. Keep in mind I have added something that will NEVER make these
# reach 0.
## Exp_Settings is the experience gained based on difficulty, normally people
# use higher Experience the lower the difficulty, but this your choice!
## Gold_Settings increases or decreases gold gain. Again most peopel would give
# more gold the lower the difficulty, but again, it is your choice!
## Keep in mind everything is MULTIPLIED! Not ADDED. To go lower, use 0.9 and
# lower. For example
## gold * 0.5 will be HALF of what it used to be.
#=============================================================================
#
module Blood
#-----------------------------------------------------------------------------
#Putting these both to false will disable the script, if you ever need to.
#If you are going to use Use_Party, Use_Enemy must also be true!
#
#Note: If you use party for difficulty you do not need to setup a event!
#-----------------------------------------------------------------------------
Use_Enemy = true #Use enemy edits? Default is true
Use_Actor = false #Use actor edits? Default is false
Use_Party = false #Use Party? Default is false

module Enemy

Param_Settings = { # don't touch
# Corresponding Params:
# MHP, MMP, ATK, DEF, MAT, MDF, AGI, LUK
: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 => 2,
:normal => 1,
:hard => 0.8,
:insane => 0.5,
} #don't touch

Gold_Settings = { #don't touch
:easy => 2,
:normal => 1,
:hard => 0.8,
:insane => 0.5,
} #don't touch

end #ends Enemy

module Actor
#=============================================================================
## Param_Settings is each param that will be modified. You may edit these as
# you please. Keep in mind I have added something that will NEVER make these
# reach 0.
## This part people usually go higher the easier difficulty, lower the higher.
#=============================================================================
#
Param_Settings = { #don't touch
# Corresponding Params:
# MHP, MMP, ATK, DEF, MAT, MDF, AGI, LUK
:easy => [2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0],
:normal => [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
:hard => [0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8],
:insane => [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5],
} #don't touch

#=========================================================================
# TP Settings scales QUICKLY, do not go over 5, if you do it gets pretty
# broken. I didn't test this exstensively but it works well. This only
# effects the CHARGE of TP (Getting hit)
#
# easy default = 2
# normal default = 1
# hard default = 0.8
# insane default = 0.5
#=========================================================================
TP_Settings = { #don't touch
:easy => 2,
:normal => 1,
:hard => 0.8,
:insane => 0.5,
} #don't touch

end #ends Actor

#============================================================================#
# Variable to use. This variable will be used for the difficulty setting
#============================================================================#
module Variable

Enemy_Variable = 99 # Which to use for enemy/party. Default is 99
Actor_Variable = 100 # Which to use for actor. Default 100

end #ends variable

end #ends Blood
#==============================================================================#
# Do not edit anything past this point, unless you know what you are doing
# edit at your own risk, just know that if you have no idea what you are doing,
# you could break it.
#==============================================================================#
if Blood::Use_Party == true
#===============================================================================
class Scene_Map < Scene_Base
#===============================================================================
alias bloody_update update
#-------------------------------------------------------------------------
#Updates our party difficulty
#-------------------------------------------------------------------------
def update
bloody_update
update_difficulty
end #ends update
#-------------------------------------------------------------------------
#Increases, or decreses the Enemy_Variable based on party members
#-------------------------------------------------------------------------
def update_difficulty
@old_size = 0 if @old_size.nil?
if @old_size != $game_party.battle_members.size
$game_variables[Blood::Variable::Enemy_Variable] = [$game_party.battle_members.size - 1,$game_party.max_battle_members].min
@old_size = $game_party.battle_members.size
end #ends if
end #ends update_difficulty

end #ends class

end #ends if

if Blood::Use_Enemy == true
#===============================================================================
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)
eps = Blood::Enemy::param_Settings
diff = eps.keys[$game_variables[Blood::Variable::Enemy_Variable]]
return [bloody_param(param_id) * eps[diff][param_id], 1].max.to_i
end #ends def
#--------------------------------------------------------------------------
# * Get Experience
#--------------------------------------------------------------------------
alias :blood_exp :exp
def exp
ees = Blood::Enemy::Exp_Settings
diff = ees.keys[$game_variables[Blood::Variable::Enemy_Variable]]
return (blood_exp * ees[diff]).to_i
end #end def
#--------------------------------------------------------------------------
# * Get Gold
#--------------------------------------------------------------------------
alias :blood_gold :gold
def gold
egs = Blood::Enemy::Gold_Settings
diff = egs.keys[$game_variables[Blood::Variable::Enemy_Variable]]
return (blood_gold * egs[diff]).to_i
end #ends def

end #ends class

end #ends if

if Blood::Use_Actor == true
#===============================================================================
class Game_Actor
#===============================================================================
#-----------------------------------------------------------------------------
# List Of Aliased Methods
#-----------------------------------------------------------------------------
alias :bloody_param :param
#-----------------------------------------------------------------------------
# Method to determine value of actors params based on difficulty.
#-----------------------------------------------------------------------------
def param(param_id)
aps = Blood::Actor::param_Settings
diff = aps.keys[$game_variables[Blood::Variable::Actor_Variable]]
return [bloody_param(param_id) * aps[diff][param_id], 1].max.to_i
end #ends def
# # TP Regen #
def charge_tp_by_damage(damage_rate)
calc = self.tp += 50 * damage_rate * tcr
ats = Blood::Actor::TP_Settings
diff = ats.keys[$game_variables[Blood::Variable::Actor_Variable]]
return (calc * ats[diff]).to_i
end #ends def

end #ends class

end #ends if



I didn't really bother with the comment section, so that might look weird, but the code should work with this format.


Bloody hell, these TAB spaces on this forum... They are several miles long. o_O
 
Last edited by a moderator:

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

Latest Threads

Latest Posts

Latest Profile Posts

"You can thank my later", "But you haven't done anything", "Well, that's why ..."
Are we allowed to post about non-RPG Maker games?
I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

Forum statistics

Threads
105,884
Messages
1,017,238
Members
137,608
Latest member
Arm9
Top