• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Resource icon

Resource Automatic Level Scaling 1.5.1

RowanWolf14

Rookie
Member
Joined
Dec 8, 2022
Posts
3
Hi, I love this plugin but I have a rather dumb question; it says in the overview to 'make sure you're using variables 99 & 100' but it doesn't say what to do if you're not using those variables. I am new to ruby and I don't know what do to in order to implement those variables manually. Could you help me or direct me to a tutorial that will tell me how to edit those variables into 99 & 100 in order to properly implement the script?
 

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
77
Hi, I love this plugin but I have a rather dumb question; it says in the overview to 'make sure you're using variables 99 & 100' but it doesn't say what to do if you're not using those variables. I am new to ruby and I don't know what do to in order to implement those variables manually. Could you help me or direct me to a tutorial that will tell me how to edit those variables into 99 & 100 in order to properly implement the script?
Don't worry, Ruby knowledge is not necessary, and if you are not using these variables, you have successfully installed the plugin, and you don't need to mess around with the settings if you don't feel comfortable about it. You can proceed to select a difficulty to activate the plugin, by changing the value of the variables in an event in your game.

The easiest way to do this is by opening the Intro Event, inserting a command, and selecting "Control Variables...", then you should select variable 99 (you can also rename it to "Trainer difficulty" or something like this so that you don't forget about it later) and set it to one of the difficulties ids. The default difficulties ids are 1 for easy, 2 for medium, and 3 for hard. Repeat it for variable 100, and wild scaling will also be activated.

1673144917093.png

In this example, I selected medium for the trainer difficulty.

Doing this in the intro event will activate the plugin from the beginning of the game, but you can also activate it later on or change the difficulty for a specific battle. You can also let the player choose the difficulty by using the "Show Choices..." command as I did in the Overview tutorial.

Thundaga posted an Youtube video recently explaining event basics, I recommend you watch it still looks confusing to you. Also, feel free to ask any other questions you may have, there is no such thing as a dumb question.
 

RowanWolf14

Rookie
Member
Joined
Dec 8, 2022
Posts
3
So I have the plugin installed, but I do not have these variables defined. How do I define them OR how do I get it to run without defining the variables? Thundaga's videos seem expansive, but unfortunately I don't follow verbal explanations well. When I playtest the game, the levels do not change when I use the demo party and it doesn't change when i use rare candys. i also dont get a prompt to select a difficulty, so I'm not sure how to turn it on. I've got other plugins installed, is that a problem?
 
Last edited:

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
77
So I have the plugin installed, but I do not have these variables defined. How do I define them OR how do I get it to run without defining the variables? Thundaga's videos seem expansive, but unfortunately I don't follow verbal explanations well. When I playtest the game, the levels do not change when I use the demo party and it doesn't change when i use rare candys. i also dont get a prompt to select a difficulty, so I'm not sure how to turn it on. I've got other plugins installed, is that a problem?
You don't need to define any variable, you should just set their values to one of the ids. If you are confused because there is no "Trainer difficulty" variable, don't worry, you are supposed to name it yourself, what matters is that you're changing variables 99 and 100 values. If you are still having trouble changing the variable values, you can use the following code in an event using the script command to change it.

Ruby:
pbSet(99, 2)
pbSet(100, 2)
 

OkunoShio

Cooltrainer
Member
Joined
Oct 22, 2022
Posts
127
Hey Benitex!

Thanks for this awesome plugin, I love it! I wanted to tweak it just a tiny bit so it does not "devolve" trainer Pokémon, e.g. if I define in the PBS that a trainer shall have an Ivysaur, I want it to always be at least an Ivysaur even if you encounter him at a lower level (but I still want it to be able to evolve into Venusaur once the level scaling moves it up to the required level). Can you help me with that?

Thanks! :)
 

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
77
Hey Benitex!

Thanks for this awesome plugin, I love it! I wanted to tweak it just a tiny bit so it does not "devolve" trainer Pokémon, e.g. if I define in the PBS that a trainer shall have an Ivysaur, I want it to always be at least an Ivysaur even if you encounter him at a lower level (but I still want it to be able to evolve into Venusaur once the level scaling moves it up to the required level). Can you help me with that?

Thanks! :)
You can remove this line: pokemon.species = GameData::Species.get(pokemon.species).get_baby_species # revert to the first stage from the method setNewStage(pokemon) in 003_Script.rb. I will also update the plugin to include this feature soon, including a temporary setting and an option in the 002_Settings.rb file. Thanks for the compliments and the idea.
 

OkunoShio

