• 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!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll 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.

[Scripting Question] Giving Shiny pokemon special EV/IV caps

ChaoticWoofles

Working on Pokemon Disruption!
  • 3
    Posts
    2
    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!
     
    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.
     
    and for maximum level how do I put this condition?
    that way doesn't work
    MAXIMUM_LEVEL = @shiny ? 150: 100
     
    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