• 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] Zygarde (Ability, Moves, Zygarde Cube)

51
Posts
9
Years
    • Seen Jan 8, 2023
    Hello Guys!!!!!!
    I'm a newbie on the script, but I tried to create the new Zygarde's forms:
    Code:
    MultipleForms.register(:ZYGARDE,{
    "getBaseStats"=>proc{|pokemon|
       case pokemon.form
       when 1; next [54,100, 71,61,85,115]   # Zygarde 10%
       when 2; next [216,100,121,91,95,85]   # Zygarde 100%
       else;   next                          # Zygarde 50%
       end
    },
    "height"=>proc{|pokemon|
       case pokemon.form
       when 1; next 12 # Zygarde 10%
       when 2; next 45 # Zygarde 100%
       else;   next    # Zygarde 50%
       end
    },
    "weight"=>proc{|pokemon|
       case pokemon.form
       when 1; next 335    # Zygarde 10%
       when 2; next 6100   # Zygarde 100%
       else;   next        # Zygarde 50%
       end
    }
    })

    I tried to create the new Zygarde's ability:
    Code:
        # Zygarde
        if isConst?(self.species,PBSpecies,:ZYGARDE)
          if self.hasWorkingAbility(:POWERCONSTRUCT) && @hp<=((@totalhp/2).floor)
            if self.form!=2
              self.form=2; transformed=true
            end
          else
            if self.form!=0
              self.form=0; transformed=true
          end
        end
      end
    but if i add:
    Code:
        # Zygarde
        if isConst?(self.species,PBSpecies,:ZYGARDE)
          if self.hasWorkingAbility(:POWERCONSTRUCT) && @hp<=((@totalhp/2).floor)
            if self.form!=2
              self.form=2; transformed=true
            end
          else
            if self.form!=0
              self.form=0; transformed=true
          end
      [COLOR="Red"]else
        if self.form!=1
              self.form=1; transformed=true
          end[/COLOR]
        end
      end
    tells me syntax error...why?
    then I tried to create Zygarde Cube:
    Code:
    ItemHandlers::UseOnPokemon.add(:ZYGARDECUBE,proc{|item,pokemon,scene|
       if isConst?(pokemon.species,PBSpecies,:ZYGARDE)
         if pokemon.hp>0
           pokemon.form=(pokemon.form==0) ? 1 : 0
        if scene.pbConfirm(_INTL("Would you like to change {1}'s Form?",
          pokemon.name))
           scene.pbRefresh
           scene.pbDisplay(_INTL("{1} changed Forme!",pokemon.name))
           next true
         else
           scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
         end
       else
         scene.pbDisplay(_INTL("It had no effect."))
         next false
       end
    })
    Now I ask you: how do I insert the option to choose the ability to assign and the moves for him to learn? I found a script on skill choices, but do not know how to integrate the script mentioned above:
    Code:
    ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE,proc{|item,pokemon,scene|
       abils=pokemon.getAbilityList
       abil1=0; abil2=0
       for i in abils
         abil1=i[0] if i[1]==0
         abil2=i[0] if i[1]==1
       end
       if abil1<=0 || abil2<=0 || pokemon.hasHiddenAbility?
         scene.pbDisplay(_INTL("It won't have any effect."))
         next false
       end
       newabil=(pokemon.abilityIndex+1)%2
       newabilname=PBAbilities.getName((newabil==0) ? abil1 : abil2)
       if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability to {2}?",
          pokemon.name,newabilname))
         pokemon.setAbility(newabil)
         scene.pbRefresh
         scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!",pokemon.name,
            PBAbilities.getName(pokemon.ability)))
         next true
       end
       next false
    })
     
    Last edited:
    188
    Posts
    9
    Years
    • Seen Jan 21, 2024
    The syntax error is from too few end statements. Add an end statement before the red else statement.
     
    51
    Posts
    9
    Years
    • Seen Jan 8, 2023
    It tells me the same error, but another problem arose: every time zygarde loses 50% of life changes in its form 100% even if it is already in that form! how do I say that the ability is activated once per game?
     
    971
    Posts
    7
    Years
    • Age 21
    • Seen Nov 28, 2022
    It tells me the same error, but another problem arose: every time zygarde loses 50% of life changes in its form 100% even if it is already in that form! how do I say that the ability is activated once per game?

    I haven't tested this because I don't have time, but does this work for the ability?
    Code:
        if isConst?(self.species,PBSpecies,:ZYGARDE) && !self.isFainted? &&
           self.hasWorkingAbility(:POWERCONSTRUCT)
          if @hp<=((@totalhp/2).floor)
            if self.form!=2
              user=self
              @battle.pbDisplay(_INTL("{1} sensed the presence of many!",pbThis))
              self.form=2; transformed=true
            end
          end
        end
    Edit: Made a typo. Thanks to Rot8er_ConeX for pointing it out. Still, this bit was just an example if this is how he wanted it. You may want to follow ConeX, since I'm not too great with coding.
     
    Last edited:
    824
    Posts
    8
    Years
  • Code:
        if isConst?(self.species,PBSpecies,:ZYGARDE) && !self.isFainted? &&
           self.hasWorkingAbility(:POWERCONSTRUCT)
          if @hp<=((@totalhp/2).floor)
            if self.form!=2
              @battle.pbDisplay(_INTL("{1} sensed the presence of many!",pbThis))
              self.form+=2; transformed=true
            end
          end
        end

    Correcting M3rein's code. There was a typo ("=!" instead of "!=") and, as people seem to forget when they code Zygarde's ability - there needs to be some way to record which form to transform back into. So make forms 2 and 3 both be 100% form, and then form 2 returns to being form 0 when the battle ends, and form 3 returns to being form 1. This can be done by placing
    Code:
    if isConst?(self.species,PBSpecies,:ZYGARDE) && self.form>1
      self.form-=2
    end
    in the "revert form at the end of battle" code.
     
    971
    Posts
    7
    Years
    • Age 21
    • Seen Nov 28, 2022
    Code:
        if isConst?(self.species,PBSpecies,:ZYGARDE) && !self.isFainted? &&
           self.hasWorkingAbility(:POWERCONSTRUCT)
          if @hp<=((@totalhp/2).floor)
            if self.form!=2
              @battle.pbDisplay(_INTL("{1} sensed the presence of many!",pbThis))
              self.form+=2; transformed=true
            end
          end
        end

    Correcting M3rein's code. There was a typo ("=!" instead of "!=") and, as people seem to forget when they code Zygarde's ability - there needs to be some way to record which form to transform back into. So make forms 2 and 3 both be 100% form, and then form 2 returns to being form 0 when the battle ends, and form 3 returns to being form 1. This can be done by placing
    Code:
    if isConst?(self.species,PBSpecies,:ZYGARDE) && self.form>1
      self.form-=2
    end
    in the "revert form at the end of battle" code.

    That looks better. I actually forgot that he had them all in one Pokémon. I have 10% and 50% as separate Pokémon, so I must've had that in my head. Anyways, I probably wouldn't have known how to make what you did, anyways.
     
    51
    Posts
    9
    Years
    • Seen Jan 8, 2023
    Hello guys!
    I create, in these days, a script to solve the problem with the ability:
    Code:
       # Zygarde
        if isConst?(self.species,PBSpecies,:ZYGARDE)
          if self.hasWorkingAbility(:POWERCONSTRUCT) && @hp<=((@totalhp/2).floor)
            if self.form!=2
              self.form=2; transformed=true
            end
          else
            if self.form!=2 && @hp<=((@totalhp/2).floor)
              self.form=2; transformed=false
             end
           end
          end
    You like it? But I have noticed that then there could be a problem regarding the return to the basic form, because Zygarde is transformed in 100% form both by the form 50% both by the form 10%.
    But in the script is written:
    Code:
      def pbResetForm
        if !@effects[PBEffects::Transform]
          if isConst?(self.species,PBSpecies,:CASTFORM) ||
             isConst?(self.species,PBSpecies,:CHERRIM) ||
             isConst?(self.species,PBSpecies,:DARMANITAN) ||
             isConst?(self.species,PBSpecies,:MELOETTA) ||
             isConst?(self.species,PBSpecies,:AEGISLASH) ||
             isConst?(self.species,PBSpecies,:XERNEAS)
            self.form=0
          end
        end
     
    971
    Posts
    7
    Years
    • Age 21
    • Seen Nov 28, 2022
    Hello guys!
    I create, in these days, a script to solve the problem with the ability:
    Code:
       # Zygarde
        if isConst?(self.species,PBSpecies,:ZYGARDE)
          if self.hasWorkingAbility(:POWERCONSTRUCT) && @hp<=((@totalhp/2).floor)
            if self.form!=2
              self.form=2; transformed=true
            end
          else
            if self.form!=2 && @hp<=((@totalhp/2).floor)
              self.form=2; transformed=false
             end
           end
          end
    You like it? But I have noticed that then there could be a problem regarding the return to the basic form, because Zygarde is transformed in 100% form both by the form 50% both by the form 10%.
    But in the script is written:
    Code:
      def pbResetForm
        if !@effects[PBEffects::Transform]
          if isConst?(self.species,PBSpecies,:CASTFORM) ||
             isConst?(self.species,PBSpecies,:CHERRIM) ||
             isConst?(self.species,PBSpecies,:DARMANITAN) ||
             isConst?(self.species,PBSpecies,:MELOETTA) ||
             isConst?(self.species,PBSpecies,:AEGISLASH) ||
             isConst?(self.species,PBSpecies,:XERNEAS)
            self.form=0
          end
        end

    Look at Rot8er_ConeX' post regarding +=2 and -=2
     
    51
    Posts
    9
    Years
    • Seen Jan 8, 2023
    Thanks guys!!!
    Now the new question is for Zygarde's Cube. My goal is to ensure that allows me to change shape and abilities. I found two scripts that, if combined, would do to my case, but I do not know how to put them together. I carry the script below:

    Code:
    ItemHandlers::UseOnPokemon.add(:ZYGARDECUBE,proc{|item,pokemon,scene|
       if isConst?(pokemon.species,PBSpecies,:ZYGARDE)
         if pokemon.hp>0
           pokemon.form=(pokemon.form==0) ? 1 : 0
        if scene.pbConfirm(_INTL("Would you like to change {1}'s Form?",
          pokemon.name))
           scene.pbRefresh
           scene.pbDisplay(_INTL("{1} changed Forme!",pokemon.name))
           next true
         else
           scene.pbDisplay(_INTL("This can't be used on the fainted Pok?mon."))
         end
       else
         scene.pbDisplay(_INTL("It had no effect."))
         next false

    Code:
    ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE,proc{|item,pokemon,scene|
       abils=pokemon.getAbilityList
       abil1=0; abil2=0
       for i in abils
         abil1=i[0] if i[1]==0
         abil2=i[0] if i[1]==1
       end
       if abil1<=0 || abil2<=0 || pokemon.hasHiddenAbility?
         scene.pbDisplay(_INTL("It won't have any effect."))
         next false
       end
       newabil=(pokemon.abilityIndex+1)%2
       newabilname=PBAbilities.getName((newabil==0) ? abil1 : abil2)
       if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability to {2}?",
          pokemon.name,newabilname))
         pokemon.setAbility(newabil)
         scene.pbRefresh
         scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!",pokemon.name,
            PBAbilities.getName(pokemon.ability)))
         next true
       end
       next false
    })
     
    824
    Posts
    8
    Years
  • 1.) Your If statements are a mess. It was hard to tell this, though, because your indentation was a mess as well.
    2.) As far as I know, the Zygarde Cube can only change Zygarde's form if it has Power Construct.
    3.) Adding in the other functions for the Zygarde Cube. Namely, the teaching of moves and checking the number of Zygarde Cells in the cube.

    Code:
    ItemHandlers::UseOnPokemon.add(:ZYGARDECUBE,proc{|item,pokemon,scene|
       moves=[]
    #   moves.push("Land's Wrath") if (player found Land's Wrath)
    #   moves.push("Thousand Arrows") if (player found Thousand Arrows)
    #   moves.push("Thousand Waves") if (player found Thousand Waves)
    #   moves.push("Core Enforcer") if (player found Core Enforcer)
    #   moves.push("Extreme Speed") if (player found Extreme Speed)
       cmds=["Change Forme"]
       cmds.push("Teach Move") if moves.length>0
       cmds.push("Check")
       cmds.push("Back")
       bob=Kernel.pbMessage(_INTL("Do what?"),cmds,cmds.length)
       case cmds[bob]
       when "Back"
         return true
       when "Check"
         x=14 # replace the 14 with the variable you use to store the number of Zygarde Cells the player has found
         Kernel.pbMessage(_INTL("You have found {1} of 100 cells and cores",x))
         return true
       when "Teach Move"
         moves.push("Back")
         bob2=Kernel.pbMessage(_INTL("Do what?"),moves,moves.length)
         case moves[bob2]
         when "Back"
           return true
         when "Land's Wrath"
           pbLearnMove(pokemon,getConst(PBMoves,:LANDSWRATH),false,false)
         when "Thousand Arrows"
           pbLearnMove(pokemon,getConst(PBMoves,:THOUSANDARROWS),false,false)
         when "Thousand Waves"
           pbLearnMove(pokemon,getConst(PBMoves,:THOUSANDWAVES),false,false)
         when "Core Enforcer"
           pbLearnMove(pokemon,getConst(PBMoves,:COREENFORCER),false,false)
         when "Extreme Speed"
           pbLearnMove(pokemon,getConst(PBMoves,:EXTREMESPEED),false,false)
         end
         return true
       when "Change Forme"
         if isConst?(pokemon.species,PBSpecies,:ZYGARDE) && isConst?(pokemon.ability,PBAbilities,:POWERCONSTRUCT)
           if pokemon.hp>0
             pokemon.form=(pokemon.form==0) ? 1 : 0
             if scene.pbConfirm(_INTL("Would you like to change {1}'s Form?",
                 pokemon.name))
               pokemon.form=1-pokemon.form
               pokemon.form=0 if pokemon.form>1 || pokemon.form<0
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1} changed Forme!",pokemon.name))
               next true
             else
               scene.pbDisplay(_INTL("This can't be used on the fainted Pok?mon."))
               next false
             end
           else
             scene.pbDisplay(_INTL("It had no effect."))
             next false
           end
         end
       end
    }

    I think this usurps the DNA Splicers in terms of being the most complicated item in Pokemon.
     
    51
    Posts
    9
    Years
    • Seen Jan 8, 2023
    mmmmmm i understand!
    and as an event? how do I create it through conditional branch?
     
    51
    Posts
    9
    Years
    • Seen Jan 8, 2023
    yes yes, because create a Zygarde's Cube script is very difficult. The object "Zygarde Cube" will a key to start the event
     
    824
    Posts
    8
    Years
  • yes yes, because create a Zygarde's Cube script is very difficult. The object "Zygarde Cube" will a key to start the event

    You don't need an event. Just use the script I gave above. You'll need some way to record which of the moves the player has found, which is why I have those five lines commented out. You'll also need to record the number of cells the player has found.
     
    51
    Posts
    9
    Years
    • Seen Jan 8, 2023
    ah sorry I did not understand XD
    You can explain what I do with commented lines?
    I almost wanted to avoid searching the cells and nuclei and to limit myself only to change the form, skills and teach him the moves.
     
    824
    Posts
    8
    Years
  • ah sorry I did not understand XD
    You can explain what I do with commented lines?
    I almost wanted to avoid searching the cells and nuclei and to limit myself only to change the form, skills and teach him the moves.

    Code:
    ItemHandlers::UseOnPokemon.add(:ZYGARDECUBE,proc{|item,pokemon,scene|
       moves=["Land's Wrath","Thousand Arrows","Thousand Waves","Core Enforcer","Extreme Speed"]
       cmds=["Change Forme"]
       cmds.push("Teach Move") if moves.length>0
       cmds.push("Back")
       bob=Kernel.pbMessage(_INTL("Do what?"),cmds,cmds.length)
       case cmds[bob]
       when "Back"
         return true
       when "Check"
         x=14 # replace the 14 with the variable you use to store the number of Zygarde Cells the player has found
         Kernel.pbMessage(_INTL("You have found {1} of 100 cells and cores",x))
         return true
       when "Teach Move"
         moves.push("Back")
         bob2=Kernel.pbMessage(_INTL("Do what?"),moves,moves.length)
         case moves[bob2]
         when "Back"
           return true
         when "Land's Wrath"
           pbLearnMove(pokemon,getConst(PBMoves,:LANDSWRATH),false,false)
         when "Thousand Arrows"
           pbLearnMove(pokemon,getConst(PBMoves,:THOUSANDARROWS),false,false)
         when "Thousand Waves"
           pbLearnMove(pokemon,getConst(PBMoves,:THOUSANDWAVES),false,false)
         when "Core Enforcer"
           pbLearnMove(pokemon,getConst(PBMoves,:COREENFORCER),false,false)
         when "Extreme Speed"
           pbLearnMove(pokemon,getConst(PBMoves,:EXTREMESPEED),false,false)
         end
         return true
       when "Change Forme"
         if isConst?(pokemon.species,PBSpecies,:ZYGARDE) && isConst?(pokemon.ability,PBAbilities,:POWERCONSTRUCT)
           if pokemon.hp>0
             pokemon.form=(pokemon.form==0) ? 1 : 0
             if scene.pbConfirm(_INTL("Would you like to change {1}'s Form?",
                 pokemon.name))
               pokemon.form=1-pokemon.form
               pokemon.form=0 if pokemon.form>1 || pokemon.form<0
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1} changed Forme!",pokemon.name))
               next true
             else
               scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
               next false
             end
           else
             scene.pbDisplay(_INTL("It had no effect."))
             next false
           end
         end
       end
    }

    Here's a version of the script for a scenario in which the player doesn't need to collect any bits of Zygarde.
     
    81
    Posts
    8
    Years
    • Seen Sep 7, 2019
    I made Zygarde CUbe and the regenerator thingy already. I'll post it when it's full proof
     

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • Code:
        if isConst?(self.species,PBSpecies,:ZYGARDE) && !self.isFainted? &&
           self.hasWorkingAbility(:POWERCONSTRUCT)
          if @hp<=((@totalhp/2).floor)
            if self.form!=2
              @battle.pbDisplay(_INTL("{1} sensed the presence of many!",pbThis))
              self.form+=2; transformed=true
            end
          end
        end

    Correcting M3rein's code. There was a typo ("=!" instead of "!=") and, as people seem to forget when they code Zygarde's ability - there needs to be some way to record which form to transform back into. So make forms 2 and 3 both be 100% form, and then form 2 returns to being form 0 when the battle ends, and form 3 returns to being form 1. This can be done by placing
    Code:
    if isConst?(self.species,PBSpecies,:ZYGARDE) && self.form>1
      self.form-=2
    end
    in the "revert form at the end of battle" code.

    My apologize, im newbie.

    i put this. Ok. 50% to 100% when hp<50%.
    Code:
        # 50% to Complete Forme
        if isConst?(self.species,PBSpecies,:ZYGARDE) && !self.isFainted? &&
           self.hasWorkingAbility(:POWERCONSTRUCT)
          if @hp<=((@totalhp/2).floor)
            if self.form!=2
              @battle.pbDisplay(_INTL("{1} sensed the presence of many!",pbThis))
              self.form+=2; transformed=true
            end
          end
        end

    Now, how can put 10% to 100%?

    like this?:
    Code:
        # 10% to Complete Forme
        if isConst?(self.species,PBSpecies,:ZYGARDE) && !self.isFainted? &&
           self.hasWorkingAbility(:POWERCONSTRUCT)
          if @hp<=((@totalhp/2).floor)
            if self.form!=2
              @battle.pbDisplay(_INTL("{1} sensed the presence of many!",pbThis))
              self.form+=2; transformed=true
            end
          else
            if isConst?(self.species,PBSpecies,:ZYGARDE) && self.form>1
              self.form-=2
            end
          end
        end


    my pokemonform.txt
    ZYGARDE-1 = 10%
    ZYGARDE-2 = 100%
    ZYGARDE = 50%

    TY TY! :D

    EDIT:
    I MADE IT. 10% to 100%:
    Code:
        # 10% to Complete Forme
        if isConst?(self.species,PBSpecies,:ZYGARDE)&& self.form>0
          if self.hasWorkingAbility(:POWERCONSTRUCT) && @hp<=((@totalhp/2).floor)
            if self.form!=2
              self.form=2; transformed=true
            end
          else
            if self.form!=1
              self.form=1; transformed=true
            end
          end
        end

    Now, hes not back to 10% when end the battle :/ How can i do that?
     
    Last edited:

    mybusiness

    Guest
    0
    Posts
    So, has anyone made the Zygarde Cube?
    Meanwhile, I got a functional Zygarde script that makes it change back to its previous form after battle, if transformed through Power Construct, like it should be. Delete everything you have regarding Power Construct, and add to your code only what I´ve written with red. Here it is:

    In PokeBattle_Battler:
    Spoiler:


    In PokeBattle_MoveEffects:
    Spoiler:

    In Pokemon_MegaEvolution, under def makeUnprimal:
    Spoiler:

    In PokeBattle_Battle, in def pbThrowPokeBall:
    Spoiler:

    In PField_Battles, in def pbAfterBattle:
    Spoiler:

    Edit: It may seem clear, but here, the form 0 is 50%, form 1 is 10% and form 2 is 100%.
    Edit2: Fixed the form upon catching Full Forme.
     
    Last edited:
    Back
    Top