• 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.2

ardicoozer

Cooltrainer
Member
Joined
Sep 29, 2020
Posts
187
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
701
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.
 

CJ3929

Rookie
Member
Joined
Dec 21, 2024
Posts
3
Hello, sorry to bother you, but I'm having an issue. I have a predetermined move pool in the PBS for a fight, and want to keep it. However, the mon is set to 19, and if it scales to 20, it doesnt keep the move pool. This is the script I put.

setBattleRule
("AutomaticLevelScaling.setTemporaryS
etting(updateMoves,false)")

Am I doing something wrong? I want it to be able to evolve without switching the move set, but I don't want to universally disable the updateMoves.
 

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
90
Hello, sorry to bother you, but I'm having an issue. I have a predetermined move pool in the PBS for a fight, and want to keep it. However, the mon is set to 19, and if it scales to 20, it doesnt keep the move pool. This is the script I put.

setBattleRule
("AutomaticLevelScaling.setTemporaryS
etting(updateMoves,false)")

Am I doing something wrong? I want it to be able to evolve without switching the move set, but I don't want to universally disable the updateMoves.
You almost did it right. The correct syntax is AutomaticLevelScaling.setTemporarySetting("updateMoves", false) (don't forget the "" in the setting name). Also, although the method is based on the way setBattleRule works, settings from the plugin are not available in setBattleRule.
I hope this helps you. Please send me any other questions or problems you might find.
 

DrRedPantz

Rookie
Member
Joined
Jan 16, 2025
Posts
4
I know that this is an older thread, but I am not entirely sure where to plug this script in. There are 5 of them in the folder and I am unsure where to put them. Where go? lol
 

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
90
I know that this is an older thread, but I am not entirely sure where to plug this script in. There are 5 of them in the folder and I am unsure where to put them. Where go? lol
Hello, welcome to the community! So, all the files in the Automatic Level Scaling folder are important to make the plugin work correctly. When you install a plugin, the general installation process includes extracting the zip file directly to the root folder of your project (the folder that contains the file Game.rxproj). By doing this, with this plugin, you'll add the Automatic Level Scaling directly to the Plugins folder in your game. Because some plugins also use other folders like Graphics, PBS, and Audio, the instruction to extract the zip directly to the root makes the installation process simpler than looking for the destinations manually, so this is a general rule that many plugins follow.
 

DrRedPantz

Rookie
Member
Joined
Jan 16, 2025
Posts
4
Hello, welcome to the community! So, all the files in the Automatic Level Scaling folder are important to make the plugin work correctly. When you install a plugin, the general installation process includes extracting the zip file directly to the root folder of your project (the folder that contains the file Game.rxproj). By doing this, with this plugin, you'll add the Automatic Level Scaling directly to the Plugins folder in your game. Because some plugins also use other folders like Graphics, PBS, and Audio, the instruction to extract the zip directly to the root makes the installation process simpler than looking for the destinations manually, so this is a general rule that many plugins follow.
So I extracted the files to the root of my game folder and then I set up the event like your example. It still doesn't seem to be working. Did I miss a step maybe?
 

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
90
So I extracted the files to the root of my game folder and then I set up the event like your example. It still doesn't seem to be working. Did I miss a step maybe?
I'd need a little bit more information to help you find the issue. Does the plugin show up in the terminal? Did you activate the event before entering a fight? Did you also copy the part of the event page where it changes the difficulty only for a single battle (it is only an example, and would cause a bug if copied directly)?
 

DrRedPantz

Rookie
Member
Joined
Jan 16, 2025
Posts
4
I'd need a little bit more information to help you find the issue. Does the plugin show up in the terminal? Did you activate the event before entering a fight? Did you also copy the part of the event page where it changes the difficulty only for a single battle (it is only an example, and would cause a bug if copied directly)?
The plug in shows up in the terminal. I also set up an event to where when you talk to an npc it offers a decision. Easy - Hard. Once I click an option, nothing changes. Here is a screen shot for the event. I would like for this to affect the whole game. I don't need it to be temporary.
I don't know how to upload a screenshot.When Choice Easy is Picked
Control Variable 99 Trainer Difficulty = 1
Control Variable 100 Wild Difficulty = 1
 

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
90
The plug in shows up in the terminal. I also set up an event to where when you talk to an npc it offers a decision. Easy - Hard. Once I click an option, nothing changes. Here is a screen shot for the event. I would like for this to affect the whole game. I don't need it to be temporary.
I don't know how to upload a screenshot.When Choice Easy is Picked
Control Variable 99 Trainer Difficulty = 1
Control Variable 100 Wild Difficulty = 1
I'll suggest you make an event that only changes the difficulty by changing both variables, without any choice command, then add a party of level 100 pokemon and enter a battle to see if the script activates. I think this will make it clear if everything is working or not. The common causes the script would not scale levels properly are if you're changing the wrong variable or if you're setting an invalid difficulty id (but the script will let you know if this is the issue).
 

DrRedPantz

Rookie
Member
Joined
Jan 16, 2025
Posts
4
I'll suggest you make an event that only changes the difficulty by changing both variables, without any choice command, then add a party of level 100 pokemon and enter a battle to see if the script activates. I think this will make it clear if everything is working or not. The common causes the script would not scale levels properly are if you're changing the wrong variable or if you're setting an invalid difficulty id (but the script will let you know if this is the issue).
Thank you for you patience!
I was able to get the script working. I toggled on Proportional Leveling setting and all my problems went away.
 

EastChapel

Rookie
Member
Joined
Feb 18, 2025
Posts
2
I'm looking at rematches using the scaling system - would it be possible for the script (or is there some other way) to create a rematch of a trainer with (x) levels above from when you first battle them?
 

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
90
I'm looking at rematches using the scaling system - would it be possible for the script (or is there some other way) to create a rematch of a trainer with (x) levels above from when you first battle them?
That's a very interesting idea. I'm not familiar with Essentials' rematch system, but I'll try to give you some direction from what this script offers you.
If you're using the new save_trainer_parties setting, you can have access to the parties used in the last battle, from which you can get their average level. I made a function that allows you to determine if the level difference is enough for a rematch to happen:

Ruby:
Expand Collapse Copy
def shouldRematch?(trainer, level_difference_required_for_rematch = 10)
  return false if !AutomaticLevelScaling.battledTrainer?(trainer.key)

  avarage_level = 0
  trainer.party.each { |pokemon| avarage_level += pokemon.level }
  avarage_level /= trainer.party.length

  return AutomaticLevelScaling.getScaledLevel - avarage_level > level_difference_required_for_rematch
end

You could call it with a script Conditional Branch (like trainer battles) and add the rematch inside. You can get the trainer parameter with pbLoadTrainer, like pbLoadTrainer(:LEADER_Brock, "Brock"). The final script call would look like this: shouldRematch?(pbLoadTrainer(:LEADER_Brock, "Brock")). If you're not familiar with coding and need a simpler explanation, feel free to ask me and I'll try my best to make it easier to understand.
 

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
90
I just noticed you would also need to disable save_trainer_parties in an event before the rematch, and after calling this method (unless the rematch uses a different trainer version).
 

EastChapel

Rookie
Member
Joined
Feb 18, 2025
Posts
2
That's a very interesting idea. I'm not familiar with Essentials' rematch system, but I'll try to give you some direction from what this script offers you.
If you're using the new save_trainer_parties setting, you can have access to the parties used in the last battle, from which you can get their average level. I made a function that allows you to determine if the level difference is enough for a rematch to happen:

Ruby:
Expand Collapse Copy
def shouldRematch?(trainer, level_difference_required_for_rematch = 10)
  return false if !AutomaticLevelScaling.battledTrainer?(trainer.key)

  avarage_level = 0
  trainer.party.each { |pokemon| avarage_level += pokemon.level }
  avarage_level /= trainer.party.length

  return AutomaticLevelScaling.getScaledLevel - avarage_level > level_difference_required_for_rematch
end

You could call it with a script Conditional Branch (like trainer battles) and add the rematch inside. You can get the trainer parameter with pbLoadTrainer, like pbLoadTrainer(:LEADER_Brock, "Brock"). The final script call would look like this: shouldRematch?(pbLoadTrainer(:LEADER_Brock, "Brock")). If you're not familiar with coding and need a simpler explanation, feel free to ask me and I'll try my best to make it easier to understand.
You must've explained it quite well, because I got it working after a bit of wrangling. I ended up having to create a new version of the trainer for it to work properly - couldn't tell you why, but thats just what seemed to be effective.

This is going to be super useful moving forward. It may create strange situations where starting area trainers end up stronger than region champions depending on when the player begins the rematch but that would only be in late game situations anyway. I think I with a bit of guidance I could work out a way to stop that from happening though.
 

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
90
You must've explained it quite well, because I got it working after a bit of wrangling. I ended up having to create a new version of the trainer for it to work properly - couldn't tell you why, but thats just what seemed to be effective.

This is going to be super useful moving forward. It may create strange situations where starting area trainers end up stronger than region champions depending on when the player begins the rematch but that would only be in late game situations anyway. I think I with a bit of guidance I could work out a way to stop that from happening though.
Great! I'm glad I could help. An idea is to set the champion's party level to a game variable, alongside a switch to check if you defeated the champion, and use it as the parameter in the scale method call in the trainer EventHandlers, depending on how you implemented the code. You might also find a more creative way to work around this, I think this is a problem that can be tackled by multiple perspectives.

Ruby:
Expand Collapse Copy
for pokemon in trainer.party do
  if pbGet(12)
    pokemon.scale($game_variables[26])
  else
    pokemon.scale
  end
end
 
Back
Top