• 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!
  • 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
    9
    Years
    • 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:
    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.
     
    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.
     
    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