• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Gym Scaling?

13
Posts
5
Years
  • Age 25
  • Seen Oct 12, 2019
Scaling with Gym Badges?

Is there any way to have wild Pokémon, Trainers, and Gym Leaders scale with gym badges for like a open world type game?
 

BadSamaritan

Gone Fishin'
148
Posts
14
Years
  • Seen Jun 8, 2023
https://www.pokecommunity.com/showthread.php?t=309204&highlight=happiness

This thread gives you an example of how to do something similar, ableit only for trainer battles. Altering it to work with badges is pretty simple, but you first need to figure out how you want the formula to deduce to level.

Personally I recommend looking at how badges influence the amount of money a player loses in battle, which you can find around line 3970 in the "PokeBattle_Battle" script.

Edit: And for Wild Pokemon scaling, I believe I found a super simple fix for that. If you go into the script "PField_EncounterModifiers", right near the beginning you will see this code -

Code:
# Used in the random dungeon map.  Makes the levels of all wild Pokémon in that
# map depend on the levels of Pokémon in the player's party.
# This is a simple method, and can/should be modified to account for evolutions
# and other such details.  Of course, you don't HAVE to use this code.
Events.onWildPokemonCreate+=proc {|sender,e|
   pokemon=e[0]
   if $game_map.map_id==51
     newlevel=pbBalancedLevel($Trainer.party) - 4 + rand(5)   # For variety
     newlevel=1 if newlevel<1
     newlevel=PBExperience::MAXLEVEL if newlevel>PBExperience::MAXLEVEL
     pokemon.level=newlevel
     pokemon.calcStats
     pokemon.resetMoves
   end
}

As the explanation blurb before it indicates, this code automatically balances wild pokemon levels for maps marked as "random dungeons". So by simply removing the map id check from the code, it will run for all wild encounters. Your code should then look like so -

Code:
Events.onWildPokemonCreate+=proc {|sender,e|
   pokemon=e[0]
     newlevel=pbBalancedLevel($Trainer.party) - 4 + rand(5)   # For variety
     newlevel=1 if newlevel<1
     newlevel=PBExperience::MAXLEVEL if newlevel>PBExperience::MAXLEVEL
     pokemon.level=newlevel
     pokemon.calcStats
     pokemon.resetMoves
}

As you can see from the code, the function "pbBalancedLevel" is what's doing the work here as well as in the trainer battle example posted earlier. From a quick once over, it seems to work by finding the average level of your whole party. But once you figure out how you want your badge formula to work, you can define your own version such as a "pbBadgeLevel", and just plug that in its place.
 
Last edited:
13
Posts
5
Years
  • Age 25
  • Seen Oct 12, 2019
Hello im trying to add gym scaling in my game. Basically having it so trainers and gym leaders have there teams change depending on the amount of gym badges the player has. I have little experience in coding and need help or atleast a start to adding this feature. I any of you know how thanks in advanced!
 
13
Posts
5
Years
  • Age 25
  • Seen Oct 12, 2019
Thank you so much i'm such a noob at coding its hilarious. I will give you credit! Have a great day!
 
13
Posts
5
Years
  • Age 25
  • Seen Oct 12, 2019
Ok one more question. Can I make it so they have different teams depending on the amount of gym badges? Like if I challenge Brock and I have one badge he'll use geodude and onix. But if I challenge him with 4 badges he'll have gravaler, rhyhorn, and onix or Would I have to make a new script for that?
 
172
Posts
7
Years
  • Age 31
  • Seen Sep 6, 2022
Ok one more question. Can I make it so they have different teams depending on the amount of gym badges? Like if I challenge Brock and I have one badge he'll use geodude and onix. But if I challenge him with 4 badges he'll have gravaler, rhyhorn, and onix or Would I have to make a new script for that?

It's actually super simple. You don't need to code anything just use conditional branches within the gym leader event. For each gym leader the player beats a switch should be turned on. For example a switch called "beat gym one" or "beat first gym" these are already in the list of essentials switches. Then you just do a conditional branch check for each badge. So conditional branch—->if switch beat gym one=ON
Then use X-Team if switch beat gym two=ON then use Y-Team and so on.
 
