• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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.

[Question] Level scaling and maps

  • 73
    Posts
    4
    Years
    • Seen Apr 20, 2025
    My game has been stuck in the preparation phase for a few months now with me adding script and graphics. The release of EBDX didn't help as that convinced me to upgrade my game to V18.1, meaning I had to replace most scripts. There is still one hurdle I want to pass before I truly begin with mapping and events: badge scaling. I have implemented it in PField_EncounterModifiers, but it is for the entire game unless I use if statements and that would become a mess with clusters.
    I would like to divide my map ids in four arrays so I can have four different sections with scaling. There is one where the levels won't change no matter how many badges you have such as the start, end and a middle interlude. The next array would cover the maps between badges 2-4 where the levels won't go higher than 30. Next up we have badges 5-10 where the levels are between 30 and 50 and finally the post game which is open world.
    I figure it would be the best way to loop the arrays and see which scaling apply to which maps. What would be the best way to approach this before it gets too convoluted?
     
    Last edited:
    I think based on your ability, the best thing to do would be to indeed put a bunch of map ids in three arrays.

    So, I will write some mock code as an example of what to do. This does not have to be exact, obviously but it is pretty close

    So, in a custom page, write:
    Code:
    def pbApplyLevelScaling(level)
      no_scaling = [1,2,3,4,5,6,7] #As an example
      thirty_scaling = [8,9,10,11,12]
      fifty_scaling = [13,14,15,16]
      mapid = $game_map.map_id
      return level if no_scaling.include?(mapid)
      # HERE PUT YOUR FORMULA THAT CALCULATES THE LEVEL SCALING
      # I presume this would involve $Trainer.badges or whatever its called
      # level = FORMULA. Make sure variable is named level
      return [30,level].max if thirty_scaling.include?(mapid)
      return [30,[level,50].max].min if fifty_scaling.include?(mapid)
      return level # Open World. Don't forget to put a check for max level as well, but this probably sorts itself out afterwards anyway
    end

    There is no need for any loops.
    Then you would go ahead and put pbApplyLevelScaling(level), with level being the original level that the mons were going to be.

    Hope this helped!
    Swdfm
     
    Last edited:
    Thank you for the quick reply as I had something like that in mind, but I had trouble transforming it into code. I planned to use $Trainer.badges to define the levels depending on gym order in each section. Sorry about the roundabout way of explaining this, but I wanted to make a semi open world game that would work with Pokémon. I even changed the badges in the trainer card and Marin's fancy badges script based on the order you get them.

    Edit: I have tested it, but so far I have gotten no differences in level. Is this where I should put place pbApplyLevelScaling(level) in PField_EncounterModifiers?

    Events.onTrainerPartyLoad += proc { |_sender, e|
    if e[0] # Trainer data should exist to be loaded, but may not exist somehow
    trainer = e[0][0] # A PokeBattle_Trainer object of the loaded trainer
    items = e[0][1] # An array of the trainer's items they can use
    party = e[0][2] # An array of the trainer's Pokémon
    party.each{|poke|
    pbApplyLevelScaling(poke.level)
    poke.calcStats
    }
    end
    }
     
    Last edited:
    This will change what level Pokemon appear in the wild based on how many badges you have.
    You will need to set the levels that appear per badge, and I only have the first 5 gen's worth of Pokemon added so it's not just a simple plug-in and run some edits are required. Assuming you are using PE v19, I am currently working on a v18 version but it won't be ready for a few weeks.

    Edit: I forgot to mention the wild Pokemon are auto evolving as well. If you have a wild Magikarp under level 20 it will just be a Magikarp, but after X amount of badges and the Wild Pokemon start spawning at level 20 or higher Magikarp will have a chance to spawn in as a Gyarados. This applies to all Pokemon, however Pokemon that don't have a level up evolution are set to make an evolution attempt at level 0. Again more adjusting you need to do but should work just find.
     

    Attachments

    • WildPokemonLevelScaling.zip
      7 KB · Views: 3
    Last edited:
    Is this a script you developed for your own project? This looks really impressive, but I wasn't really looking to include wild Pokémon. I will mess around with it for a bit to see which results it will give me. I'm using V18.1 since EBDX released and I have no plans to upgrade it further to V19.
     
    Last edited:
    Well my v18 version will be a while before it is done, and that just modifies wild Pokemon. Are you looking for something that modifies trainers then?
     
    Well my v18 version will be a while before it is done, and that just modifies wild Pokemon. Are you looking for something that modifies trainers then?

    Yes, I rather want trainers to scale instead of wild Pokémon. If the latter scales too, it will be too easy to catch up with the level curve. My system is based on the number of gym badges and a static number that goes up with every one you get. It's not like that the trainers scale up to the strongest Pokémon in the player's party which I do not want.
    My region is divided in two main islands that each has a lower and upper level limit and smaller surrounding islands that will be explored unrestricted in the post game. I'll play a bit with the script that Swdfm provided and see what the best way is to divide the scaling.
     
    To be clear, my level scaling script is based off of badges not the level of the players Pokemon and you can easily adjust the encounter levels. IE if you're pokemon are at level 50 and you have 6 badges then you can still have the wild Pokemon range from level 18 - 22 if you wanted to keep things low.

    That aside, for trainer scaling it's best to have all the variations of a trainer battle defined in trainers.txt and just use a script to auto select which variation of the trainer should be called. If this is what you're wanting I can make it for you when I get home.
     
    That aside, for trainer scaling it's best to have all the variations of a trainer battle defined in trainers.txt and just use a script to auto select which variation of the trainer should be called. If this is what you're wanting I can make it for you when I get home.
    I fear that if I define all the different trainer variations, the trainers.txt file will explode in size which I wanted to avoid. You don't have to go out of your way for me and I'll try to figure this out by myself at first.
     
    Considering the Pokemon PBS file for the generation 8 project that lists almost 900 Pokemon is only about 1MB, you shouldn't worry about the size of the trainer.txt becoming too large. On top of that simply Copying and pasting a trainer a few times then modifying what pokemon and items the trainer has isn't a hard task. But the true beauty of using this method comes from how simple it is to call the trainer you need.

    Let's say you have Brock defined 9 times. Once when you have 0 badges, and once for every badge (assuming your game will have 8 badges). All you need is this script to auto detect which brock the player needs to battle.
    Code:
    pbTrainerBattle(:LEADER_Brock,"Brock",nil,nil,$Trainer.numbadges)

    You can look for an alternative method if you wish, but I think this would give the best results.
     
    It didn't take long to make a script based on the info I have been given placed in PField_EncounterModifiers. As promised, here is the code that I came up with and the map ids are examples.

    Code:
    Events.onTrainerPartyLoad += proc { |_sender, e|
      if e[0] # Trainer data should exist to be loaded, but may not exist somehow
        trainer = e[0][0] # A PokeBattle_Trainer object of the loaded trainer
        items = e[0][1]   # An array of the trainer's items they can use
        party = e[0][2]   # An array of the trainer's Pokémon
        firstisland_scaling = [1,2,3]
        secondisland_scaling = [4,5,6]
        postgame_scaling = [7,8,9,10]
        mapid = $game_map.map_id
        party.each{|poke|
          if firstisland_scaling.include?(mapid)
            poke.level += 4 if $Trainer.numbadges == 2
            poke.level += 8 if $Trainer.numbadges == 3
            poke.level += 12 if $Trainer.numbadges >= 4
          else
            if secondisland_scaling.include?(mapid)
              poke.level += 3 if $Trainer.numbadges == 5
              poke.level += 6 if $Trainer.numbadges == 6
              poke.level += 9 if $Trainer.numbadges == 7
              poke.level += 12 if $Trainer.numbadges == 8
              poke.level += 15 if $Trainer.numbadges == 9
              poke.level += 18 if $Trainer.numbadges == 10
            else
              if postgame_scaling.include?(mapid)
                #I won't spoil my post game here. 
              end
            end
          end
          poke.calcStats
        } 
      end
    }

    I place the map ids in arrays which I use the include function for to compare the current map id to. Then I go through all the badges I can get in those sections and increase it by a static number. When I get more badges, the level never gets higher than when I get the last badge on the section with >=. When all the arrays have been checked and the map id wasn't found, there will be no scaling applied like in the start and ending.
     
    Last edited:
    Back
    Top