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

[Essentials Tutorial] Mega Evolutions for Pokémon with multiple forms

My game has some quite gimmicky Megas, and I thought I'd show others how I pulled them off so that they too could do something similar.

Code:
MultipleForms.register(:CASTFORM,{
"getMegaForm"=>proc{|pokemon|
   next if pokemon.form==0
   next 5 if isConst?(pokemon.item,PBItems,:CASTFORMITE) && pokemon.form%4==1
   next 6 if isConst?(pokemon.item,PBItems,:CASTFORMITE) && pokemon.form%4==2
   next 7 if isConst?(pokemon.item,PBItems,:CASTFORMITE) && pokemon.form%4==3
   next 8 if isConst?(pokemon.item,PBItems,:CASTFORMITE) && pokemon.form%4==0
   next
},
}

First off, we have Mega Castform. As most Pokemon players know, Castform changes form based on the weather - which makes sense since it's the Pokemon equivalent of a weather balloon.

My Mega Castform is interesting because it becomes a different Mega depending on what form it's in when the player triggers Mega Evolution.

You might be tempted to go "Okay, I think I know how to do this. Just write a subroutine that goes 'If pokemon.form==1, return 5. If pokemon.form==2, return 6. Etc, etc."

That's the way I had it before. But it turns out that the getMegaForm subroutine is also used to determine if the Pokemon is a Mega. Thus, because the Mega is determined by the base form, the game wouldn't think that Castform was Mega after changing form.

This is why I use the codes like pokemon.form%4==1. X%4 will divide X by 4, then give off the remainder. If X is either 1 or 5, the function will throw up 1. This allows both Sun Castform and Blazing Castform to go "Blazing Castform is the Mega form".

X%4 will return 0 if X is evenly divisible by four, which means that 0, 4, and 8 (normal Castform, Sand Castform, and Diamond Castform) would all all give Diamond Castform as their Mega. Thus I have the "next if pokemon.form==0" at the beginning - so that the function doesn't even check for Megas if Castform is in form 0.

The companion function to this would be:
Code:
"getUnmegaForm"=>proc{|pokemon|
   next 0 if pokemon.form==0
   next 4 if pokemon.form%4==0
   next pokemon.form%4
},
However, Castform always reverts to normal after the end of a battle, so
Code:
"getUnmegaForm"=>proc{|pokemon|
   next 0
},
is perfectly fine.


Code:
MultipleForms.register(:CHESNAUGHT,{
"getMegaForm"=>proc{|pokemon|
   [COLOR="Red"]next 2 if pokemon.form==2[/COLOR]
   next 1 if isConst?(pokemon.item,PBItems,:CHESNAUGHTITE)
   next
},
Next up we have Mega Chesnaught. The Mega changes forms in and of itself based on how it battles, much like a sort of Stance Change.

This is fine and dandy, just make it Mega Evolve into form 1 and use Stance Change (or Chesnaught's version) to change back and forth between forms at will. EXCEPT, we again run into the issue that isMega? uses the getMegaForm function, meaning that only form #1 - which in my game is "Ball Forme" - would go "yes, I'm a Mega".

However, this is a simple fix, as can be seen above. Adding the red line of code tells the game that form #2 - "Attack Forme" - is also a Mega for Chesnaught. Yes, Chesnaught Mega Evolves into Ball Forme, but almost invariably will he change immediately into Attack Forme.

This is accompanied by the standard
Code:
"getUnmegaForm"=>proc{|pokemon|
   next 0
},
since both Ball Forme and Attack Forme revert to normal Chesnaught.
 
my dont seem to work it still mega evolve into 1st one not 2nd one if it reach 10.
next 1 if isConst?(pokemon.item,PBItems,:DELTAGEM)
next 2 if isConst?(pokemon.item,PBItems,:DELTAGEM) && $game_variables[112] == 10
next
 
my dont seem to work it still mega evolve into 1st one not 2nd one if it reach 10.
Code:
next 1 if isConst?(pokemon.item,PBItems,:DELTAGEM)
next 2 if isConst?(pokemon.item,PBItems,:DELTAGEM) && $game_variables[112] == 10
next

There's two ways to fix this:

Code:
next 1 if isConst?(pokemon.item,PBItems,:DELTAGEM) [COLOR="Red"]&& $game_variables[112] != 10[/COLOR]
next 2 if isConst?(pokemon.item,PBItems,:DELTAGEM) && $game_variables[112] == 10
next

or

Code:
next 2 if isConst?(pokemon.item,PBItems,:DELTAGEM) && $game_variables[112] == 10
next 1 if isConst?(pokemon.item,PBItems,:DELTAGEM)
next

It's never even looking at the second line, because the conditions under which it's true make line 1 also true.
 
Thank! the 2nd one work :)

There's two ways to fix this:

Code:
next 1 if isConst?(pokemon.item,PBItems,:DELTAGEM) [COLOR="Red"]&& $game_variables[112] != 10[/COLOR]
next 2 if isConst?(pokemon.item,PBItems,:DELTAGEM) && $game_variables[112] == 10
next

or

Code:
next 2 if isConst?(pokemon.item,PBItems,:DELTAGEM) && $game_variables[112] == 10
next 1 if isConst?(pokemon.item,PBItems,:DELTAGEM)
next

It's never even looking at the second line, because the conditions under which it's true make line 1 also true.
 
Back
Top