Cooltrainer
Member
Joined
Oct 22, 2022
Posts
127
When I want to use your plugin in combination with Deluxe Battles (Essentials Deluxe Plugin), level scaling does not get applied - I looked into all scripts for a few hours now and cannot wrap my head around the reason why this is the case, since the Trainerbattle.dx script is tracing back to the regular Trainerbattle.start script, which should trigger the level scaling. Any idea on what the issue could be or how I could solve it? Thanks in advance!
 

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
77
When I want to use your plugin in combination with Deluxe Battles (Essentials Deluxe Plugin), level scaling does not get applied - I looked into all scripts for a few hours now and cannot wrap my head around the reason why this is the case, since the Trainerbattle.dx script is tracing back to the regular Trainerbattle.start script, which should trigger the level scaling. Any idea on what the issue could be or how I could solve it? Thanks in advance!
I've never used Essentials Deluxe before, I installed it to test it working with my plugin quickly, and it seemed to work just fine on the trainer side, both regular battles and Deluxe Battles.
Wild Deluxe Battles did not work automatically, and EBDX Boss Battles (which I'm more familiar with) don't get scaled automatically either. I use the method
AutomaticLevelScaling.getScaledLevel as a workaround in my game. I also use it when I give the player a gift pokemon.
I had to create a new save file to install Essentials Deluxe and also set the values of the variables that control level scaling again, maybe you forgot to set the values in the new save in your game?
My plugin is activated using EventHandlers, maybe you can trigger one of them somewhere in the code of Essentials Deluxe. I hope this helps you in some way.
 

OkunoShio

Cooltrainer
Member
Joined
Oct 22, 2022
Posts
127
Thanks for looking into it, good to hear that it should work, I now just have to figure out where the issue is located in my file :) the level scaling works fine for regular wild and trainer battles, I found a workaround for Wild Deluxe Battles as well, just Trainer Deluxe does not work :/
It should not be necessary to add an EventHandler in the Essentials Deluxe code, since it calls TrainerBattle.start itself, which then should call your plugin.

Edit: I think i figured out what the issue is: the Trainer Battle needs to be called from the field/event itself; I tried calling them from another script so I had some more room to modify things, but there is a different way of doing it with the Deluxe capabilities. Thanks again for testing the general functionality to help me find my problem! :)
 

Screen Lady

Glitch Trainer
Member
Joined
Dec 2, 2022
Posts
20
Question, is it possible to use proportional scaling without the game crashing at later levels?

My config is like so:

module LevelScalingSettings
# These two below are the variables that control difficulty
# (You can set both of them to be the same)
TRAINER_VARIABLE = 100
WILD_VARIABLE = 25

# Scales levels but takes original level differences into consideration
# Don't forget to set random_increase values to 0 when using this setting
PROPORTIONAL_SCALING = true

# You can use the following to disable level scaling in any condition other then the selected below
ONLY_SCALE_IF_HIGHER = true # The script will only scale levels if the player is overleveled
ONLY_SCALE_IF_LOWER = false # The script will only scale levels if the player is underleveled

# You can add your own difficulties here, using the function "Difficulty.new(id, fixed_increase, random_increase)"
# "id" is the value stored in TRAINER_VARIABLE or WILD_VARIABLE, defines the active difficulty
# "fixed_increase" is a pre defined value that increases the level (optional)
# "random_increase" is a randomly selected value between 0 and the value provided (optional)
# (These variables can also store negative values)
DIFICULTIES = [
Difficulty.new(id: 1, fixed_increase: 1), # Easy
Difficulty.new(id: 2, fixed_increase: 2), # Medium
Difficulty.new(id: 3, fixed_increase: 3), # Hard
Difficulty.new(id: 5, fixed_increase: 0), # Standard Essentials
]


I am going up against a regular battle that is normally Level 50, with a Level 100 against them. However, they seem to be scaling to Level 101, thus crashing the game.

[2023-02-01 14:13:24 -0500]
[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]

Script error in event 61 (coords 42,13), map 127 (Moras Island)
Exception: ArgumentError
Message: The level number (101) is invalid.

***Full script:
TrainerBattle.start(:TESTERONE, "Anchora")
Backtrace:
259:Pokemon:201:in `level='
[Automatic Level Scaling] 003_Script.rb:51:in `setNewLevel'
[Automatic Level Scaling] 004_Event_Handlers.rb:28:in `block (2 levels) in <main>'
[Automatic Level Scaling] 004_Event_Handlers.rb:27:in `each'
[Automatic Level Scaling] 004_Event_Handlers.rb:27:in `block in <main>'
035:Event_Handlers:89:in `block in trigger'
035:Event_Handlers:89:in `each_value'
035:Event_Handlers:89:in `trigger'
036:Event_HandlerCollections:63:in `trigger'
242:Overworld_BattleStarting:577:in `block in generate_foes'


It saddens me a bit because the proportional scaling is perfect for keeping the balance of the trainers, rather than disabling it and having everyones level sort of flatline. Is there any fix for this?
If anyone can help me sort this out, I'd highly appreciate it! I'm not the best with coding, so I'm not sure how to tweak everything to work myself.

EDIT: Besides the issue with level 100 and Proportional Scaling, everything else works fantastically!
 
Last edited:

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
77
Question, is it possible to use proportional scaling without the game crashing at later levels?

My config is like so:

