- Joined
- Sep 29, 2020
- Posts
- 180
It's works like a charm...You can change the options menu in the file015_UI_Options.rb
, in the016_UI
folder. You could add this feature in some different ways. I'll tell you a simple one, but with the downside of not being able to change the difficulty if you're accessing the options menu from the load menu. A more elaborate option would require some extra changes to the way the plugin reads the selected difficulty, which could be hard depending on your coding knowledge. Let me show you the simple way:
At thePokemonSystem
class, add anattr_accessor
to represent the setting, for example,difficulty
. Then, in theinitialize
method, initialize the attribute according to the difficulties I explain below. In the end, the class might look like this:
Ruby:class PokemonSystem attr_accessor :textspeed attr_accessor :battlescene attr_accessor :battlestyle attr_accessor :sendtoboxes attr_accessor :givenicknames attr_accessor :frame attr_accessor :textskin attr_accessor :screensize attr_accessor :language attr_accessor :runstyle attr_accessor :bgmvolume attr_accessor :sevolume attr_accessor :textinput attr_accessor :difficulty def initialize @textspeed = 1 # Text speed (0=slow, 1=medium, 2=fast, 3=instant) @battlescene = 0 # Battle effects (animations) (0=on, 1=off) @battlestyle = 0 # Battle style (0=switch, 1=set) @sendtoboxes = 0 # Send to Boxes (0=manual, 1=automatic) @givenicknames = 0 # Give nicknames (0=give, 1=don't give) @frame = 0 # Default window frame (see also Settings::MENU_WINDOWSKINS) @textskin = 0 # Speech frame @screensize = (Settings::SCREEN_SCALE * 2).floor - 1 # 0=half size, 1=full size, 2=full-and-a-half size, 3=double size @language = 0 # Language (see also Settings::LANGUAGES in script PokemonSystem) @runstyle = 0 # Default movement speed (0=walk, 1=run) @bgmvolume = 80 # Volume of background music and ME @sevolume = 100 # Volume of sound effects @textinput = 0 # Text input mode (0=cursor, 1=keyboard) @difficulty = 0 # Automatic Level Scaling difficulty id end end
Then, you also need to add a newMenuHandlers
, you can add one in the same file, and see some other examples. I'll show an example, but you should change it according to your game:
In this code, 0 Is the Easy, 1 is Medium, etc. This is also the values you use to initialize the difficulty in theRuby:MenuHandlers.add(:options_menu, :difficulty, { "name" => _INTL("Difficulty"), "order" => 130, "type" => EnumOption, "parameters" => [_INTL("Easy"), _INTL("Medium"), _INTL("Hard")], "description" => _INTL("Choose the difficulty."), "get_proc" => proc { next $PokemonSystem.difficulty }, "set_proc" => proc { |value, _scene| next if $game_variables.nil? $PokemonSystem.difficulty = value case value when 0 pbSet(LevelScalingSettings::TRAINER_VARIABLE, 1) pbSet(LevelScalingSettings::WILD_VARIABLE, 1) when 1 pbSet(LevelScalingSettings::TRAINER_VARIABLE, 2) pbSet(LevelScalingSettings::WILD_VARIABLE, 2) when 2 pbSet(LevelScalingSettings::TRAINER_VARIABLE, 3) pbSet(LevelScalingSettings::WILD_VARIABLE, 3) end } })
initialize
method. You can add or remove difficulties if you prefer. The important part is changing the pbSet calls according to the difficulty ID from theDIFFICULTIES
hash at the002_Settings.rb
file. Keep in mind: In this setup, changing only the number in PokemonSystem.difficulty will not change the difficulty by itself.
This is all necessary for the option to be added, but it will cause bugs if changed from the load menu, as I said. So, I recommend disabling the options menu from the load screen, by commenting some lines in the013_UI_Load.rb
file (adding a # at the beginning of the line). Line 285:# cmd_options = -1,
and 298:# commands[cmd_options = commands.length] = _INTL("Options")
. I'd be happy to help you if you have any other questions.
Thank you for helping me to implement this plugin to option menu