• 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.
Resource icon

Resource Automatic Level Scaling 1.5.1

hostman

Trainer
Member
Joined
Aug 24, 2023
Posts
70
1708527658625.png

I have these options activated, however the enemy pokemon continue to evolve automatically despite having it set to false. What I can do?
 

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
77
View attachment 26289
I have these options activated, however the enemy pokemon continue to evolve automatically despite having it set to false. What I can do?
There are multiple possible causes for this problem, I'll list some of them.
  • Parameter names seem to be written without the _ between words, which would cause a syntax error.
  • I see you change the difficulty before changing settings with setSettings, if you're not doing this for a specific battle and you want to change the settings globally, please change the settings in the 002_Settings.rb file instead, because setting them in an event would trigger then only once the event is activated (which might be another cause for the issue) and settings would reset after the player restarts the game.
  • You might be looking for the functionality of includeNextStages instead of automaticEvolutions. automaticEvolutions makes the plugin not change the stage set in the PBS in any way, while includeNextStages would stop evolution in a certain evolutionary stage. For example, imagine the player finds a level 17 Ivysaur set in the PBS while his party is around level 15, if automaticEvolutions is disabled, the pokemon would still be an Ivysaur, while if includeNextStages was disabled, it would revert to a Bulbasaur.
I hope this explanation can help you fix your issue. If you have any questions, please don't hesitate to ask.
 

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
77
I would also like to add, for current users of the plugin, that in a future update (which would come with the need to fix some issues or implement a new feature and not right away), I will probably change the name of some of the settings and methods so that they can be a little bit more intuitive, and easier to understand for new users.
I was already interested in doing this in the last update, but I was not sure because I didn't want to make the updating process longer or more complicated. The solution I'm thinking about using is changing the default method and setting names, but also keeping the old ones as aliases. I honestly really don't want to remove the old ones completely, because I know finding and changing all of them in projects being made now would use a lot of time and would cause bugs wherever they are not updated. I would also change their names on the overview page and all other documentation, but I think this would not be a problem for people who are already used to the old names and their functionality.
Also, if you disagree and think this would not be a good idea, or you think this could be creating other problems, please tell me about your opinion.
 

hostman

Trainer
Member
Joined
Aug 24, 2023
Posts
70
There are multiple possible causes for this problem, I'll list some of them.
  • Parameter names seem to be written without the _ between words, which would cause a syntax error.
  • I see you change the difficulty before changing settings with setSettings, if you're not doing this for a specific battle and you want to change the settings globally, please change the settings in the 002_Settings.rb file instead, because setting them in an event would trigger then only once the event is activated (which might be another cause for the issue) and settings would reset after the player restarts the game.
  • You might be looking for the functionality of includeNextStages instead of automaticEvolutions. automaticEvolutions makes the plugin not change the stage set in the PBS in any way, while includeNextStages would stop evolution in a certain evolutionary stage. For example, imagine the player finds a level 17 Ivysaur set in the PBS while his party is around level 15, if automaticEvolutions is disabled, the pokemon would still be an Ivysaur, while if includeNextStages was disabled, it would revert to a Bulbasaur.
I hope this explanation can help you fix your issue. If you have any questions, please don't hesitate to ask.
1708622152657.png


thank you! I did the thing to modify them directly from 002_Settings.rb, however I can't find the variable for updates moves (the others do). Can you tell me if it is somewhere else?
 

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
77
View attachment 26329

thank you! I did the thing to modify them directly from 002_Settings.rb, however I can't find the variable for updates moves (the others do). Can you tell me if it is somewhere else?
Oh, yes, there's no global setting for update_moves, because you'll probably prefer to let the plugin define moves in at least some scenarios, like with wild pokemon, because you can't set their moves manually in the PBS and it could be weird seeing them using weaker moves when they are already in a higher level. If you are sure you will set move sets for the pokemon of every trainer in your game, you can add this line of code: AutomaticLevelScaling.setTemporarySetting("updateMoves", false) in the on_trainer_load EventHandlers at the 004_Event_Handlers.rb file. It will look like this:
Ruby:
Expand Collapse Copy
# Activates script when a trainer pokemon is created
EventHandlers.add(:on_trainer_load, :automatic_level_scaling,
  proc { |trainer|
    id = pbGet(LevelScalingSettings::TRAINER_VARIABLE)
    next if !trainer || id == 0
    AutomaticLevelScaling.difficulty = id
    AutomaticLevelScaling.setTemporarySetting("updateMoves", false)

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

    for pokemon in trainer.party do
      AutomaticLevelScaling.setNewLevel(pokemon, pokemon.level - avarage_level)
    end
  }
)
If you only want to manually define some of the move sets, you can use the same line in an event command just before the specific battle (which is what I generally recommend unless you are making a game with trainers that only use competitive teams).
 