module LevelScalingSettings
# These two below are the variables that control difficulty
# (You can set both of them to be the same)
TRAINER_VARIABLE = 100
WILD_VARIABLE = 25

# Scales levels but takes original level differences into consideration
# Don't forget to set random_increase values to 0 when using this setting
PROPORTIONAL_SCALING = true

# You can use the following to disable level scaling in any condition other then the selected below
ONLY_SCALE_IF_HIGHER = true # The script will only scale levels if the player is overleveled
ONLY_SCALE_IF_LOWER = false # The script will only scale levels if the player is underleveled

# You can add your own difficulties here, using the function "Difficulty.new(id, fixed_increase, random_increase)"
# "id" is the value stored in TRAINER_VARIABLE or WILD_VARIABLE, defines the active difficulty
# "fixed_increase" is a pre defined value that increases the level (optional)
# "random_increase" is a randomly selected value between 0 and the value provided (optional)
# (These variables can also store negative values)
DIFICULTIES = [
Difficulty.new(id: 1, fixed_increase: 1), # Easy
Difficulty.new(id: 2, fixed_increase: 2), # Medium
Difficulty.new(id: 3, fixed_increase: 3), # Hard
Difficulty.new(id: 5, fixed_increase: 0), # Standard Essentials
]


I am going up against a regular battle that is normally Level 50, with a Level 100 against them. However, they seem to be scaling to Level 101, thus crashing the game.

[2023-02-01 14:13:24 -0500]
[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]

Script error in event 61 (coords 42,13), map 127 (Moras Island)
Exception: ArgumentError
Message: The level number (101) is invalid.

***Full script:
TrainerBattle.start(:TESTERONE, "Anchora")
Backtrace:
259:Pokemon:201:in `level='
[Automatic Level Scaling] 003_Script.rb:51:in `setNewLevel'
[Automatic Level Scaling] 004_Event_Handlers.rb:28:in `block (2 levels) in <main>'
[Automatic Level Scaling] 004_Event_Handlers.rb:27:in `each'
[Automatic Level Scaling] 004_Event_Handlers.rb:27:in `block in <main>'
035:Event_Handlers:89:in `block in trigger'
035:Event_Handlers:89:in `each_value'
035:Event_Handlers:89:in `trigger'
036:Event_HandlerCollections:63:in `trigger'
242:Overworld_BattleStarting:577:in `block in generate_foes'


It saddens me a bit because the proportional scaling is perfect for keeping the balance of the trainers, rather than disabling it and having everyones level sort of flatline. Is there any fix for this?
If anyone can help me sort this out, I'd highly appreciate it! I'm not the best with coding, so I'm not sure how to tweak everything to work myself.

EDIT: Besides the issue with level 100 and Proportional Scaling, everything else works fantastically!
Thanks for the bug report. I'll release an update fixing it soon!
 

Screen Lady

Glitch Trainer
Member
Joined
Dec 2, 2022
Posts
20
Thanks for the bug report. I'll release an update fixing it soon!
I went back in and specifically re-added random_increase: 0 to the end of each Difficulty variable, and it seems to have fixed the issue. So if it helps, it appears to only happen if you don't have the zero defined in the difficulty alongside the actual difficulty + proportional scaling itself?
Or I'm really stupid and out of my mind, that's equally likely.
 

Screen Lady

Glitch Trainer
Member
Joined
Dec 2, 2022
Posts
20
Hey again, I've got something to ask. I'm not sure if I'm just goofing up a setting, or if this is a bug of sorts, but I noticed that any scaling seems to shuffle evolved pokemon with branched evolutions.
For example, Gardevoir would randomly be swapped out for Gallade, Umbreon might change into Leafeon, ect. It seems final evolutions are treated no differently than pre-evos as long as they branch out. Is there as setting to prevent this that I haven't noticed?
 

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
77
Hey again, I've got something to ask. I'm not sure if I'm just goofing up a setting, or if this is a bug of sorts, but I noticed that any scaling seems to shuffle evolved pokemon with branched evolutions.
For example, Gardevoir would randomly be swapped out for Gallade, Umbreon might change into Leafeon, ect. It seems final evolutions are treated no differently than pre-evos as long as they branch out. Is there as setting to prevent this that I haven't noticed?
Thanks for the question. The current way to make a pokemon evolve to a specific evolution is not very intuitive, honestly.
I'll post an update changing the way species with multiple evolutions evolve. From now on, using the final stage in the PBS (or in a function) will set the pokemon to a specific evolution, while using any previous stage will keep the evolution random.
 

Screen Lady

Glitch Trainer
Member
Joined
Dec 2, 2022
Posts
20
Thanks for the question. The current way to make a pokemon evolve to a specific evolution is not very intuitive.
I'll post an update changing the way species with multiple evolutions evolve. From now on, using the final stage in the PBS (or in a function) will set the pokemon to a specific evolution, while using any previous stage will keep the evolution random.
Thanks for the fast reply!
 
Back
Top