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

tasmania12

Mewtwo Master
57
Posts
16
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:
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    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.
     

    tasmania12

    Mewtwo Master
    57
    Posts
    16
    Years
  • 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:
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    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).
     

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • 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:
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    Maybe we just need this:
    Spoiler:

    Looks pretty close, although I think it's slightly buggy in one situation. An exercise for tasmania12 perhaps :)
     

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • Looks pretty close, although I think it's slightly buggy in one situation. An exercise for tasmania12 perhaps :)

    Well, I tested with male Decidueye and shiny Ditto and works fine. Then, male Decidueye and female Oricorio and hatched a normal Oricorio.
     

    tasmania12

    Mewtwo Master
    57
    Posts
    16
    Years
  • 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:

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • Simplify:
    Code:
      if (isConst?(father.species,PBSpecies,:DITTO) && father.isShiny?) ||
         (isConst?(mother.species,PBSpecies,:DITTO) && mother.isShiny?)
        egg.makeShiny 
      end
     
    Back
    Top