Chadofy

Rookie
Member
Joined
Feb 26, 2024
Posts
2
Hello, thanks for this plugin. I love to use it, especially with trainers.

However I would like to make a difficulty level where Pokemons go from level 1 to the maximum level of your strongest Pokemon in your party.
I tried with this but it doesn't work ☹️

5 => Difficulty.new(fixed_increase: 0, random_increase: -GameData::GrowthRate.max_level)

Do you know how i could change that?
 
Last edited:

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
77
Hello, thanks for this plugin. I love to use it, especially with trainers.

However I would like to make a difficulty level where Pokemons go from level 1 to the maximum level of your strongest Pokemon in your party.
I tried with this but it doesn't work ☹️

5 => Difficulty.new(fixed_increase: 0, random_increase: -GameData::GrowthRate.max_level)

Do you know how i could change that?
Hello, thank you for the appreciation. Unfortunately, there is no easy way to make a difficulty as you described in the 002_Settings.rb file because the highest level and the scaled party level are not constant values. However, I found a way to implement this feature in the :on_trainer_load EventHandlers at the 004_Event_Handlers.rb file, here's the code snippet:
Ruby:
Expand Collapse Copy
# Activates script when a trainer pokemon is created
EventHandlers.add(:on_trainer_load, :automatic_level_scaling,
  proc { |trainer|
    id = pbGet(LevelScalingSettings::TRAINER_VARIABLE)
    next if !trainer || id == 0
    AutomaticLevelScaling.difficulty = id

    if id == 5
      LevelScalingSettings::DIFFICULTIES[5].fixed_increase = 0
      LevelScalingSettings::DIFFICULTIES[5].random_increase = 0
      LevelScalingSettings::DIFFICULTIES[5].fixed_increase = -AutomaticLevelScaling.getScaledLevel

      highest_level = 0
      $player.party.each { |pokemon|
        highest_level = pokemon.level if pokemon.level > highest_level
      }
      LevelScalingSettings::DIFFICULTIES[5].random_increase = highest_level
    end

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

    for pokemon in trainer.party do
      AutomaticLevelScaling.setNewLevel(pokemon, pokemon.level - avarage_level)
    end
  }
)
Just add the highlighted lines to the function in your script version. As for the setting in the 002_Settings.rb, you can leave it in any way you want, because its values are overwritten before each trainer battle.
 

Chadofy

Rookie
Member
Joined
Feb 26, 2024
Posts
2
Hello, thank you for the appreciation. Unfortunately, there is no easy way to make a difficulty as you described in the 002_Settings.rb file because the highest level and the scaled party level are not constant values. However, I found a way to implement this feature in the :on_trainer_load EventHandlers at the 004_Event_Handlers.rb file, here's the code snippet:
Ruby:
Expand Collapse Copy
# Activates script when a trainer pokemon is created
EventHandlers.add(:on_trainer_load, :automatic_level_scaling,
  proc { |trainer|
    id = pbGet(LevelScalingSettings::TRAINER_VARIABLE)
    next if !trainer || id == 0
    AutomaticLevelScaling.difficulty = id

    if id == 5
      LevelScalingSettings::DIFFICULTIES[5].fixed_increase = 0
      LevelScalingSettings::DIFFICULTIES[5].random_increase = 0
      LevelScalingSettings::DIFFICULTIES[5].fixed_increase = -AutomaticLevelScaling.getScaledLevel

      highest_level = 0
      $player.party.each { |pokemon|
        highest_level = pokemon.level if pokemon.level > highest_level
      }
      LevelScalingSettings::DIFFICULTIES[5].random_increase = highest_level
    end

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

    for pokemon in trainer.party do
      AutomaticLevelScaling.setNewLevel(pokemon, pokemon.level - avarage_level)
    end
  }
)
Just add the highlighted lines to the function in your script version. As for the setting in the 002_Settings.rb, you can leave it in any way you want, because its values are overwritten before each trainer battle.
Thank you very much!

