DifficultyModes.hard_mode? doesn't work (without changes). hard_mode is a local variable in a method, not a method/property itself, much less a class method (to be called without an instance).
Use pbGet(DifficultyModes::VARIABLE)==3 instead.
oh i forgot how i got it to work tbh i tried this to no avail and levels wouldn't change in battle :(
#===============================================================================
# * Difficulty Modes - Patched for your game
#===============================================================================
# Plugin registration
if !PluginManager.installed?("Difficulty Modes Patched IsaiahFisher19")
PluginManager.register({
:name => "Difficulty Modes Patched IsaiahFisher19",
:version => "1.2",
:link => "",
:credits => "FL + IsaiahFisher19 + ChatGPT"
})
end
module DifficultyModes
# Variables controlling difficulty
SWITCH = 79 # Switch that enables difficulty mode after first battle
VARIABLE = 31 # Variable that stores difficulty selection: 1=Normal, 2=Easy, 3=Hard
# Check if hard mode is active
def self.hard_mode?
return [imath]game_switches[SWITCH] &&[/imath]game_variables[VARIABLE] == 3
end
# Check if easy mode
def self.easy_mode?
return [imath]game_switches[SWITCH] &&[/imath]game_variables[VARIABLE] == 2
end
# Current mode
def self.current_mode
return nil unless $game_switches[SWITCH]
difficulty_hash = {}
# Normal Mode (1)
normal_mode = Difficulty.new
normal_mode.trainer_level_proc = proc { |pkmn, trainer| pkmn.level }
normal_mode.wild_level_proc = proc { |pkmn| pkmn.level }
normal_mode.skill_proc = proc { |skill, trainer| skill }
normal_mode.money_proc = proc { |money, trainer| money }
normal_mode.exp_proc = proc { |exp, battler| exp }
difficulty_hash[1] = normal_mode
# Easy Mode (2) - lower levels, lower trainer skill
easy_mode = Difficulty.new
easy_mode.trainer_level_proc = proc { |pkmn, trainer| [[pkmn.level * 0.8, 1].max, GameData::GrowthRate.max_level].min }
easy_mode.wild_level_proc = proc { |pkmn| [[pkmn.level * 0.85, 1].max, GameData::GrowthRate.max_level].min }
easy_mode.skill_proc = proc { |skill, trainer| 1 }
easy_mode.money_proc = proc { |money, trainer| (money * 1.5).floor }
easy_mode.exp_proc = proc { |exp, battler| (exp * 1.1).floor }
difficulty_hash[2] = easy_mode
# Hard Mode (3) - higher levels, max trainer skill
hard_mode = Difficulty.new
hard_mode.trainer_level_proc = proc { |pkmn, trainer| [[pkmn.level * 1.3 + 1, 1].max, GameData::GrowthRate.max_level].min }
hard_mode.wild_level_proc = proc { |pkmn| [[pkmn.level * 1.3 + 1, 1].max, GameData::GrowthRate.max_level].min }
hard_mode.skill_proc = proc { |skill, trainer| 100 }
hard_mode.money_proc = proc { |money, trainer| (money * 1.3).floor }
hard_mode.exp_proc = proc { |exp, battler| (exp * 1.2).floor }
difficulty_hash[3] = hard_mode
return difficulty_hash[$game_variables[VARIABLE]] || normal_mode
end
#-------------------------------
# Apply level scaling
#-------------------------------
def self.apply_trainer_level_proc(pkmn, trainer)
return pkmn.level if !current_mode
[[current_mode.trainer_level_proc.call(pkmn, trainer).floor, GameData::GrowthRate.max_level].min, 1].max
end
def self.apply_wild_level_proc(pkmn)
return pkmn.level if !current_mode
[[current_mode.wild_level_proc.call(pkmn).floor, GameData::GrowthRate.max_level].min, 1].max
end
def self.apply_skill_proc(skill, trainer)
return skill if !current_mode
[current_mode.skill_proc.call(skill, trainer).floor, 0].max
end
def self.apply_money_proc(money, trainer)
return money if !current_mode
[current_mode.money_proc.call(money, trainer).floor, 0].max
end
def self.apply_exp_proc(exp, battler)
return exp if !current_mode
[current_mode.exp_proc.call(exp, battler).floor, 0].max
end
private
class Difficulty
attr_accessor :trainer_level_proc, :wild_level_proc
attr_accessor :skill_proc, :money_proc, :exp_proc
def initialize
end
end
end
#===============================================================================
# Trainer & Wild Pokémon scaling
#===============================================================================
alias :_pbLoadTrainer_DIFFICULTY :pbLoadTrainer
def pbLoadTrainer(tr_type, tr_name, tr_id = 0)
ret = _pbLoadTrainer_DIFFICULTY(tr_type, tr_name, tr_id)
if ret && DifficultyModes.current_mode
for pkmn in ret.party
pkmn.level = DifficultyModes.apply_trainer_level_proc(pkmn, ret)
pkmn.calc_stats
end
end
return ret
end
class Trainer
alias :_base_money_DIFFICULTY :base_money
def base_money
DifficultyModes.apply_money_proc(_base_money_DIFFICULTY, self)
end
alias :_skill_level_DIFFICULTY :skill_level
def skill_level
DifficultyModes.apply_skill_proc(_skill_level_DIFFICULTY, self)
end
end
# Wild Pokémon
if defined?(Events) && Events.respond_to?(:onWildPokemonCreate)
Events.onWildPokemonCreate += proc { |sender, e|
pkmn = e[0]
pkmn.level = DifficultyModes.apply_wild_level_proc(pkmn)
pkmn.calc_stats
}
else
EventHandlers.add(:on_wild_pokemon_created, :difficulty_mode,
proc { |pkmn|
pkmn.level = DifficultyModes.apply_wild_level_proc(pkmn)
pkmn.calc_stats
}
)
end
#===============================================================================
# Hard Mode Restrictions (Items & Battle Style)
#===============================================================================
class Battle::Scene
alias :_pbItemMenu_DIFFICULTY pbItemMenu unless method_defined?(:_pbItemMenu_DIFFICULTY)
def pbItemMenu(idxBattler, firstAction)
if [imath]game_switches[DifficultyModes::SWITCH] &&[/imath]game_variables[DifficultyModes::VARIABLE] == 3 && @battle.trainerBattle?
pbMessage(_INTL("You can't use items in battle on Hard Mode."))
return
end
_pbItemMenu_DIFFICULTY(idxBattler, firstAction)
end
end
class PokemonSystem
alias :_switch_style_DIFFICULTY switch_style
def switch_style
return 1 if [imath]game_switches[DifficultyModes::SWITCH] &&[/imath]game_variables[DifficultyModes::VARIABLE] == 3
return _switch_style_DIFFICULTY
end
end