• 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.

How to change egg group based on form?

277
Posts
15
Years
  • I have been trying to change the egg group of a pokemon form to Undiscovered so that certain forms can't breed (Much like Ash-Greninja, Hat Pikachu, and Cosplay Pikachu in the main games.) Here is what I have tried so far with results.

    Pokemon maintained their original egg group.
    Code:
    "getCompatibility"=>proc{|pokemon|
       next if pokemon.form==0                                   
       next pokemon.compatibility==Undiscovered          # Can Not Breed
    }

    Syntax Error.
    Code:
    "getCompatibility"=>proc{|pokemon|
       next if pokemon.form==0                                
       when 1; next Compatibility=[Undiscovered]          # Can Not Breed
    }

    Pokemon maintained their original egg group.
    Code:
    "getCompatibility"=>proc{|pokemon|
       next if pokemon.form==0    
       next [Undiscovered]               # Can Not Breed
    }

    Pokemon maintained their original egg group.
    Code:
    "getCompatibility"=>proc{|pokemon|
       next if pokemon.form==0                                         
       next pokemon.Compatibiliity==Undiscovered          # Can Not Breed
    }
     
    971
    Posts
    7
    Years
    • Age 21
    • Seen Nov 28, 2022
    I have been trying to change the egg group of a pokemon form to Undiscovered so that certain forms can't breed (Much like Ash-Greninja, Hat Pikachu, and Cosplay Pikachu in the main games.) Here is what I have tried so far with results.

    Pokemon maintained their original egg group.
    Code:
    "getCompatibility"=>proc{|pokemon|
       next if pokemon.form==0                                   
       next pokemon.compatibility==Undiscovered          # Can Not Breed
    }

    Syntax Error.
    Code:
    "getCompatibility"=>proc{|pokemon|
       next if pokemon.form==0                                
       when 1; next Compatibility=[Undiscovered]          # Can Not Breed
    }

    Pokemon maintained their original egg group.
    Code:
    "getCompatibility"=>proc{|pokemon|
       next if pokemon.form==0    
       next [Undiscovered]               # Can Not Breed
    }

    Pokemon maintained their original egg group.
    Code:
    "getCompatibility"=>proc{|pokemon|
       next if pokemon.form==0                                         
       next pokemon.Compatibiliity==Undiscovered          # Can Not Breed
    }

    First of all, "getCompatibility" isn't a thing. You'll have to implement that yourself to make that work (which I'm not too sure about myself).
    Second, when you're setting a variable, you have to use one '='. '==' is only used for checking if something is equal.
    Third thing is that there's no variable so as "Compatibility" without any class before it. Also, accessors/fields/methods in Essentials are pretty much always camelcase (e.g. "drawTextEx"). This means capitals separate the words, with the first one lowercase.
    Fourth, Undiscovered itself isn't a thing either. I'm pretty sure the compatibility field consists of numbers (as most fields do!). You can find the IDs of each egg group in "PBEggGroups", "module PBEggGroups".
    Fifth, the keyword "when" can only be used together with "case" (and "end" at the end). It's basically a shortcut for when (pun not intended) you want to check one variable for various things.
    Last, you've typo'd "Compatibility" in the last one ;)

    Oh, and please don't get discouraged by this message somehow ;)
     
    277
    Posts
    15
    Years
  • Thank you for the quick reply and the tip about compatibility fields being numbers.

    While looking in the Multiple_Forms part of Essentials I saw that "BaseStats" was spelled the same with capitals just like in pokemon.txt so I though I could do the same for Compatibility, apparently this isn't the case. I guess I will go to the wikia to see if I can find a way to accomplish this. At least now I know I wasn't just over looking something simple... I was over looking almost everything XD
     
    1,682
    Posts
    8
    Years
    • Seen today
    Yo! I've been waiting all day to get to my computer to answer you.
    First, we need to make getting the compatibility a method. Then we override it to do the call for the multiple forms
    Code:
      def compatibility1
        dexdata=pbOpenDexData
        pbDexDataOffset(dexdata,@species,31)
        ret=dexdata.fgetb
        dexdata.close
        return ret
      end
      
      def compatibility2
        dexdata=pbOpenDexData
        pbDexDataOffset(dexdata,@species,31)
        ret=dexdata.fgetb
        ret=dexdata.fgetb
        dexdata.close
        return ret
      end
      
      alias __mf_compatibility1 compatibility1
      alias __mf_compatibility2 compatibility2
      
      def compatibility1
        v=MultipleForms.call("compatibility1",self)
        return v if v!=nil
        return self.__mf_compatibility1
      end
      
      def compatibility2
        v=MultipleForms.call("compatibility2",self)
        return v if v!=nil
        return self.__mf_compatibility2
      end

    Use it by setting a "compatibility(num)" field in multiple forms.
    Code:
    "compatibility1"=>proc{|pokemon|
       next if pokemon.form==0 
       next PBEggGroups::Undiscovered          # Can Not Breed
    }

    One last thing though, we need to edit the daycare!
    Go to def pbDayCareGetCompat and change these lines
    Code:
        dexdata=pbOpenDexData
        pbDexDataOffset(dexdata,pokemon1.species,31)
        compat10=dexdata.fgetb
        compat11=dexdata.fgetb
        pbDexDataOffset(dexdata,pokemon2.species,31)
        compat20=dexdata.fgetb
        compat21=dexdata.fgetb
        dexdata.close
    To this:
    Code:
        compat10=pokemon1.compatibility1
        compat11=pokemon1.compatibility2
        compat20=pokemon2.compatibility1
        compat21=pokemon2.compatibility2

    Here's my code for a Spinda. Only one of the types has to be Undiscovered to prevent breeding.
    Code:
    MultipleForms.register(:SPINDA,{
    "alterBitmap"=>proc{|pokemon,bitmap|
       pbSpindaSpots(pokemon,bitmap)
    },
    "compatibility1"=>proc{|pokemon|
       next if pokemon.form==0 
       next PBEggGroups::Undiscovered          # Can Not Breed
    }
    })

    All tested!

    I should make a tutorial for this, seems useful.
     
    277
    Posts
    15
    Years
  • This is great, Thank you so much Vendily!

    After trying to understand how breeding works by reading through PBEggGroups and PBField_DayCare, I came to the conclusion that I needed to learn Ruby before I could make this work.
     
    Back
    Top