• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
  • Eevee Expo's webhost has been having technical issues since Nov. 20th and you might be unable to connect to our site. Staff are also facing issues connecting, so please send a DM to Cat on-site or through Discord directly for faster service!
Resource icon

Resource Automatic Level Scaling 1.6.0

ardicoozer

Cooltrainer
Member
Joined
Sep 29, 2020
Posts
180
You can change the options menu in the file 015_UI_Options.rb, in the 016_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 the PokemonSystem class, add an attr_accessor to represent the setting, for example, difficulty. Then, in the initialize method, initialize the attribute according to the difficulties I explain below. In the end, the class might look like this:
Ruby:
Expand Collapse Copy
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 new MenuHandlers, 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:
Ruby:
Expand Collapse Copy
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
  }
})
In this code, 0 Is the Easy, 1 is Medium, etc. This is also the values you use to initialize the difficulty in the 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 the DIFFICULTIES hash at the 002_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 the 013_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.
It's works like a charm...
Thank you for helping me to implement this plugin to option menu
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
683
You can have the option only appear in-game (not the load screen) by setting the condition for it to be visible only when the player gets something, like the running shoes (one of the options uses it and it doesn't appear in the option menu when accessing it from the loading screen). If you give the player the running shoes (or something else that you have to activate in-game like the running shoes) at the start of the game, the option will be there from the beginning. That is because, in the loading screen, those options are loaded in the default configuration (false in the case of the running shoes) so the condition is only fulfilled in-game.
 
Back
Top