• 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.

[Scripting Question] Dynamax Level

37
Posts
6
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:
    Dynamax Level
     
    Last edited:

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • Maybe you can check how Shadow Pokémon (Heart Gauge etc) works.
     

    Sir_Tman

    Overworked game Dev
    201
    Posts
    8
    Years
  • 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:
    37
    Posts
    6
    Years
  • 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