• 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!
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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.

[Scripting Question] Dynamax Level

  • 35
    Posts
    7
    Years
    Well, I'm trying to create a variable that memorizes the Dynamax level of a Pokémon. But I don't quite understand how values are stored between these attributes.
    I tried to add some conditions in PokeBattle_Pokemon, but it didn't work. Could someone help or explain how I can create this? It may be similar to Level, but must be set by an individual variable to Pokémon.
    Hera an example:
    [PokeCommunity.com] Dynamax Level
     
    Last edited:
    In PokeBattle_Pokemon you need to add a variable in the PokeBattle_Pokemon class at the very top. In this case you need to make a new attr_accessor, which would be attr_accessor(:dynamax). This can be added somewhere around line 4-53 if you so choose in PokeBattle_Pokemon. ((You don't have to call it just dynamax you could call it dynamaxlv for readability))

    If you're really stuck:
    Spoiler:


    Then you will need to make a method to be able to access that attribute which would be.

    Code:
      def dynamax_level #You can rename this line to whatever you like I just called it this for readability
        @dynamax=0 if !@dynamax
        @dynamax=10 if @dynamax < 10
        return @dynamax
      end

    Basically what this does is initializes the dynamax variable as zero when the game generates a new pokemon, and lets you call the dynamax level which can be changed. With something like @dynamax=7 assuming you'll use Dynamax Candies, it would be a simple line of @dynamax+=1

    The line @dynamax=10 if @dynamax < 10 makes it so you can't make the level go past 10 which you can change as you see fit.
    Add this method before def baseStats.

    Then in def initialize(species,level,player=nil,withMoves=true) add @dynamax=0 after @iv[5]=rand(32)
     
    Last edited:
    In PokeBattle_Pokemon you need to add a variable in the PokeBattle_Pokemon class at the very top. In this case you need to make a new attr_accessor, which would be attr_accessor(:dynamax). This can be added somewhere around line 4-53 if you so choose in PokeBattle_Pokemon. ((You don't have to call it just dynamax you could call it dynamaxlv for readability))

    If you're really stuck:
    Spoiler:


    Then you will need to make a method to be able to access that attribute which would be.

    Code:
      def dynamax_level #You can rename this line to whatever you like I just called it this for readability
        @dynamax=0 if !@dynamax
        @dynamax=10 if @dynamax < 10
        return @dynamax
      end

    Basically what this does is initializes the dynamax variable as zero when the game generates a new pokemon, and lets you call the dynamax level which can be changed. With something like @dynamax=7 assuming you'll use Dynamax Candies, it would be a simple line of @dynamax+=1

    The line @dynamax=10 if @dynamax < 10 makes it so you can't make the level go past 10 which you can change as you see fit.
    Add this method before def baseStats.

    Then in def initialize(species,level,player=nil,withMoves=true) add @dynamax=0 after @iv[5]=rand(32)

    Well, sure your help made me see much more clearly, I also got help from other people in Discord and I was able to create this variable using methods similar to what you described, in any case thank you very much for helping.
     
    Back
    Top