The PokéCommunity Forums Fan Games Game Development Scripts & Tutorials
Essentials Script Evo During Battle

Scripts & Tutorials 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 10th, 2017 (6:34 PM). Edited August 14th, 2017 by Zeak6464.
Zeak6464's Avatar
Zeak6464 Zeak6464 is offline
Zeak #3205 - Discord
     
    Join Date: Mar 2013
    Location: USA
    Age: 25
    Gender: Male
    Nature: Calm
    Posts: 550

    Place on Line 2050, PokeBattle_Battle, end of def pbGainExpOne or find "# Finding all moves learned at this level" after the 2nd end

    Make sure to put this code outside of a method.
    Code:
    def name=(value)
        @name=value
      end
    Code:
             # Finding all moves learned at this level
              movelist=thispoke.getMoveList
              for k in movelist
                if k[0]==thispoke.level   # Learned a new move
                  pbLearnMove(index,k[1])
                end
              end
    #Evo During Battle
    newspecies=pbCheckEvolution(thispoke)#edit
              if newspecies>0
                pbFadeOutInWithMusic(99999){
                evo=PokemonEvolutionScene.new
                evo.pbStartScreen(thispoke,newspecies)
                evo.pbEvolution
                evo.pbEndScreen
                if battler
                  @scene.pbChangePokemon(@battlers[battler.index],@battlers[battler.index].pokemon)
                  battler.name=thispoke.name
                end
              }
              end
    Credit:
    Vendily
    Reply With Quote
      #2    
    Old August 12th, 2017 (2:14 AM).
    Marin's Avatar
    Marin Marin is offline
    Not Bored
     
    Join Date: Nov 2016
    Age: 16
    Gender: Other
    Posts: 761
    The name hasn't updated after evolution.
    Reply With Quote
      #3    
    Old August 12th, 2017 (6:17 PM).
    Zeak6464's Avatar
    Zeak6464 Zeak6464 is offline
    Zeak #3205 - Discord
       
      Join Date: Mar 2013
      Location: USA
      Age: 25
      Gender: Male
      Nature: Calm
      Posts: 550
      Quote:
      Originally Posted by M3rein View Post
      The name hasn't updated after evolution.
      fixed !
      Reply With Quote
        #4    
      Old August 13th, 2017 (7:55 PM). Edited August 14th, 2017 by sonicfan7895.
      sonicfan7895's Avatar
      sonicfan7895 sonicfan7895 is offline
      Lead Programmer and Composer
         
        Join Date: Dec 2010
        Location: Akala Island, Alola
        Age: 21
        Gender: Male
        Nature: Serious
        Posts: 96
        It works for the most part, but then after the evolution sequence happens, I get an error, and the Pokemon that evolved gained even more experience. Here's how the code appears in my game:

        Click here to see.

        So, what should I do? I set it so it's after the second "end"...
        __________________
        Check out my band: Sliver!
        On Facebook
        Reply With Quote
          #5    
        Old August 14th, 2017 (4:40 PM).
        Vendily's Avatar
        Vendily Vendily is offline
           
          Join Date: Aug 2015
          Gender: Female
          Nature: Calm
          Posts: 771
          Did you also add the bit for the def name=?
          Code:
          class PokeBattle_Battler
            def name=(value)
              @name=value
            end
          end
          put this outside of any class or method. OR put just this:
          Code:
            def name=(value)
              @name=value
            end
          in script section PokeBattle_Battler inside the class (preferably underneath def name, but that's just for organization)

          I would have liked to see the error though, as that's the only error I got while making it.
          __________________
          Resources for ROM hackers has moved.

          Reply With Quote
            #6    
          Old August 14th, 2017 (5:21 PM).
          sonicfan7895's Avatar
          sonicfan7895 sonicfan7895 is offline
          Lead Programmer and Composer
             
            Join Date: Dec 2010
            Location: Akala Island, Alola
            Age: 21
            Gender: Male
            Nature: Serious
            Posts: 96
            Well I'll be... It worked! Sorry about that.

            The OP should be edited so other people can know that the code that can be put in PokeBattle_Battler works too. If you would still like to see the error anyway, I can edit this post so you can get a better idea of what people should be doing
            __________________
            Check out my band: Sliver!
            On Facebook
            Reply With Quote
              #7    
            Old August 29th, 2017 (7:19 AM). Edited August 29th, 2017 by Berkin.
            Berkin's Avatar
            Berkin Berkin is offline
               
              Join Date: Jul 2016
              Location: The Netherlands
              Gender: Male
              Nature: Brave
              Posts: 123
              Can you help me? What do you mean with outside a method?
              __________________
              Founder of Red Marble Studios

              Reply With Quote
                #8    
              Old August 29th, 2017 (6:23 PM).
              Vendily's Avatar
              Vendily Vendily is offline
                 
                Join Date: Aug 2015
                Gender: Female
                Nature: Calm
                Posts: 771
                Quote:
                Originally Posted by Berkin View Post
                Can you help me? What do you mean with outside a method?
                As in don't do this:
                Code:
                def randomMethod
                  #code
                  def name=(value)
                    @name=value
                  end
                end
                method in method.
                __________________
                Resources for ROM hackers has moved.

                Reply With Quote
                  #9    
                Old August 30th, 2017 (10:29 AM).
                Berkin's Avatar
                Berkin Berkin is offline
                   
                  Join Date: Jul 2016
                  Location: The Netherlands
                  Gender: Male
                  Nature: Brave
                  Posts: 123
                  Could you pls send me a screenshot of how your scripts are placed I have no idea where to put them.
                  __________________
                  Founder of Red Marble Studios

                  Reply With Quote
                    #10    
                  Old August 30th, 2017 (4:59 PM).
                  Vendily's Avatar
                  Vendily Vendily is offline
                     
                    Join Date: Aug 2015
                    Gender: Female
                    Nature: Calm
                    Posts: 771
                    Quote:
                    Originally Posted by Berkin View Post
                    Could you pls send me a screenshot of how your scripts are placed I have no idea where to put them.
                    PokeBattle_Battler:

                    PokeBattle_Battle:
                    __________________
                    Resources for ROM hackers has moved.

                    Reply With Quote
                      #11    
                    Old August 31st, 2017 (5:14 AM).
                    Berkin's Avatar
                    Berkin Berkin is offline
                       
                      Join Date: Jul 2016
                      Location: The Netherlands
                      Gender: Male
                      Nature: Brave
                      Posts: 123
                      omg it works THANK YOU SO MUCH. IT HAS BEEN MY DREAM TO MAKE POKEMON EVOLVE DURING BATTLES THANK YOU
                      __________________
                      Founder of Red Marble Studios

                      Reply With Quote
                        #12    
                      Old November 16th, 2017 (3:35 PM).
                      tutoriando's Avatar
                      tutoriando tutoriando is offline
                      Manoel Afonso
                         
                        Join Date: Aug 2017
                        Location: Porto Alegre, Brasil
                        Gender: Male
                        Nature: Docile
                        Posts: 16
                        WOOOOOOW very nice, I'will install NOW!!
                        __________________
                        My game fanpage: http://fb.com/PKMDimensions

                        Pokémon Dimensions is a fan game that proposes to bring several different dimensions in a single game. Explore Pokémon World, win the challenges of Digimon World, discover a wonderful story with Monster Rancher, and many other universes!
                        Reply With Quote
                          #13    
                        Old November 29th, 2017 (10:30 AM).
                        AngelsAdvent77's Avatar
                        AngelsAdvent77 AngelsAdvent77 is offline
                           
                          Join Date: Apr 2016
                          Gender: Other
                          Posts: 128
                          I am getting this error for this script:
                          Quote:
                          Exception: NoMethodError
                          Message: undefined method `addUserAnimation' for nil:NilClass
                          Follower:304:in `refresh_sprite'
                          Follower:303:in `each'
                          Follower:303:in `refresh_sprite'
                          Pokemon_Evolution:782:in `follow_pbEndScreen'
                          Follower:1517:in `pbEndScreen'
                          PokeBattle_Battle:2133:in `pbGainExpOne'
                          PokeBattle_Battle:2129:in `pbFadeOutInWithMusic'
                          PSystem_Utilities:884:in `pbFadeOutIn'
                          PSystem_Utilities:884:in `pbFadeOutInWithMusic'
                          PokeBattle_Battle:2129:in `pbGainExpOne'
                          How can I solve this? Thanks!
                          Reply With Quote
                            #14    
                          Old November 30th, 2017 (5:31 AM).
                          Vendily's Avatar
                          Vendily Vendily is offline
                             
                            Join Date: Aug 2015
                            Gender: Female
                            Nature: Calm
                            Posts: 771
                            Quote:
                            Originally Posted by AngelsAdvent77 View Post
                            I am getting this error for this script:

                            How can I solve this? Thanks!
                            Are you sure that this script is the cause of the error?
                            Your error refers to a nil value, specifically of the $scene.spritesheet variable.
                            What version of essentials are you on? I created and tested this on v16.2, but never checked v17+, so it is possible that broke it.
                            I also did not test this modification with any other scripts, so it still may be my fault.
                            Granted, I'm not on a device that has RMXP so I can't test anything right now.
                            __________________
                            Resources for ROM hackers has moved.

                            Reply With Quote
                              #15    
                            Old November 30th, 2017 (2:56 PM).
                            etique etique is offline
                            etique
                               
                              Join Date: Nov 2017
                              Posts: 56
                              "Place on Line 2050, PokeBattle_Battle, end of def pbGainExpOne or find "# Finding all moves learned at this level" after the 2nd end"
                              I can not understand, could I have the PokeBattle_Battler already with this script ??
                              Reply With Quote
                                #16    
                              Old December 2nd, 2017 (11:08 PM).
                              AngelsAdvent77's Avatar
                              AngelsAdvent77 AngelsAdvent77 is offline
                                 
                                Join Date: Apr 2016
                                Gender: Other
                                Posts: 128
                                Quote:
                                Originally Posted by Vendily View Post
                                Are you sure that this script is the cause of the error?
                                Your error refers to a nil value, specifically of the $scene.spritesheet variable.
                                What version of essentials are you on? I created and tested this on v16.2, but never checked v17+, so it is possible that broke it.
                                I also did not test this modification with any other scripts, so it still may be my fault.
                                Granted, I'm not on a device that has RMXP so I can't test anything right now.
                                Hi, thank you for your response!

                                I'm not sure if this script is the "cause" of the error, but seeing how every evolution that happens in battle leads to it, there must be something conflicting with this script (I have a good amount of other custom scripts).

                                What happens after the error message appears is that the battle music goes MUTE. The error does NOT crash the game, but there's no more music until the battle ends.

                                I'm using 16.2 btw.

                                For possible conflicting scripts, would it just be the ones the error message has listed?
                                Like . . . . Follower, Pokemon_Evolution, PokeBattle_Battle, PSystem_Utilities and no other possible scripts?
                                Reply With Quote
                                  #17    
                                Old December 3rd, 2017 (7:42 AM).
                                Vendily's Avatar
                                Vendily Vendily is offline
                                   
                                  Join Date: Aug 2015
                                  Gender: Female
                                  Nature: Calm
                                  Posts: 771
                                  Quote:
                                  Originally Posted by AngelsAdvent77 View Post
                                  Hi, thank you for your response!

                                  I'm not sure if this script is the "cause" of the error, but seeing how every evolution that happens in battle leads to it, there must be something conflicting with this script (I have a good amount of other custom scripts).

                                  What happens after the error message appears is that the battle music goes MUTE. The error does NOT crash the game, but there's no more music until the battle ends.

                                  I'm using 16.2 btw.

                                  For possible conflicting scripts, would it just be the ones the error message has listed?
                                  Like . . . . Follower, Pokemon_Evolution, PokeBattle_Battle, PSystem_Utilities and no other possible scripts?
                                  It's not necessarily all of the scripts in the stacktrace are conflicting, though following the stack down through the code manually helps to figure out the problem.
                                  Like before, I just checked to see the final result of the error, the nil spritesets, but looking back further, the conflict is with the aliased pbEndScreen in the follower script. What it does, is after evolution, it tries to refresh the sprites the following pokemon if the pokemon that evolved is the first in the party. This normally works just fine and dandy since pokemon only evolve if they are on the overworld. But since this script allows evolution in battle, if your first party member evolves, this error occurs, because starting a battle destroys all spritesets. Adding a nil check should fix it.
                                  Code:
                                    def pbEndScreen
                                      follow_pbEndScreen
                                      if $scene.spriteset && @pokemon==$Trainer.party[0]
                                        $PokemonTemp.dependentEvents.refresh_sprite(false)
                                      end
                                    end
                                  Mind you that I haven't gotten the chance to test this (I'm stealing time from irl stuff), but in theory it would work.
                                  __________________
                                  Resources for ROM hackers has moved.

                                  Reply With Quote
                                    #18    
                                  Old December 4th, 2017 (6:23 PM).
                                  AngelsAdvent77's Avatar
                                  AngelsAdvent77 AngelsAdvent77 is offline
                                     
                                    Join Date: Apr 2016
                                    Gender: Other
                                    Posts: 128
                                    Code:
                                      def pbEndScreen
                                        follow_pbEndScreen
                                        if $scene.spriteset && @pokemon==$Trainer.party[0]
                                          $PokemonTemp.dependentEvents.refresh_sprite(false)
                                        end
                                      end
                                    Sorry, but where exactly do I add that code? I tried adding it to various scripts being Battler, PokeBattle, Follower, and Evolution scripts. However, it still gives the same error for any of those scripts I try.

                                    I'd also like to note that the error occurs for any Pokemon in the party. For example, I just tested it with a Lycanroc first in the party with a Caterpie and Weedle as other members. The 2 Bug Pokemon evolved without ever being sent out to battle, but the errors still pop up every time.

                                    Another question is, is it possible for another script to conflict with this process that is NOT mentioned in the error message ?
                                    Reply With Quote
                                      #19    
                                    Old September 2nd, 2018 (10:36 PM).
                                    Rumery Rumery is offline
                                       
                                      Join Date: Jul 2018
                                      Posts: 6
                                      What program are you guys using? to view that script
                                      Reply With Quote
                                        #20    
                                      Old September 3rd, 2018 (12:20 PM).
                                      Venomous_Zero86's Avatar
                                      Venomous_Zero86 Venomous_Zero86 is offline
                                      Pokemon Chosen Ones (Coming Soon)
                                         
                                        Join Date: Mar 2016
                                        Gender: Male
                                        Posts: 108
                                        is there a way to make it if the pokemon is holding it evolutionary item it will evole with it using the item
                                        __________________
                                        Whatever you do in this life, it's not legendary unless your friends are there to see it. -Barney Stinson
                                        Reply With Quote
                                          #21    
                                        Old September 3rd, 2018 (12:23 PM).
                                        Venomous_Zero86's Avatar
                                        Venomous_Zero86 Venomous_Zero86 is offline
                                        Pokemon Chosen Ones (Coming Soon)
                                           
                                          Join Date: Mar 2016
                                          Gender: Male
                                          Posts: 108
                                          Quote:
                                          Originally Posted by Vendily View Post
                                          PokeBattle_Battler:

                                          PokeBattle_Battle:
                                          is there a way to make it if the pokemon is holding it evolutionary item it will evole with it using the item
                                          Reply With Quote
                                            #22    
                                          Old September 3rd, 2018 (3:07 PM).
                                          Vendily's Avatar
                                          Vendily Vendily is offline
                                             
                                            Join Date: Aug 2015
                                            Gender: Female
                                            Nature: Calm
                                            Posts: 771
                                            Quote:
                                            Originally Posted by Venomous_Zero86 View Post
                                            is there a way to make it if the pokemon is holding it evolutionary item it will evole with it using the item
                                            Given the fact that my script uses pbCheckEvolution, it should already take into account held items, as seen in pbMiniCheckEvolution, the checking method that is fed the evolution data. There shouldn't be a need to manually add the feature. Do you have a specific example of a pokemon failing to evolve with a held item?
                                            Or are you asking to add in evolutionary stones being able to evolve in battle?
                                            __________________
                                            Resources for ROM hackers has moved.

                                            Reply With Quote
                                              #23    
                                            Old September 3rd, 2018 (3:11 PM).
                                            Venomous_Zero86's Avatar
                                            Venomous_Zero86 Venomous_Zero86 is offline
                                            Pokemon Chosen Ones (Coming Soon)
                                               
                                              Join Date: Mar 2016
                                              Gender: Male
                                              Posts: 108
                                              Quote:
                                              Originally Posted by Vendily View Post
                                              Given the fact that my script uses pbCheckEvolution, it should already take into account held items, as seen in pbMiniCheckEvolution, the checking method that is fed the evolution data. There shouldn't be a need to manually add the feature. Do you have a specific example of a pokemon failing to evolve with a held item?
                                              Or are you asking to add in evolutionary stones being able to evolve in battle?
                                              asking to add in evolutionary stones being able to evolve in battle
                                              Reply With Quote
                                                #24    
                                              Old September 3rd, 2018 (4:07 PM).
                                              Vendily's Avatar
                                              Vendily Vendily is offline
                                                 
                                                Join Date: Aug 2015
                                                Gender: Female
                                                Nature: Calm
                                                Posts: 771
                                                Quote:
                                                Originally Posted by Venomous_Zero86 View Post
                                                asking to add in evolutionary stones being able to evolve in battle
                                                Looking around, you just need to add an item handler for BattleUseOnPokemon, then set the evo stones to be able to be used on a pokemon, like a potion.

                                                Code:
                                                ItemHandlers::BattleUseOnPokemon.addIf(proc{|item| pbIsEvolutionStone?(item)},
                                                   proc{|item,pokemon,battler,scene|
                                                     if (pokemon.isShadow? rescue false)
                                                       scene.pbDisplay(_INTL("It won't have any effect."))
                                                       next false
                                                     end
                                                     newspecies=pbCheckEvolution(pokemon,item)
                                                     if newspecies<=0
                                                       scene.pbDisplay(_INTL("It won't have any effect."))
                                                       next false
                                                     else
                                                       pbFadeOutInWithMusic(99999){
                                                          evo=PokemonEvolutionScene.new
                                                          evo.pbStartScreen(pokemon,newspecies)
                                                          evo.pbEvolution(false)
                                                          evo.pbEndScreen
                                                          if battler
                                                              scene.pbChangePokemon(battler,battler.pokemon)
                                                              battler.name=pokemon.name
                                                          end
                                                       }
                                                       next true
                                                     end
                                                })
                                                Toss this in PItem_ItemEffects, give your evo stones in battle useability, and bam, evo stones in battle.
                                                Mind you I only tested this on v17.2.
                                                __________________
                                                Resources for ROM hackers has moved.

                                                Reply With Quote
                                                  #25    
                                                Old September 4th, 2018 (3:07 AM).
                                                Venomous_Zero86's Avatar
                                                Venomous_Zero86 Venomous_Zero86 is offline
                                                Pokemon Chosen Ones (Coming Soon)
                                                   
                                                  Join Date: Mar 2016
                                                  Gender: Male
                                                  Posts: 108
                                                  Quote:
                                                  Originally Posted by Vendily View Post
                                                  Looking around, you just need to add an item handler for BattleUseOnPokemon, then set the evo stones to be able to be used on a pokemon, like a potion.

                                                  Code:
                                                  ItemHandlers::BattleUseOnPokemon.addIf(proc{|item| pbIsEvolutionStone?(item)},
                                                     proc{|item,pokemon,battler,scene|
                                                       if (pokemon.isShadow? rescue false)
                                                         scene.pbDisplay(_INTL("It won't have any effect."))
                                                         next false
                                                       end
                                                       newspecies=pbCheckEvolution(pokemon,item)
                                                       if newspecies<=0
                                                         scene.pbDisplay(_INTL("It won't have any effect."))
                                                         next false
                                                       else
                                                         pbFadeOutInWithMusic(99999){
                                                            evo=PokemonEvolutionScene.new
                                                            evo.pbStartScreen(pokemon,newspecies)
                                                            evo.pbEvolution(false)
                                                            evo.pbEndScreen
                                                            if battler
                                                                scene.pbChangePokemon(battler,battler.pokemon)
                                                                battler.name=pokemon.name
                                                            end
                                                         }
                                                         next true
                                                       end
                                                  })
                                                  Toss this in PItem_ItemEffects, give your evo stones in battle useability, and bam, evo stones in battle.
                                                  Mind you I only tested this on v17.2.

                                                  thank so much ill try this when i get home
                                                  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 9:11 AM.