It works for Wild Pokemons as well. 🥳
 

hostman

Trainer
Member
Joined
Aug 24, 2023
Posts
70
1709047726307.png
I have another question, when creating the pokemon in this way to add the movements. It does not affect the automatic level climber. Do you know why it can be?
 

Attachments

  • 1709046928836.png
    1709046928836.png
    83.3 KB · Views: 15

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
77
View attachment 26488I have another question, when creating the pokemon in this way to add the movements. It does not affect the automatic level climber. Do you know why it can be?
You can add AutomaticLevelScaling.setNewLevel(pkmn) (before teaching the new moves and after creating the new pokemon) to scale it according to the current settings. You could also use AutomaticLevelScaling.getScaledLevel in the level parameter (like this: Pokemon.new(:SHAYMIN, AutomaticLevelScaling.getScaledLevel)), but AutomaticLevelScaling.setNewLevel would also evolve the pokemon and apply other settings.
 

RegalSword

Pokemon Itinerant Developer
Member
Joined
Feb 13, 2021
Posts
522
Hello. The trainer side of things works fine, but when a wild encounter tries to load itself I receive this error:
Code:
Expand Collapse Copy
=================

[2024-06-30 00:00:41 -0700]
[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]

Exception: RuntimeError
Message: No difficulty with id "[]" was provided in the DIFFICULTIES Hash of Settings.

Backtrace:
[Automatic Level Scaling] 003_Script.rb:33:in `difficulty='
[Automatic Level Scaling] 004_Event_Handlers.rb:11:in `block in <main>'
Event_Handlers:89:in `block in trigger'
Event_Handlers:89:in `each_value'
Event_Handlers:89:in `trigger'
Event_HandlerCollections:63:in `trigger'
Overworld_WildEncounters:449:in `pbGenerateWildPokemon'
Overworld_BattleStarting:412:in `block in generate_foes'
Overworld_BattleStarting:404:in `each'
Overworld_BattleStarting:404:in `generate_foes'
What could I be doing wrong?
 

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
77
Hello. The trainer side of things works fine, but when a wild encounter tries to load itself I receive this error:
Code:
Expand Collapse Copy
=================

[2024-06-30 00:00:41 -0700]
[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]

Exception: RuntimeError
Message: No difficulty with id "[]" was provided in the DIFFICULTIES Hash of Settings.

Backtrace:
[Automatic Level Scaling] 003_Script.rb:33:in `difficulty='
[Automatic Level Scaling] 004_Event_Handlers.rb:11:in `block in <main>'
Event_Handlers:89:in `block in trigger'
Event_Handlers:89:in `each_value'
Event_Handlers:89:in `trigger'
Event_HandlerCollections:63:in `trigger'
Overworld_WildEncounters:449:in `pbGenerateWildPokemon'
Overworld_BattleStarting:412:in `block in generate_foes'
Overworld_BattleStarting:404:in `each'
Overworld_BattleStarting:404:in `generate_foes'
What could I be doing wrong?

This error usually happens when the Wild difficulty variable (number 100 by default) is not initiated properly, or its value is changed by some other method.
In this case, I believe this variable might be used in another place in your game since its value in the error message is an array. You can use another variable by changing the WILD_VARIABLE setting in the 002_Settings.rb file.
Maybe another plugin is using this variable too, if you find out this is the case, please tell me which one it is so that I can put a warning on the overview page.
I hope this solves the issue!
 

RegalSword

Pokemon Itinerant Developer
Member
Joined
Feb 13, 2021
Posts
522
This error usually happens when the Wild difficulty variable (number 100 by default) is not initiated properly, or its value is changed by some other method.
In this case, I believe this variable might be used in another place in your game since its value in the error message is an array. You can use another variable by changing the WILD_VARIABLE setting in the 002_Settings.rb file.
Maybe another plugin is using this variable too, if you find out this is the case, please tell me which one it is so that I can put a warning on the overview page.
I hope this solves the issue!
You were right. Changing the Wild difficulty variable fixed the issue. Thanks! I wasn't able to figure out which plugin might have been causing the issue, but I'll let you know if I ever find it!
 
Back
Top