• 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

Quibbi

Rookie
Member
Joined
Dec 5, 2023
Posts
2
Try holding ctrl after clicking the play button, to make the game compile all files.
It worked!!! Thanks. I've just started making Pokemon fangames and I didn't know that.

I have another question that may be so basic: I know I can change the parameters of the scaling and add new levels of difficulty in the "Settings.rb" but I don´t even know how to open the file or how can I have access to their content.
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
614
It worked!!! Thanks. I've just started making Pokemon fangames and I didn't know that.

I have another question that may be so basic: I know I can change the parameters of the scaling and add new levels of difficulty in the "Settings.rb" but I don´t even know how to open the file or how can I have access to their content.
You can simply open them with the notebook. I don't know how the program is called in English or other languages but it should have this icon:
1701867752915.png
 

DeepBlue PacificWaves

Producer of Project Lunastone | Failed Dreamer
Member
Joined
Aug 22, 2020
Posts
133
You can simply open them with the notebook. I don't know how the program is called in English or other languages but it should have this icon: View attachment 23057
I think it's called: "Notepad", but I'm not sure. I know him as "Bloco de Notas"
 

E4Artemy

Novice
Member
Joined
Dec 3, 2023
Posts
14
This is intentional behavior because of the way the get_evolutions and check_evolution_on_level_up methods work, changing it would make regional forms evolve into their non-regional variation, or ignore alternative evolutions completely. I think there might be a better way to implement regional evolutions, but I couldn't find it.

Also, the part that evolves pokemon according to their level is pretty simple. If anyone only wants evolutions from level up, they could remove everything from AutomaticLevelScaling.setNewStage and leave it like this:
Ruby:
def self.setNewStage(pokemon)
    while pokemon.check_evolution_on_level_up != nil
        pokemon.species = pokemon.check_evolution_on_level_up
    end
end
Note that more specific scenarios, like changing only wild pokemon evolutions, would require more changes in the code, like adding a bool to check if it's a wild pokemon and gets set in the event handler.
Hi! I rly want to cut non-Level up evolutions from scaling, but this method doesn't exclude Location evolutions, cuz they have level check. How can I do?
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
614
Well, this whole chunk of code is to see if the pokemon has the "Level" evolution method or not:
1702208253794.png

Maybe you should keep the setNewStage code as it was and just store whether has_other_evolving_method is true or false somewhere so you can turn off or on the scaling method. You may also want to check if the pokemon evolves by leveling up depending on their stats, their gender, if its wurmple or nincada or other level up methods that aren't tied to a location.

Though I don't know why you would edit the evolution method instead of editing the scaling method if you just want to keep certain pokemon from gaining or losing levels. They are not directly related and commenting out the pokemon from POKEMON_WITH_REGIONAL_FORMS makes those pokemon work as any other without forms when it comes to evolution.
 

E4Artemy

Novice
Member
Joined
Dec 3, 2023
Posts
14
Well, this whole chunk of code is to see if the pokemon has the "Level" evolution method or not:
View attachment 23130
Maybe you should keep the setNewStage code as it was and just store whether has_other_evolving_method is true or false somewhere so you can turn off or on the scaling method. You may also want to check if the pokemon evolves by leveling up depending on their stats, their gender, if its wurmple or nincada or other level up methods that aren't tied to a location.

Though I don't know why you would edit the evolution method instead of editing the scaling method if you just want to keep certain pokemon from gaining or losing levels. They are not directly related and commenting out the pokemon from POKEMON_WITH_REGIONAL_FORMS makes those pokemon work as any other without forms when it comes to evolution.
It didn't work to erase the code like I wondered. Explanation for what I want: Scaling and evolve all things, EXCEPT non-specific level evolutions. For example: If Viridian Forest would coded with Caterpie, Metapod, Pichu and Pikachu and the player have a lv. 10 proportional team, the encounters would be Butterfree, Pichu and Pikachu, i.e., the Pikachu family wouldn't EVER evolve. I tried so hard working with DEFAULT_X_EVOLUTION_LEVEL, but I don't know Ruby, just trying to explore things on my own.
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
614
This will keep the pokemon without the "Level" evolution method (or any other you added on the check part I shared on my last post) from evolving:
1702243653388.png

The only problem is that it will not keep the pokemon from going back to the preevolved form if you have the INCLUDE_PREVIOUS_STAGES as true in settings.

