• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • 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:
    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