• 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] Help With Breeding Shiny Ditto

tasmania12

Mewtwo Master
  • 51
    Posts
    17
    Years
    Hello, I'm trying to make it so that when you breed a pokemon with shiny ditto the egg is always shiny.

    In the daycare script i have
    Spoiler:

    When i collect the egg i get an error message about the .isShiny? Part. How would i accomplish this without an error?

    The error is "undefined method 'isShiny?' For true:TrueClass"


    Edit:
    It works perfect with this inserted in the DayCare script:

    Spoiler:
     
    Last edited:
    That error message suggests that ditto0 is a boolean (i.e. true or false), not a Pokémon object. Maybe you can work backwards to find out how ditto0 gets assigned, because that presumably involves comparing the Pokémon's species to :DITTO.
     
    Well... i decided to attempt a different try

    Code:
    ditto=hasConst?(PBSpecies,:Ditto)
    if (ditto && !ditto) || (!ditto && ditto)
       if ditto.isShiny?
           egg.makeShiny
      end
    end
    And
    Code:
    ditto=PBSpecies,:Ditto
    if (ditto && !ditto) || (!ditto && ditto)
       if ditto.isShiny?
           egg.makeShiny
      end
    end

    This time no error, but the baby wasn't shiny.

    I thought if i'd directly say ditto is a Ditto it should work.
     
    Last edited:
    I don't think you quite understand how Ruby and Essentials work.

    ditto=hasConst?(PBSpecies,:Ditto) is always false because Essentials would spell it :DITTO. But also that's not going to help, because you really want to be checking if a particular Pokémon is a Ditto, not if Ditto exists in the game.

    ditto=PBSpecies,:Ditto is pretty much meaningless.

    Also (ditto && !ditto) is simply true (because of the law of excluded middle), and obviously equivalent to (!ditto && ditto).

    I'll repeat my earlier suggestion of finding out how ditto0 was assigned to (i.e. looking for "ditto0 = ...") and trying to work out what the name of the first (father? mother?) Pokémon variable is inside the daycare code. Fundamentally you're going to have to reference an existing variable that contains a Pokémon object because the code you've posted simply doesn't contain the information you need (i.e. none of ditto0, ditto1, or egg have a reference to the parents).
     
    Maybe we just need this:
    Code:
      # Masuda method and Shiny Charm
      shinyretries=0
      shinyretries+=5 if father.language!=mother.language
      shinyretries+=2 if hasConst?(PBItems,:SHINYCHARM) && $PokemonBag.pbHasItem?(:SHINYCHARM)
      if shinyretries>0
        for i in 0...shinyretries
          break if egg.isShiny?
          egg.personalID=rand(65536)|(rand(65536)<<16)
        end
      end
    [B][I][U]  if ditto0 || ditto1
        egg.makeShiny if mother.isShiny? || father.isShiny?
      end  [/U][/I][/B]  
      # Inheriting ability from the mother
     
    Last edited:
    Maybe we just need this:
    Spoiler:

    Looks pretty close, although I think it's slightly buggy in one situation. An exercise for tasmania12 perhaps :)
     
    I got it working with this after coming home from work:
    Code:
    if mother.isShiny? &&
       isConst?(mother.species,PBSpecies,:DITTO)
       egg.makeShiny
     end
     
     if father.isShiny? &&
       isConst?(father.species,PBSpecies,:DITTO)
       egg.makeShiny
     end
     
    Last edited:
    Back
    Top