As for the scaling, it's done by AutomaticLevelScaling.setNewLevel(pokemon) if I'm not mistaken. So if you put that into a conditional that checks if has_other_evolving_method is false (you'll have to store whether it's true or not in a variable for that), it should keep the pokemon that use the "firstEvolutionLevel" and "secondEvolutionLevel" from scaling.
Something like this, for example:
1702244928135.png

The "includePreviousStages" is there to fix the preevolved problem from before.
And this is what you would need to add to the script for it to work:
1702244299480.png

You can change the switch number or use a variable you create especifically for this, but the idea would be the same.

As an extra note, slowpoke will never evolve to slowbro because slowking is marked as "has_other_evolving_method". So you may want to add this code in the wild pokemon handler:
Ruby:
  if pokemon.isSpecies?(:SLOWPOKE) && pokemon.form == 0
    AutomaticLevelScaling.setTemporarySetting("includePreviousStages", true)
    AutomaticLevelScaling.setTemporarySetting("firstEvolutionLevel", 37)
    $game_switches[2] = true
    AutomaticLevelScaling.setNewLevel(pokemon)
  end
The "includePreviousStages" is there so you can define slowbro as a wild encounter and still appear as a slowpoke when with low levels.
And in the script, change this:
1702244606587.png

to this:
1702244650554.png

