The PokéCommunity Forums Fan Games Game Development Scripts, Tutorials & Tools
Essentials Script Zygarde Core and Cube Mechanic V2 (I

Scripts, Tutorials & Tools This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.

Reply
 
Thread Tools
  #1    
Old August 19th, 2017 (1:30 PM). Edited August 21st, 2017 by BlackOutG5.
BlackOutG5's Avatar
BlackOutG5 BlackOutG5 is offline
     
    Join Date: Jul 2015
    Gender: Male
    Nature: Bold
    Posts: 77
    In its own script above main

    Code:
    #Zygarde Cube and Core mechanic by BlackStarG5
    #Free to use with credit!!
    
    ZYGARDECELLS = 107          #Variable reserved for this
    COREEXTREMESPEED = 276      #Switch reserved for this 
    CORETHOUSANDARROWS =  277   #Switch reserved for this
    COREDRAGONDANCE = 278       #Switch reserved for this
    CORETHOUSANDWAVES = 279     #Switch reserved for this
    CORECOREENFORCER = 280      #Switch reserved for this
    
    def pbZygardeConstruct
      loop do
        choices = ["Assembly","Separation","What is assembly?","What is separation?","Quit"]
        cmd = Kernel.pbMessage(_INTL("What would you like to do?"), choices, choices.length - 1)
        if choices[cmd]=="Assembly"
          choices = ["Using Zygarde and the Zygarde Cube","Using the Zygarde Cube only","What assembly methods are available?","Quit"]
          cmd = Kernel.pbMessage(_INTL("Please select how you'd like to assemble Zygarde."), choices, choices.length - 1)
          if choices[cmd]=="Using Zygarde and the Zygarde Cube"
            Kernel.pbMessage(_INTL("Please select Zygarde."))
            pbChooseAblePokemon(1,3)
            poke=$Trainer.party[$game_variables[1]]
            if poke.species==PBSpecies::ZYGARDE
              if $game_variables[ZYGARDECELLS]>9 && poke.form==1
                if $game_variables[ZYGARDECELLS]>=50 && poke.form==1
                  Kernel.pbMessage(_INTL("The 50% stored in the Zygarde Cube will be used to assemble Zygarde 50% Forme!"))
                  choices = ["Yes","No"]
                  cmd = Kernel.pbMessage(_INTL("Is that OK?"), choices, choices.length - 1)
                  if choices[cmd]=="Yes"
                    poke=pbGetPokemon(1)
                    poke.form=0
                    $game_variables[ZYGARDECELLS]-=40
                    Kernel.pbMessage(_INTL("Cells have appeared! Zygarde transformed to Zygarde 50% Forme!"))
                    Kernel.pbMessage(_INTL("The remaining Cells disappeared."))
                    Kernel.pbMessage(_INTL("Zygarde has gone into a Poke Ball!"))
                    break
                  elsif choices[cmd]=="No"
                    Kernel.pbMessage(_INTL("Quitting the assembly operation!"))
                    return false
                  end
                else
                  Kernel.pbMessage(_INTL("You do not have enough Cells!")) 
                end
              elsif poke.form==0 && $game_variables[ZYGARDECELLS]>=50
                Kernel.pbMessage(_INTL("From your chosen Zygarde and the 50% now in the Zygarde Cube, the unified Zygarde with the Power Construct Ability will be assembled!"))
                choices = ["Yes","No"]
                cmd = Kernel.pbMessage(_INTL("Is that OK?"), choices, choices.length - 1)
                if choices[cmd]=="Yes"
                  poke.setAbility(2)
                  $game_variables[ZYGARDECELLS]-=50
                  Kernel.pbMessage(_INTL("Zygarde has been reassembled!"))
                  Kernel.pbMessage(_INTL("It's the unified Zygarde with the the Power Construct Ability!"))
                  Kernel.pbMessage(_INTL("Zygarde has gone into a Poke Ball!"))
                  break
                elsif choices[cmd]=="No"
                  Kernel.pbMessage(_INTL("Quitting the assembly operation!"))
                  break
                  return false
                end
              else
                Kernel.pbMessage(_INTL("You do not have enough Cells!"))
              end
            else
              Kernel.pbMessage(_INTL("You cannot assemble Pokemon other than Zygarde!"))
              Kernel.pbMessage(_INTL("Quitting the assembly operation!"))
              return false
            end
          elsif choices[cmd]=="Using the Zygarde Cube only"
            if $game_variables[ZYGARDECELLS]>10
              if $game_variables[ZYGARDECELLS]<49
                Kernel.pbMessage(_INTL("Zygarde will be assembled with the Cores and Cells within the Zygarde Cube only!"))
                Kernel.pbMessage(_INTL("The 10% stored in the Zygarde Cube will be used to assemble Zygarde 10% Forme!"))
                choices = ["Yes","No"]
                cmd = Kernel.pbMessage(_INTL("Is that OK?"), choices, choices.length - 1)
                if choices[cmd]=="Yes"
                  p=PokeBattle_Pokemon.new(:ZYGARDE,30,$Trainer)
                  p.form=1
                  p.makeNotShiny
                  p.pbLearnMove(:SAFEGUARD)
                  p.pbLearnMove(:BIND)
                  p.pbLearnMove(:DIG)
                  p.pbLearnMove(:LANDSWRATH)
                  p.setAbility(0)
                  p.calcStats
                  Kernel.pbAddPokemon(p)
                  $game_variables[ZYGARDECELLS]-=10
                  break
                  Kernel.pbMessage(_INTL("A new Zygarde has been assembled!"))
                  Kernel.pbMessage(_INTL("It's Zygarde 10% Forme!"))
                  Kernel.pbMessage(_INTL("Zygarde has gone into a Poke Ball!"))
                elsif choices[cmd]=="No"
                  break
                  Kernel.pbMessage(_INTL("Quitting the assembly operation!"))
                  return false
                end
              end
            else
              Kernel.pbMessage(_INTL("You do not have enough Cells!"))
            end
            if $game_variables[ZYGARDECELLS]>49
              if $game_variables[ZYGARDECELLS]<100
                Kernel.pbMessage(_INTL("Zygarde will be assembled with the Cores and Cells within the Zygarde Cube only!"))
                Kernel.pbMessage(_INTL("The 50% stored in the Zygarde Cube will be used to assemble Zygarde 50% Forme!"))
                choices = ["Yes","No"]
                cmd = Kernel.pbMessage(_INTL("Is that OK?"), choices, choices.length - 1)
                if choices[cmd]=="Yes"
                  p=PokeBattle_Pokemon.new(:ZYGARDE,50,$Trainer)
                  p.form=0
                  p.makeNotShiny
                  p.pbLearnMove(:SAFEGUARD)
                  p.pbLearnMove(:BIND)
                  p.pbLearnMove(:SANDSTORM)
                  p.pbLearnMove(:HAZE)
                  p.setAbility(0)
                  p.calcStats
                  Kernel.pbAddPokemon(p)
                  $game_variables[ZYGARDECELLS]-=50
                  break
                  Kernel.pbMessage(_INTL("A new Zygarde has been assembled!"))
                  Kernel.pbMessage(_INTL("It's Zygarde 50% Forme!"))
                  Kernel.pbMessage(_INTL("Zygarde has gone into a Poke Ball!"))
                elsif choices[cmd]=="No"
                  break
                  Kernel.pbMessage(_INTL("Quitting the assembly operation!"))
                  return false
                end
              end
            end
            if $game_variables[ZYGARDECELLS]>99
              if $game_variables[ZYGARDECELLS]>99
                Kernel.pbMessage(_INTL("Zygarde will be assembled with the Cores and Cells within the Zygarde Cube only!"))
                Kernel.pbMessage(_INTL("The 50% stored in the Zygarde Cube will be used to assemble Zygarde 50% Forme!"))
                Kernel.pbMessage(_INTL("The Zygarde will have the Power Construct Ability."))
                choices = ["Yes","No"]
                cmd = Kernel.pbMessage(_INTL("Is that OK?"), choices, choices.length - 1)
                if choices[cmd]=="Yes"
                  p=PokeBattle_Pokemon.new(:ZYGARDE,50,$Trainer)
                  p.form=0
                  p.makeNotShiny
                  p.pbLearnMove(:SAFEGUARD)
                  p.pbLearnMove(:BIND)
                  p.pbLearnMove(:SANDSTORM)
                  p.pbLearnMove(:HAZE)
                  p.setAbility(2)
                  p.calcStats
                  Kernel.pbAddPokemon(p)
                  $game_variables[ZYGARDECELLS]-=50
                  break
                  Kernel.pbMessage(_INTL("A new Zygarde has been assembled!"))
                  Kernel.pbMessage(_INTL("It's Zygarde 50% Forme!"))
                  Kernel.pbMessage(_INTL("Zygarde has gone into a Poke Ball!"))
                elsif choices[cmd]=="No"
                  break
                  Kernel.pbMessage(_INTL("Quitting the assembly operation!"))
                  return false
                end
              end
            end
          elsif choices[cmd]=="What assembly methods are available?"
            Kernel.pbMessage(_INTL("There are two ways to achieve Zygarde assembly."))
            Kernel.pbMessage(_INTL("One is to take a Zygarde in your party and add to it the Cells stored in the Zygarde Cube!"))
            Kernel.pbMessage(_INTL("The other way is to assemble the Cells stored in the Zygarde Cube to form a whole new Zygarde!"))
          elsif choices[cmd]=="Quit"
            return false
          end
        elsif choices[cmd]=="Separation"
          Kernel.pbMessage(_INTL("Please select the Zygarde you'd like to speparate into cells"))
          pbChooseAblePokemon(1,3)
          poke=$Trainer.party[$game_variables[1]]
          party=$Trainer.party[$game_variables[1]]
          if poke.species==PBSpecies::ZYGARDE
            if $Trainer.party.length>1
              Kernel.pbMessage(_INTL("Once separated, the separated Zygarde cannot be put back together."))
              Kernel.pbMessage(_INTL("You'll lose all it's moves, Ribbons-\\neverything about it."))
              choices = ["Yes","No"]
              cmd = Kernel.pbMessage(_INTL("Would you like to separate the Zygarde you've selected?"), choices, choices.length - 1)
              if choices[cmd]=="Yes"
                if poke.form==1 && !isConst?(poke.ability,PBAbilities,:POWERCONSTRUCT)
                  Kernel.pbMessage(_INTL("Zygarde has separated."))
                  Kernel.pbMessage(_INTL("The percentage the Zygarde Cube has increased by was 10."))
                  $game_variables[ZYGARDECELLS]+=10
                  $Trainer.party.delete_at($game_variables[1])
                elsif poke.form==1 && isConst?(poke.ability,PBAbilities,:POWERCONSTRUCT)
                  Kernel.pbMessage(_INTL("Zygarde has separated."))
                  Kernel.pbMessage(_INTL("The percentage the Zygarde Cube has increased by was 100."))
                  $game_variables[ZYGARDECELLS]+=100
                  $Trainer.party.delete_at($game_variables[1])
                elsif poke.form==0 && !isConst?(poke.ability,PBAbilities,:POWERCONSTRUCT)
                  Kernel.pbMessage(_INTL("Zygarde has separated."))
                  Kernel.pbMessage(_INTL("The percentage the Zygarde Cube has increased by was 50."))
                  $game_variables[ZYGARDECELLS]+=50
                  $Trainer.party.delete_at($game_variables[1])
                elsif poke.form==0 && isConst?(poke.ability,PBAbilities,:POWERCONSTRUCT)
                  Kernel.pbMessage(_INTL("Zygarde has separated."))
                  Kernel.pbMessage(_INTL("The percentage the Zygarde Cube has increased by was 100."))
                  $game_variables[ZYGARDECELLS]+=100
                  $Trainer.party.delete_at($game_variables[1])
                end
              elsif choices[cmd]=="No"
                Kernel.pbMessage(_INTL("Quitting the separation operation!"))
                return false
              end
            else
              Kernel.pbMessage(_INTL("That is your only Pokemon. It can't be divided."))
              return false
            end
          else
            Kernel.pbMessage(_INTL("The Pokemon can only be Zygarde."))
            return false
          end
        elsif choices[cmd]=="What is assembly?"
          Kernel.pbMessage(_INTL("It is called assembly when Zygarde is formed from the cells stored in the Zygarde Cube!"))
        elsif choices[cmd]=="What is separation?"
          Kernel.pbMessage(_INTL("It is called separation when Zygarde is broken down into cells which are then stored in the Zygarde Cube!"))
        elsif choices[cmd]=="Quit"
          return false
        end
      end
    end
    
    ItemHandlers::UseFromBag.add(:ZYGARDECUBE,proc{|item|
      pbChooseAblePokemon(1,3)
      poke=$Trainer.party[$game_variables[1]]
      if poke.species==PBSpecies::ZYGARDE
        choices = ["Teach Move", "Change Forms"]
        #choices.push("Change Forms") if isConst?(poke.ability,PBAbilities,:POWERCONSTRUCT)
        if poke.species==PBSpecies::ZYGARDE
          cmd = Kernel.pbMessage(_INTL("What would you like to do?"), choices, choices.length - 1)
          if choices[cmd]=="Teach Move"
            choices = []
            choices.push("Extreme Speed") if $game_switches[COREEXTREMESPEED] # Switch for Z-Core 1
            choices.push("Thousand Arrows") if $game_switches[CORETHOUSANDARROWS] # Switch for Z-Core 2
            choices.push("Dragon Dance") if $game_switches[COREDRAGONDANCE] # Switch for Z-Core 3
            choices.push("Thousand Waves") if $game_switches[CORETHOUSANDWAVES] # Switch for Z-Core 4
            choices.push("Core Enforcer") if $game_switches[CORECOREENFORCER] # Switch for Z-Core 5
            choices.push("Cancel")
            cmd = Kernel.pbMessage(_INTL("What would you like to teach it?"), choices, choices.length - 1)
            if choices[cmd]=="Extreme Speed"
              move=getConst(PBMoves,:EXTREMESPEED)
              pbLearnMove(poke,move)
            elsif choices[cmd]=="Thousand Arrows"
              move=getConst(PBMoves,:THOUSANDARROWS)
              pbLearnMove(poke,move)
            elsif choices[cmd]=="Dragon Dance"
              move=getConst(PBMoves,:DRAGONDANCE)
              pbLearnMove(poke,move)
            elsif choices[cmd]=="Thousand Waves"
              move=getConst(PBMoves,:THOUSANDWAVES)
              pbLearnMove(poke,move)
            elsif choices[cmd]=="Core Enforcer"
              move=getConst(PBMoves,:COREENFORCER)
              pbLearnMove(poke,move)
            elsif choices[cmd]=="Cancel"
              return 1
            end
          elsif choices[cmd]=="Change Forms"
            if !isConst?(poke.ability,PBAbilities,:POWERCONSTRUCT)
              Kernel.pbMessage(_INTL("Only a Zygarde with the Power Construct Ability can change its Forme."))
              return 1
            end
            choices = []
            choices.push("10%")
            choices.push("50%")
            choices.push("Cancel")
            cmd = Kernel.pbMessage(_INTL("What form would you like?"), choices, choices.length - 1)
            if choices[cmd]=="10%"
              if poke.form==0
                newform=poke.form==1
                poke.form=1
                Kernel.pbMessage(_INTL("{1} changed Form!",poke.name))
                #@scene.pbEndScene
              else
                Kernel.pbMessage(_INTL("It's already 10%!"))
                return 1
              end
            elsif choices[cmd]=="50%"
              if poke.form>=1
                newform=poke.form==0
                poke.form=0
                Kernel.pbMessage(_INTL("{1} changed Form!",poke.name))
              else
                Kernel.pbMessage(_INTL("It's already 50%!"))
                return 1
              end
            end
          elsif choices[cmd]=="Cancel"
            return false
          end
        else
          Kernel.pbMessage(_INTL("You can't do anything with it."))
          return 1
        end
      else
        Kernel.pbMessage(_INTL("It won't have any effect."))
        return 1
      end
      next 1 # Continue
    })
    For the cube, create a new item in items.txt indexed (Change it to fit key items in your game)
    Code:
    XXX,ZYGARDECUBE,Zygarde Cube,8,0,"An item to store Zygarde Cores and Cells. You can also use it to teach Zygarde moves.",2,0,6,
    In PItem_Items place
    Code:
    def pbIsZCube?(item)
      return true if isConst?(item,PBItems,:ZYGARDECUBE)
      return false
    end
    anywhere outside of any def

    Search
    Code:
    commands[cmdUse=commands.length]=_INTL("Use") if ItemHandlers.hasOutHandler(item) || (pbIsMachine?(item) && $Trainer.party.length>0)
    for in PScreen_Bag and under it put
    Code:
    commands[cmdCheck=commands.length]=_INTL("Check") if pbIsZCube?(item)
    In the same script search for
    Code:
    if cmdUse>=0 && command==cmdUse # Use item
            ret=pbUseItem(@bag,item,@scene)
            # 0=Item wasn't used; 1=Item used; 2=Close Bag to use in field
            break if ret==2 # End screen
            @scene.pbRefresh
            next
    under it put
    Code:
    elsif cmdCheck>=0 && command==cmdCheck # Check Zygarde Cube
             Kernel.pbMessage(_INTL("\\w[blacktextskin]\\c[8]You have collected {1}/100 Zygarde Cores and Zygarde Cells.",$game_variables[107]))
             Kernel.pbMessage(_INTL("\\w[blacktextskin]\\c[8]You have {1} in the Zygarde Cube now.",$game_variables[107]))
             @scene.pbRefresh
    The variables are reserved for the moves (Can be changed, One of these has to be on for the cube to work, otherwise it'll say you can't do nothing with it)

    Call the Zygarde Core/Stone mechanic using "pbZygardeConstruct"

    If any edits are made or mistakes are found please let me know. This is free to use with credit of course.
    #Note! This also uses a windowskin called "blacktextskin" so you want to make sure you either change those or create a window skin with that name
    Reply With Quote
      #2    
    Old August 20th, 2017 (3:29 PM).
    BlackOutG5's Avatar
    BlackOutG5 BlackOutG5 is offline
       
      Join Date: Jul 2015
      Gender: Male
      Nature: Bold
      Posts: 77
      These are the final edits, if there needs to be any edits please inform me.
      Reply With Quote
        #3    
      Old September 2nd, 2017 (4:12 AM). Edited September 2nd, 2017 by ToolerMaan.
      ToolerMaan ToolerMaan is offline
         
        Join Date: Aug 2016
        Posts: 1
        Sounds good... But not working for me.
        I get a Syntax error in PItem_items

        Edit: I´m dumb. I placed it wrong.
        Reply With Quote
          #4    
        Old September 2nd, 2017 (10:53 PM).
        Jonas930's Avatar
        Jonas930 Jonas930 is offline
        Jonas930
           
          Join Date: Dec 2013
          Location: Los Angeles
          Gender: Male
          Nature: Lax
          Posts: 27
          It looks nice. Thanks for your hard work. I will use it in my game!!
          Reply With Quote
            #5    
          Old September 7th, 2018 (4:02 PM). Edited September 7th, 2018 by WolfPP.
          WolfPP's Avatar
          WolfPP WolfPP is online now
             
            Join Date: Aug 2018
            Location: Brazil
            Gender: Male
            Nature: Jolly
            Posts: 153
            Oh, sorry to ress, but when i press Toss, Give or Cancel, open that issue. Every item (to use them its ok and Zygarde Cube its all ok too):

            Code:
            ---------------------------
            Pokemon Essentials
            ---------------------------
            [Pokémon Essentials version 17.2]
            
            Exception: NoMethodError
            
            Message: undefined method `>=' for nil:NilClass
            
            PScreen_Bag:490:in `pbStartScreen'
            
            PScreen_Bag:448:in `loop'
            
            PScreen_Bag:562:in `pbStartScreen'
            
            PScreen_PauseMenu:191:in `pbStartPokemonMenu'
            
            PScreen_PauseMenu:188:in `pbFadeOutIn'
            
            PScreen_PauseMenu:188:in `pbStartPokemonMenu'
            
            PScreen_PauseMenu:144:in `loop'
            
            PScreen_PauseMenu:279:in `pbStartPokemonMenu'
            
            Scene_Map:127:in `call_menu'
            
            Scene_Map:213:in `follow_update'
            Reply With Quote
              #6    
            Old September 15th, 2018 (2:10 PM).
            raki07 raki07 is offline
               
              Join Date: Apr 2016
              Posts: 32
              Quote:
              Originally Posted by WolfPP View Post
              Oh, sorry to ress, but when i press Toss, Give or Cancel, open that issue. Every item (to use them its ok and Zygarde Cube its all ok too):

              Code:
              ---------------------------
              Pokemon Essentials
              ---------------------------
              [Pokémon Essentials version 17.2]
              
              Exception: NoMethodError
              
              Message: undefined method `>=' for nil:NilClass
              
              PScreen_Bag:490:in `pbStartScreen'
              
              PScreen_Bag:448:in `loop'
              
              PScreen_Bag:562:in `pbStartScreen'
              
              PScreen_PauseMenu:191:in `pbStartPokemonMenu'
              
              PScreen_PauseMenu:188:in `pbFadeOutIn'
              
              PScreen_PauseMenu:188:in `pbStartPokemonMenu'
              
              PScreen_PauseMenu:144:in `loop'
              
              PScreen_PauseMenu:279:in `pbStartPokemonMenu'
              
              Scene_Map:127:in `call_menu'
              
              Scene_Map:213:in `follow_update'
              I have this error too.
              Reply With Quote
                #7    
              Old October 2nd, 2018 (5:52 AM).
              WolfPP's Avatar
              WolfPP WolfPP is online now
                 
                Join Date: Aug 2018
                Location: Brazil
                Gender: Male
                Nature: Jolly
                Posts: 153
                Quote:
                Originally Posted by raki07 View Post
                I have this error too.
                in PScreen_Bag, 'def pbStartScreen', add:
                Code:
                cmdCheck    = -1
                and add like this:
                Code:
                      commands[cmdRead = commands.length]        = _INTL("Read") if pbIsMail?(item)
                      if ItemHandlers.hasOutHandler(item) || (pbIsMachine?(item) && $Trainer.party.length>0)
                        if ItemHandlers.hasUseText(item)
                          commands[cmdUse = commands.length]     = ItemHandlers.getUseText(item)
                        else
                          commands[cmdUse = commands.length]     = _INTL("Use")
                        end
                      end
                      commands[cmdCheck = commands.length]       = _INTL("Check")if pbIsZCube?(item)
                      commands[cmdGive = commands.length]        = _INTL("Give") if $Trainer.pokemonParty.length>0 && pbCanHoldItem?(item)
                      commands[cmdToss = commands.length]        = _INTL("Toss") if !pbIsImportantItem?(item) || $DEBUG
                Done!
                Reply With Quote
                Reply

                Quick Reply

                Join the conversation!

                Create an account to post a reply in this thread, participate in other discussions, and more!

                Create a PokéCommunity Account
                Thread Tools

                Posting Rules
                You may not post new threads
                You may not post replies
                You may not post attachments
                You may not edit your posts

                BB code is On
                Smilies are On
                [IMG] code is On
                HTML code is Off

                Forum Jump


                All times are GMT -8. The time now is 6:31 PM.