Advertiser Content

tasmania12

Mewtwo Master

Age 24
Male
Pallet Town
Seen 4 Days Ago
Posted July 30th, 2019
55 posts
11.7 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:
if (ditto0 && !ditto1)
    if ditto0.isShiny?
        egg.makeShiny
    end
end


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:
if mother.isShiny? &&
   isConst?(mother.species,PBSpecies,:DITTO)
   egg.makeShiny
 end
 
 if father.isShiny? &&
   isConst?(father.species,PBSpecies,:DITTO)
   egg.makeShiny
 end

-Groudon-Rayquaza-
Reuniclus-Ho-oh-

tasmania12

Mewtwo Master

Age 24
Male
Pallet Town
Seen 4 Days Ago
Posted July 30th, 2019
55 posts
11.7 Years
Well... i decided to attempt a different try

ditto=hasConst?(PBSpecies,:Ditto)
if (ditto && !ditto) || (!ditto && ditto)
   if ditto.isShiny?
       egg.makeShiny
  end
end
And
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.

-Groudon-Rayquaza-
Reuniclus-Ho-oh-

mgriffin

Online now
Posted 1 Day Ago
709 posts
5.5 Years
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

Discord: Wolf#1235

Male
Brazil
Seen 2 Hours Ago
Posted 18 Hours Ago
813 posts
1.2 Years
Maybe we just need this:
  # 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
  if ditto0 || ditto1
    egg.makeShiny if mother.isShiny? || father.isShiny?
  end    
  # Inheriting ability from the mother

mgriffin

Online now
Posted 1 Day Ago
709 posts
5.5 Years
Maybe we just need this:
Spoiler:

  # 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
  if ditto0 || ditto1
    egg.makeShiny if mother.isShiny? || father.isShiny?
  end    
  # Inheriting ability from the mother
Looks pretty close, although I think it's slightly buggy in one situation. An exercise for tasmania12 perhaps :)

WolfPP

Discord: Wolf#1235

Male
Brazil
Seen 2 Hours Ago
Posted 18 Hours Ago
813 posts
1.2 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.
Advertiser Content