This way, slowpoke can evolve to slowbro by leveling up when on a wild battle (the switch is used to tell the plugin if it's a wild battle or a trainer battle).

The same method can be done with any other pokemon with branched evolution where at least one of the evolutions would count for has_other_evolving_method.

I hope I explained it all clearly. It seems clear for me, but doesn't mean it'll be for others.
 

E4Artemy

Novice
Member
Joined
Dec 3, 2023
Posts
14
This will keep the pokemon without the "Level" evolution method (or any other you added on the check part I shared on my last post) from evolving:
View attachment 23189
The only problem is that it will not keep the pokemon from going back to the preevolved form if you have the INCLUDE_PREVIOUS_STAGES as true in settings.

As for the scaling, it's done by AutomaticLevelScaling.setNewLevel(pokemon) if I'm not mistaken. So if you put that into a conditional that checks if has_other_evolving_method is false (you'll have to store whether it's true or not in a variable for that), it should keep the pokemon that use the "firstEvolutionLevel" and "secondEvolutionLevel" from scaling.
Something like this, for example:
View attachment 23194
The "includePreviousStages" is there to fix the preevolved problem from before.
And this is what you would need to add to the script for it to work:
View attachment 23191
You can change the switch number or use a variable you create especifically for this, but the idea would be the same.

As an extra note, slowpoke will never evolve to slowbro because slowking is marked as "has_other_evolving_method". So you may want to add this code in the wild pokemon handler:
Ruby:
  if pokemon.isSpecies?(:SLOWPOKE) && pokemon.form == 0
    AutomaticLevelScaling.setTemporarySetting("includePreviousStages", true)
    AutomaticLevelScaling.setTemporarySetting("firstEvolutionLevel", 37)
    $game_switches[2] = true
    AutomaticLevelScaling.setNewLevel(pokemon)
  end
The "includePreviousStages" is there so you can define slowbro as a wild encounter and still appear as a slowpoke when with low levels.
And in the script, change this:
View attachment 23192
to this:
View attachment 23193
This way, slowpoke can evolve to slowbro by leveling up when on a wild battle (the switch is used to tell the plugin if it's a wild battle or a trainer battle).

The same method can be done with any other pokemon with branched evolution where at least one of the evolutions would count for has_other_evolving_method.

I hope I explained it all clearly. It seems clear for me, but doesn't mean it'll be for others.
I'm not very good at this, but you were clear and I think I get it. I don't think I made myself clear enough: If the map has Pichu, Clefairy and Rattata, at lv. 50, I'd want Pichu, Clefairy and Raticate; I want the levels, but not the evolution for no-level evolutions. Maybe I'm dumb, but your proposes don't allow that, am I wrong? Thank you for your time!
 
Last edited:

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
77
It didn't work to erase the code like I wondered. Explanation for what I want: Scaling and evolve all things, EXCEPT non-specific level evolutions. For example: If Viridian Forest would coded with Caterpie, Metapod, Pichu and Pikachu and the player have a lv. 10 proportional team, the encounters would be Butterfree, Pichu and Pikachu, i.e., the Pikachu family wouldn't EVER evolve. I tried so hard working with DEFAULT_X_EVOLUTION_LEVEL, but I don't know Ruby, just trying to explore things on my own.
I'll post an update fixing some bugs and adding this feature, which cannot be added easily in the current state of the plugin, and more people than I imagined are interested in this. Thank you for the suggestion!
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
614
The evolution part was the first thing I explained, though.

The "firstEvolutionLevel" and "secondEvolutionLevel" only work for pokemon that don't have this as their evolution method (with the default code):
1702275572413.png


So by using AutomaticLevelScaling.setTemporarySetting("firstEvolutionLevel", 101) and AutomaticLevelScaling.setTemporarySetting("secondEvolutionLevel", 102), you are telling the game that if the evolution of the first stage pokemon or second stage pokemon isn't "Level", they will not evolve.

With this code, it should work as you asked:
Ruby:
EventHandlers.add(:on_wild_pokemon_created, :automatic_level_scaling,
  proc { |pokemon|
    id = pbGet(LevelScalingSettings::WILD_VARIABLE)
    next if id == 0
    AutomaticLevelScaling.setDifficulty(id)

    if pokemon.isSpecies?(:PIKACHU) || pokemon.isSpecies?(:CLEFAIRY) || pokemon.isSpecies?(:JIGGLYPUFF) ||
    pokemon.isSpecies?(:CHANSEY) || pokemon.isSpecies?(:MRMIME) || pokemon.isSpecies?(:SNORLAX) ||
    pokemon.isSpecies?(:MARILL) || pokemon.isSpecies?(:AZUMARILL) ||pokemon.isSpecies?(:SUDOWOODO) ||
    pokemon.isSpecies?(:MANTINE) || pokemon.isSpecies?(:ROSELIA) || pokemon.isSpecies?(:CHIMECHO) ||
      AutomaticLevelScaling.setTemporarySetting("includePreviousStages", false)
    end

    AutomaticLevelScaling.setTemporarySetting("firstEvolutionLevel", 101)
    AutomaticLevelScaling.setTemporarySetting("secondEvolutionLevel", 102)

    AutomaticLevelScaling.setNewLevel(pokemon)
    AutomaticLevelScaling.setSettings if AutomaticLevelScaling.settings[:temporary] # reset settings
  }
)
The conditional check with AutomaticLevelScaling.setTemporarySetting("includePreviousStages", false) should keep the plugin from turning them into their preevolved forms. This way, you should be able to have both pichu and Pikachu on the same map, I think.

If you want other evolution methods to be excluded from that check (like for wurmple, combee and the like), I can share the little modifications I made for them to work. I shared the code to have slowpoke evolve into slowbro in the wild (it will remain a slowpoke otherwise) and I can tell you how to keep pokemon with evolution methods like tyrunt and amaura (that evolve by level only on a certain time) and sligoo (that evolve by level only on a certain weather) to stay evolved even when the time or weather isn't the proper one.
 

E4Artemy

Novice
Member
Joined
Dec 3, 2023
Posts
14
The evolution part was the first thing I explained, though.

The "firstEvolutionLevel" and "secondEvolutionLevel" only work for pokemon that don't have this as their evolution method (with the default code):
View attachment 23217

So by using AutomaticLevelScaling.setTemporarySetting("firstEvolutionLevel", 101) and AutomaticLevelScaling.setTemporarySetting("secondEvolutionLevel", 102), you are telling the game that if the evolution of the first stage pokemon or second stage pokemon isn't "Level", they will not evolve.

With this code, it should work as you asked:
Ruby:
EventHandlers.add(:on_wild_pokemon_created, :automatic_level_scaling,
  proc { |pokemon|
    id = pbGet(LevelScalingSettings::WILD_VARIABLE)
    next if id == 0
    AutomaticLevelScaling.setDifficulty(id)

    if pokemon.isSpecies?(:PIKACHU) || pokemon.isSpecies?(:CLEFAIRY) || pokemon.isSpecies?(:JIGGLYPUFF) ||
    pokemon.isSpecies?(:CHANSEY) || pokemon.isSpecies?(:MRMIME) || pokemon.isSpecies?(:SNORLAX) ||
    pokemon.isSpecies?(:MARILL) || pokemon.isSpecies?(:AZUMARILL) ||pokemon.isSpecies?(:SUDOWOODO) ||
    pokemon.isSpecies?(:MANTINE) || pokemon.isSpecies?(:ROSELIA) || pokemon.isSpecies?(:CHIMECHO) ||
      AutomaticLevelScaling.setTemporarySetting("includePreviousStages", false)
    end

    AutomaticLevelScaling.setTemporarySetting("firstEvolutionLevel", 101)
    AutomaticLevelScaling.setTemporarySetting("secondEvolutionLevel", 102)

    AutomaticLevelScaling.setNewLevel(pokemon)
    AutomaticLevelScaling.setSettings if AutomaticLevelScaling.settings[:temporary] # reset settings
  }
)
The conditional check with AutomaticLevelScaling.setTemporarySetting("includePreviousStages", false) should keep the plugin from turning them into their preevolved forms. This way, you should be able to have both pichu and Pikachu on the same map, I think.

If you want other evolution methods to be excluded from that check (like for wurmple, combee and the like), I can share the little modifications I made for them to work. I shared the code to have slowpoke evolve into slowbro in the wild (it will remain a slowpoke otherwise) and I can tell you how to keep pokemon with evolution methods like tyrunt and amaura (that evolve by level only on a certain time) and sligoo (that evolve by level only on a certain weather) to stay evolved even when the time or weather isn't the proper one.
This code certainly should work for what I want, but Benitex is going to update the script, so I'll wait and focus on other creation aspects for now. Thank you so much for all the support!
 

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
77
Benitex updated Automatic Level Scaling with a new update entry:

Add include_non_natural_evolutions setting and update regional forms implementation

The POKEMON_WITH_REGIONAL_FORMS array is not necessary anymore (no bugs would happen if you include it by accident either).
Like pokemon with multiple evolutions, if you select a regional form for a non-regional form pokemon with multiple evolutions, the script will automatically select the regional form used. For example, you can set

Read the rest of this update entry...
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
614
I'm looking at the files of the update and I see you included the Level + time of day evolution methods. Those, like level + weather and level + move do not work all that well. All of them will have the pokemon evolve for as long as the second condition is met, meaning that you will have a level 100 tyrantrum during the day but they'll revert to tyrunt at night, for example.

That is why I only had those level up evolution methods defined:
1702325521297.png

(By the way, ninjask works just like silcoon and cascoon in that it evolves nincada when leveling up but has the extra code to see if the trainer has a pokeball and a free space in team when evolution happens).

Unless you managed to fix that problem with the daytime, I don't think that having time based level up evolution is going to work as "natural evolution". I would be happy to know you managed to find a fix for it when all my tries ended in failure on that regard. I ended using the "firstEvolutionLevel" and "secondEvolutionLevel" with them for they to stay evolved.
 

Benitex

Trainer
Member
Joined
Nov 7, 2020
Posts
77
I'm looking at the files of the update and I see you included the Level + time of day evolution methods. Those, like level + weather and level + move do not work all that well. All of them will have the pokemon evolve for as long as the second condition is met, meaning that you will have a level 100 tyrantrum during the day but they'll revert to tyrunt at night, for example.

That is why I only had those level up evolution methods defined:
View attachment 23225
(By the way, ninjask works just like silcoon and cascoon in that it evolves nincada when leveling up but has the extra code to see if the trainer has a pokeball and a free space in team when evolution happens).

Unless you managed to fix that problem with the daytime, I don't think that having time based level up evolution is going to work as "natural evolution". I would be happy to know you managed to find a fix for it when all my tries ended in failure on that regard. I ended using the "firstEvolutionLevel" and "secondEvolutionLevel" with them for they to stay evolved.
Yeah, time-dependent evolutions can be a little weird, I didn't change the way they work. I think it's up to each one to decide if they should include them as natural or not. In my opinion, they can bring a little bit more variety, but maybe someone would prefer to remove them from the array for the sake of consistency.

I could add corner cases for them, but it would make the script much harder to update and keep up as more different evolution methods are added, so I'll keep it simple for now.
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
614
I wasn't talking about adding more methods, I just found it curious that they were added as a natural evolution. But yeah, in the end, the people using the plugin decide what evolutions count as "natural evolution".
 

E4Artemy

Novice
Member
Joined
Dec 3, 2023
Posts
14
I'm feeling annoying by this time... I've been testing the new version and noticed "INCLUDE_PREVIOUS_STAGES" is attached to "AUTOMATIC_EVOLUTIONS". Is there a way around this? To prevent Pokémon from evolving, but devolving if the evolution level wasn't reached?
 
Last edited:

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
614
Since "AUTOMATIC_EVOLUTIONS" also is used for the trainer's pokemon, you may want that as true. And then you have to add temporary settings on the wild pokemon event handler.

I did this on an older version of this plugin but it should guide you in the right direction:
1702362748737.png

The pbNoPreEvo(pokemon) and pbSpecialWildEvolutions(pokemon) are codes that I created somewhere else so the event handler doesn't become massive.

This is the code for pbNoPreEvo(pokemon):
1702362831384.png

The commented lines are a test I was doing on how to keep certain pokemon from deevolving. For the rest, most are pokemon that can hatch from egg but got a preevolution that could hatch from an egg if incense was used, which I find would not happen in the wild. If you add this, you can add and take away any pokemon from the conditional check to fit your game better.

And this is the code for pbSpecialWildEvolutions(pokemon):
1702363684908.png

Note: I defined the regional form's number to match the generation the region appeared in. You may want to change it to 1 or 2 or any number you defined them with.
I have a similar code for trainers' pokemon and most (if not all) are pokemon that have a "Level" evolution or one of its variants but weren't able to evolve or stay evolved. This basically works with "AUTOMATIC_EVOLUTIONS". Any pokemon with an evolution method not included as "natural evolution" uses the "firstEvolutionLevel" and "secondEvolutionLevel" to determine at which level they start appearing evolved.
So the conditionals check if the wild pokemon generated is one of those (and if it has a certain form on some) and evolve them at the level defined in the PBS (you have to manually define them, as you see). If it's none of the pokemon with the proper form, then the evolution levels are defined above the maximum level to keep them from evolving (again, this only works for evolution methods not defined as "natural evolutions", those that are defined in the array as natural evolutions should still evolve without problems).
 

E4Artemy

Novice
Member
Joined
Dec 3, 2023
Posts
14
Since "AUTOMATIC_EVOLUTIONS" also is used for the trainer's pokemon, you may want that as true. And then you have to add temporary settings on the wild pokemon event handler.

I did this on an older version of this plugin but it should guide you in the right direction:
View attachment 23243
The pbNoPreEvo(pokemon) and pbSpecialWildEvolutions(pokemon) are codes that I created somewhere else so the event handler doesn't become massive.

This is the code for pbNoPreEvo(pokemon):
View attachment 23244
The commented lines are a test I was doing on how to keep certain pokemon from deevolving. For the rest, most are pokemon that can hatch from egg but got a preevolution that could hatch from an egg if incense was used, which I find would not happen in the wild. If you add this, you can add and take away any pokemon from the conditional check to fit your game better.

And this is the code for pbSpecialWildEvolutions(pokemon):
View attachment 23246
Note: I defined the regional form's number to match the generation the region appeared in. You may want to change it to 1 or 2 or any number you defined them with.
I have a similar code for trainers' pokemon and most (if not all) are pokemon that have a "Level" evolution or one of its variants but weren't able to evolve or stay evolved. This basically works with "AUTOMATIC_EVOLUTIONS". Any pokemon with an evolution method not included as "natural evolution" uses the "firstEvolutionLevel" and "secondEvolutionLevel" to determine at which level they start appearing evolved.
So the conditionals check if the wild pokemon generated is one of those (and if it has a certain form on some) and evolve them at the level defined in the PBS (you have to manually define them, as you see). If it's none of the pokemon with the proper form, then the evolution levels are defined above the maximum level to keep them from evolving (again, this only works for evolution methods not defined as "natural evolutions", those that are defined in the array as natural evolutions should still evolve without problems).
Rly cool addition, but I realized it's better just cap the evolutions and don't force them. Using Viridian Forest again as a example: it's better to program Caterpie, Metapod and Butterfree as encounters and cap the later two as Caterpie before their respective evolution methods, than to program only Caterpie, and the forest become a Butterfree pandemonium later. Even the trainers work better; If I want a possible Butterfree trainer, just program it with one, and if it's underlevel, it will have a Caterpie or Metapod; but if I want a Caterpie trainer, the larva won't evolve. Hope it can be made easily ;-;
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
614
I think you will need to edit the script for that. Automatic evolutions will make pokemon evolve to their last form, regardless of the evolution stage they are defined in the PBS.

You will likely need to edit this code:
1702379098787.png

As you can see at the end, the plugin checks what species the pokemon was originaly defined as to select the evolution. Maybe you can use it to stop the evolution on the original species. I haven't looked at how much you will have to change, add or take away for it to work how you want to, though.
 
Back
Top