• 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] Giving Shiny pokemon special EV/IV caps

ChaoticWoofles

Working on Pokemon Disruption!
3
Posts
1
Years
    • Seen Sep 20, 2023
    Hello, this is my first time posting here, so if I make any mistakes, let me know!

    As the title suggests, I was wondering how to make it so that Shiny Pokemon can have a special cap on EVs. For instance, a normal pokemon can only have 510 points, while a shiny pokemon can have 1,512. I looked around the forums already, but couldn't find anything that fits my needs. Or maybe I just missed it, I don't know.

    I've only been using Essentials for a month and I'm still learning everything. Should I make a special script section for Shinies, or do I have to edit an already existing script? Thanks in advance!
     
    188
    Posts
    9
    Years
    • Seen Jan 21, 2024
    This one is quite easy. In Pokemon (under [[ Pokemon ]]) look for this code:
    Code:
      # Max total EVs
      EV_LIMIT      = 510

    Change it to this:
    Code:
      EV_LIMIT      = @shiny ? 1512 : 510

    The code var = a ? b : c is a conditional assignment that sets var to b if a is true, otherwise sets var to c instead.
     
    1
    Posts
    1
    Years
    • Seen Nov 6, 2023
    and for maximum level how do I put this condition?
    that way doesn't work
    MAXIMUM_LEVEL = @shiny ? 150: 100
     
    188
    Posts
    9
    Years
    • Seen Jan 21, 2024
    Not quite. My initial code had a bug. What I would suggest is in the Pokemon script as follows:
    Code:
      # @return [Boolean] whether this Pokémon is shiny (differently colored)
      def shiny?
        if @shiny.nil?
          a = @personalID ^ @owner.id
          b = a & 0xFFFF
          c = (a >> 16) & 0xFFFF
          d = b ^ c
          @shiny = d < Settings::SHINY_POKEMON_CHANCE
          # new code
          Settings::MAXIMUM_LEVEL = @shiny ? 150 : 100
          Pokemon::EV_LIMIT = @shiny ? 1512 : 510
        end
        return @shiny
      end
     
    Back
    Top