• 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] Implementing One Z move per Battler?

81
Posts
8
Years
  • Age 22
  • Seen Sep 7, 2019
I have implemented the Z-Ring mechanic and was wondering how do I set it up so you can place Z-Stones into the Key Item and have it check to see if the pokemon is holding the same item as this Key Item?

I was also wondering how do I set it up so you can only use one Z-Move per battle It's going to be a button so that one you use the button it'll never appear until next battle.
 
Last edited by a moderator:
155
Posts
9
Years
  • Age 31
  • Seen Jun 11, 2021
While I don't know how exactly to pull that off, I do have a vague idea of what to do. Might I suggest looking around at the pbCanMegaEvolve? method? It should give you somewhat an idea of what you need to do to ensure a Z-Move can only be used once.
 
188
Posts
9
Years
  • Age 39
  • Seen Jan 21, 2024
What I would do is modify the Mega Ring to take integer values instead of boolean. I would use -1 for not owned, 0 for owned with no Z-Crystals and getConst(PBItems,:SNORLIUMZ) to tell the game it has a Snorlium-Z set in it.

In PokeBattle_Battle, modify this line of code:
Code:
return false if pbBelongsToPlayer?(index) && [COLOR=Red]$PokemonGlobal.megaRing<0[/COLOR]
In Debug, alter the Mega Ring toggle code so if the Mega Ring is owned and a Z-Crystal is set, add it back into your bag before setting its value to -1. If the Mega Ring is not owned, set it to 0.

As for the one-Z-move-per-battle restriction, Mutant Yoshi would be correct in suggesting the pbCanMegaEvolve? method as a base. I can suggest this code added after pbCanMegaEvolve?:
Code:
  def pbCanUseZMove?(index)
    return false if $game_switches[NO_Z_MOVE] # assuming such a switch exists
    return false if pbBelongsToPlayer?(index) && $PokemonGlobal.megaRing<0
    return false if @battlers[index].pokemon.item==0
    # add return false lines for type-specific or species-specific Z-Crystals
    return false if @battlers[index].pokemon.item!=$PokemonGlobal.megaRing
    side=(pbIsOpposing?(index)) ? 1 : 0
    owner=pbGetOwnerIndex(index)
    return false if @zmove[side][owner]!=-1
    return true
  end
The code will only work if a @zmove attribute exists and is initialised in the same way as the @megaEvolution attribute.
 

TheShinyMew

Wild Challenger appeared!
125
Posts
13
Years
Bump! Is there a way to turn regular moves into Z moves? Like how Mew's Psychic turns into Genesis Supernova and such?
 
Back
Top