172
Posts
7
Years
  • Age 31
  • Seen Sep 6, 2022
Awesome thank you guys so much! Would this work for trainers?

Yup! Keep in mind you'll have to make a trainer for every scenario. Meaning you'll have to make the same trainer 8 times essentially but with a more powerful team each time. But you'll be applying the checks in the same exact way as the trainers. Same goes for the gym leaders you'll be making 8 versions of each to cover the different points in your game depending on what order the player does the gyms in.
 
13
Posts
5
Years
  • Age 25
  • Seen Oct 12, 2019
So if the player can challenge any gym in any order do i have to change the badges or their variables in anyway?
 
172
Posts
7
Years
  • Age 31
  • Seen Sep 6, 2022
So if the player can challenge any gym in any order do i have to change the badges or their variables in anyway?

not exactly, but it depends on what you want to happen. Because you can have it set up where the badge you receive correlates with the switch youre checking at the start of the gym leader event. for example if you meet the condition of "beat fourth gym=ON" then within that conditional branch, youll turn on the switch "beat fifth gym" after the player wins. the only problem with that is I believe the gym badge icons may relate directly to the switch that's on? I may be wrong, you can test it out. but if that's the case and you were using something like the gen 1 gym leaders, then technically what could happen is you can battle misty as your fifth gym leader, but by then end the fifth gym beat switch will go on and youll receive the soul badge from koga. so the order of things may be a bit weird.


Now if you use a variable that may work better actually, because the gym leaders teams will be chosen by whatever count the variable is on, but at the end you can choose which switch gets turned on. so misty could be the fifth gym leader, and when you go to battle her, the variable counter will be on 4 by then, so itll use her team that's the fourth strongest, then at the end of the battle if you win, turn on the "beat second gym" switch, which will give you the right badge. then add +1 to your variable counter.
 
Last edited:
13
Posts
5
Years
  • Age 25
  • Seen Oct 12, 2019
I was going to make so you don't see badges on your trainer card. Instead you receive them as key items for special side quests and events. That way the badges are in the order you got them and I won't have to worry about the trainer card.
 
172
Posts
7
Years
  • Age 31
  • Seen Sep 6, 2022
I was going to make so you don't see badges on your trainer card. Instead you receive them as key items for special side quests and events. That way the badges are in the order you got them and I won't have to worry about the trainer card.
honestly you shouldn't not do something just so you dont have to "worry about it". I mean you can edit the badge assignments to their proper switches anyways, and if youre trying to add them as key items to use them as checks for things later, then the gym badge switches already do that without you having to make an item for it. Also if its open world where you can get the badges in any order I would expect them to be out of order regardless. because each gym leader would have their own badge. It would also make sense if youre using old gym leaders like kanto or something that people know what badge belongs to who. so if you fought blaine people would expect his badge to be 7th and be the volcano badge. But at the same time I could see if you want people to have the badges in the order they got them. but either way that just comes down to changing the assigning of the icons to their switches.
 
Last edited:
178
Posts
10
Years
It's easier to make it with one variable instead of switches, because with a variable, you only have to keep track of how many badges the player has, while with switches you have to keep track of WHAT badges the player have at hand.
Defeat a gym and add 1 to a variable, no matter what gym. And than you make the gym team accordingly do your variable. With this, you don't even need to hide the trainer card.

I also agree to NewAgeSteel, it's much easier for keep progress from the trainer card. It's at least 1 less click the player has to use to access the badges (considering that the last thing they did in the bag was checking the badges). And you can also make key items along side to it, no need for a complete scrap them from the trainer card. Considering that they are our regular badges.
 
13
Posts
5
Years
  • Age 25
  • Seen Oct 12, 2019
Ok I'll try this code and the keeping the badges on the trainer card thing. Thanks!
 
Back
Top