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
The Cold Guy
     
    Join Date: Mar 2013
    Location: USA
    Age: 25
    Gender: Male
    Nature: Calm
    Posts: 579

    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

    Relevant Advertising!

      #2    
    Old August 12th, 2017 (2:14 AM).
    Marin's Avatar
    Marin Marin is offline
    Not Bored
     
    Join Date: Nov 2016
    Location: The Netherlands
    Gender: Male
    Nature: Bashful
    Posts: 617
    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
    The Cold Guy
       
      Join Date: Mar 2013
      Location: USA
      Age: 25
      Gender: Male
      Nature: Calm
      Posts: 579
      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: 20
        Gender: Male
        Nature: Serious
        Posts: 91
        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 online now
           
          Join Date: Aug 2015
          Gender: Female
          Nature: Calm
          Posts: 749
          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: 20
            Gender: Male
            Nature: Serious
            Posts: 91
            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?
              __________________
              Friendcode: 1349-9203-3458
              Friend safari Type: Dragon
              Flaxure, Dragonair, Druddigon

              Stay Cool.

              Reply With Quote
                #8    
              Old August 29th, 2017 (6:23 PM).
              Vendily's Avatar
              Vendily Vendily is online now
                 
                Join Date: Aug 2015
                Gender: Female
                Nature: Calm
                Posts: 749
                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.
                  __________________
                  Friendcode: 1349-9203-3458
                  Friend safari Type: Dragon
                  Flaxure, Dragonair, Druddigon

                  Stay Cool.

                  Reply With Quote
                    #10    
                  Old August 30th, 2017 (4:59 PM).
                  Vendily's Avatar
                  Vendily Vendily is online now
                     
                    Join Date: Aug 2015
                    Gender: Female
                    Nature: Calm
                    Posts: 749
                    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
                      __________________
                      Friendcode: 1349-9203-3458
                      Friend safari Type: Dragon
                      Flaxure, Dragonair, Druddigon

                      Stay Cool.

                      Reply With Quote
                        #12    
                      Old November 16th, 2017 (3:35 PM).
                      tutoriando tutoriando is offline
                         
                        Join Date: Aug 2017
                        Location: Porto Alegre, Brasil
                        Gender: Male
                        Nature: Docile
                        Posts: 5
                        WOOOOOOW very nice, I'will install NOW!!
                        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: 123
                          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 online now
                             
                            Join Date: Aug 2015
                            Gender: Female
                            Nature: Calm
                            Posts: 749
                            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: 7
                              "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: 123
                                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 online now
                                   
                                  Join Date: Aug 2015
                                  Gender: Female
                                  Nature: Calm
                                  Posts: 749
                                  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: 123
                                    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
                                    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

                                    Sponsored Links
                                    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:02 PM.