Game Development Your number one stop for anything related to creating games (except ROM hacks). You can even make your own!

Ad Content
Reply
 
Thread Tools
  #1   Link to this post, but load the entire thread.  
Old 2 Weeks Ago (4:36 PM).
LoneGamer's Avatar
LoneGamer LoneGamer is offline
     
    Join Date: Nov 2018
    Gender: Male
    Posts: 5
    Is there any way to have wild Pokémon, Trainers, and Gym Leaders scale with gym badges for like a open world type game?
    __________________
    Reply With Quote
      #2   Link to this post, but load the entire thread.  
    Old 2 Weeks Ago (1:44 PM). Edited 2 Weeks Ago by BadSamaritan.
    BadSamaritan BadSamaritan is offline
    Gone Fishin'
       
      Join Date: May 2009
      Gender: Male
      Nature: Rash
      Posts: 146
      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.
      __________________

      Demo coming August 20!
      Reply With Quote
      Reply

      Quick Reply

      Join the conversation!

      Create an account to post a reply in this thread, participate in other discussions, and more!

      Create a PokéCommunity Account
      Ad Content
      Thread Tools

      Posting Rules
      You may not post new threads
      You may not post replies
      You may not post attachments
      You may not edit your posts

      BB code is On
      Smilies are On
      [IMG] code is On
      HTML code is Off

      Forum Jump


      All times are GMT -8. The time now is 11:03 PM.