• 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!
  • It's time to vote for your favorite Pokémon Battle Revolution protagonist in our new weekly protagonist poll! Click here to cast your vote and let us know which PBR protagonist you like most.
  • 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] [SOLVED] Multiple forms not unmega evolving at all (version 17.2)

  • 100
    Posts
    5
    Years
    Hey all, I'm at a bit of a loss. I have a Pokemon with 4 default forms (randomized), and depending on the form, I want it to mega evolve into its respective form.

    I've used Rot8er_ConeX 's Castform as an example (thread: https://www.pokecommunity.com/threads/352261) as well as a similar thread with condensed code (https://www.pokecommunity.com/threads/375737), but no matter what I try, my Pokemon is always mega evolving into Form 4 (aka the first mega form).

    Here's my current code, written under the Pokemon_Forms script:
    Code:
    MultipleForms.register(:SABLEYE,{
    "getMegaForm"=>proc{|pokemon|
       next 4 if isConst?(pokemon.item,PBItems,:SABLENITE) && pokemon.form==0
       next 5 if isConst?(pokemon.item,PBItems,:SABLENITE) && pokemon.form==1
       next 6 if isConst?(pokemon.item,PBItems,:SABLENITE) && pokemon.form==2
       next 7 if isConst?(pokemon.item,PBItems,:SABLENITE) && pokemon.form==3
       next
    },
    
    "getUnmegaForm"=>proc{|pokemon|
       next 0 if pokemon.form==4
       next 1 if pokemon.form==5
       next 2 if pokemon.form==6
       next 3 if pokemon.form==7
    }
    })

    And my pokemonforms.txt PBS file:
    Code:
    [SABLEYE-1]
    FormName=Mafic
    #-------------------------------
    [SABLEYE-2]
    FormName=Bismuth
    #-------------------------------
    [SABLEYE-3]
    FormName=Amethyst
    #-------------------------------
    [SABLEYE-4]
    FormName=Mega Sableye (Felsic)
    MegaStone=SABLENITE
    BaseStats=50,85,125,85,115,20
    Abilities=MAGICBOUNCE
    #-------------------------------
    [SABLEYE-5]
    FormName=Mega Sableye (Mafic)
    MegaStone=SABLENITE
    BaseStats=50,85,125,85,115,20
    Abilities=MAGICBOUNCE
    #-------------------------------
    [SABLEYE-6]
    FormName=Mega Sableye (Bismuth)
    MegaStone=SABLENITE
    BaseStats=50,85,125,85,115,20
    Abilities=MAGICBOUNCE
    #-------------------------------
    [SABLEYE-7]
    FormName=Mega Sableye (Amethyst)
    MegaStone=SABLENITE
    BaseStats=50,85,125,85,115,20
    Abilities=MAGICBOUNCE

    I have regular Sableye set up as "Felsic" to correspond with its mega.

    Not entirely sure where it's going wrong? As I said, every time I mega evolve any of the base forms, they all mega evolve into Mega Sableye (Felsic).
     
    Last edited:
    I guess every time I checked that thread, I forgot about the part where I had to define the Unmega. Added that info into the pokemonforms.txt and it works perfectly now. Thanks so much ^^
     
    Actually, after testing some more, I still have some problems. The pokemon correctly mega evolves in battle, but after battle...it doesn't revert form. Ever. I've tried wild battles and trainer battles. It consistently stays as its mega.

    This is my entire Mega_Evolution script:
    Spoiler:

    It looks like the original poster on that other thread had the same problem but fixed it by "making a few changes to the original MegaEvolution script." Sadly they do not post these changes.
     
    You're in luck, I was asked to fix this up! (Well, not directly, but I did fix it)
    Code:
      def getMegaForm(itemonly=false)
        formdata = pbLoadFormsData
        return 0 if !formdata[@species] || formdata[@species].length==0
        ret = 0
        dexdata = pbOpenDexData
        for i in formdata[@species]
          next if !i || i<=0
          pbDexDataOffset(dexdata,i,29)
          megastone = dexdata.fgetw
          if megastone>0 && self.hasItem?(megastone)
            pbDexDataOffset(dexdata,i,37)
            unmegaform = dexdata.fgetb
            if @form == unmegaform || @form==pbGetSpeciesFromFSpecies(i)[1]
              ret = i; break
            end
          end
          if !itemonly
            pbDexDataOffset(dexdata,i,56)
            megamove = dexdata.fgetw
            if megamove>0 && self.hasMove?(megamove)
              ret = i; break
            end
          end
        end
        dexdata.close
        return ret  # fSpecies or 0
      end
    See the issue is it uses this method to detect if the current form is a mega, but once it is a mega, it no longer matches the unmega form, so the game thinks its not a mega. In the vanilla battle scripts, you can see how the mega icon doesn't appear either.

    Tested it a bit, seems to work right, and unmega to the correct form!
     
    I don't know how to thank you enough! Thank you so much for the fix. It works perfectly, as you said. I am so so so grateful, thank you <3
     
    Back
    Top