• 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] Elite Battle System + Animation Player

26
Posts
6
Years
    • Seen Dec 19, 2018
    Hi. So recently I've started trying to create my own animations in the animation editor, but creating one for every move is extremely time consuming. I currently have EBS downloaded and working perfectly but I noticed that with script 07 all of the animations overrides the Essentials Animations.

    I want to allow it so it will play the EBS default animations for moves that don't have animations completed in the editor, but will still play animations for moves that are defined. I know it's possible because I've seen other projects use EBS preset move animations as well as custom Essentials Animations for certain moves. Could anyone help me out with this?

    Here's the section that I'm pretty sure is responsible for everything I'm talking about:

    Code:
     class PokeBattle_Scene  
      attr_accessor :animationCount
      #-----------------------------------------------------------------------------
      #  Main animation handling core
      #-----------------------------------------------------------------------------
      def pbAnimation(moveid,user,target,hitnum=0)
        # for hitnum, 1 is the charging animation, 0 is the damage animation
        return if !moveid
        # move information
        movedata = PBMoveData.new(moveid)
        move = PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(moveid))
        numhits = user.thisMoveHits
        multihit = !numhits.nil? ? (numhits > @animationCount) : false
        @animationCount+=1
        if numhits.nil?
          @animationCount=1
        elsif @animationCount > numhits
          @animationCount=1
        end
        multitarget = false
        multitarget = move.target if (move.target==PBTargets::AllOpposing || move.target==PBTargets::AllNonUsers)
        target = user if !target
        # clears the current UI
        clearMessageWindow
        isVisible=[false,false,false,false]
        for i in 0...4
          if @sprites["battlebox#{i}"]
            isVisible[i]=@sprites["battlebox#{i}"].visible
            @sprites["battlebox#{i}"].visible=false
          end
        end
        # Substitute animation
        if @sprites["pokemon#{user.index}"] && @battle.battlescene
          subbed = @sprites["pokemon#{user.index}"].isSub
          self.setSubstitute(user.index,false) if subbed
        end
        # gets move animation def name
        anm = "pbMoveAnimationSpecific"+sprintf("%03d",moveid)
        handled = false
        if @battle.battlescene
          # checks if def for specific move exists, and then plays it
          if !handled && eval("defined?(#{anm})")
            handled = eval("#{anm}(#{user.index},#{target.index},#{hitnum},#{multihit})")
          end
          # in case people want to use the old animation player
          if REPLACEMISSINGANIM && !handled
            animid=pbFindAnimation(moveid,user.index,hitnum)
            return if !animid
            anim=animid[0]
            animations=load_data("Data/PkmnAnimations.rxdata")
            name=PBMoves.getName(moveid)
            pbSaveShadows {
               if animid[1] # On opposing side and using OppMove animation
                 pbAnimationCore(animations[anim],target,user,true,name)
               else         # On player's side, and/or using Move animation
                 pbAnimationCore(animations[anim],user,target,false,name)
               end
            }
            handled = true
          end
          # decides which global move animation to play, if any
          if !handled
            handled = playGlobalMoveAnimation(move.type,user.index,target.index,multitarget,multihit,movedata.category,hitnum)
          end
          # if all above failed, plays the move animation for Tackle
          if !handled
            pbMoveAnimationSpecific303(user.index,target.index,0,multihit)
          end
        end
        # Change form to transformed version
        if PBMoveData.new(moveid).function==0x69 && user && target # Transform
          pbChangePokemon(user,target.pokemon)
        end
        # restores cleared UI
        for i in 0...4
          if @sprites["battlebox#{i}"]
            @sprites["battlebox#{i}"].visible=true if isVisible[i]
          end
        end
        self.afterAnim = true
      end
     
    Last edited:
    26
    Posts
    6
    Years
    • Seen Dec 19, 2018
    Ok so with a lot of help from Vendily I was able to figure out how to accomplish using global EBS animations + custom Essentials animations. It's a bit more complicated than just switching a setting around.

    First off, go to the "Settings" script and scroll towards the bottom where you will find this part

    Code:
    # set this to true to use animations from the Animation editor for missing move animations
    REPLACEMISSINGANIM = false

    Set that to "true". Now it will play missing moves that are not already defined in the EBS script, but it still wont play EBS global move animations, and will instead play Essential's default global animations. I'm not sure if older versions of Essentials didn't have this and EBS hasn't been updated to take that into consideration, but that was definitely the case for me, and this was with a recently downloaded version of EBS + with PokeBattle_Scene being untouched. To fix this, you have to do two things.

    First go to PokeBattle_Scene and find where it says:
    Code:
    if isConst?(type,PBTypes,i[0]) && hasConst?(PBMoves,i[1])
    Next paste this directly under it

    Code:
    return nil
              break
            end
          end
          #noflip=false
              #if (userIndex&1)==0   # On player's side
                #anim=move2anim[0][getConst(PBMoves,i[1])]
              #else                  # On opposing side
                #anim=move2anim[1][getConst(PBMoves,i[1])]
                #noflip=true if anim
                #anim=move2anim[0][getConst(PBMoves,i[1])] if !anim
              #end
              #return [anim,noflip] if anim
              #break
            #end
          #end
          #Default animation for the move's type not found, use Tackle's animation
          #if hasConst?(PBMoves,:TACKLE)
            #anim=move2anim[0][getConst(PBMoves,:TACKLE)]
            #return [anim,false] if anim
          #end
        rescue
          return nil
        end
        return nil
      end

    This comments out the unneeded sections as well as forcing the defaultanim player to return nil. This should keep the Essentials defaultanim from playing. Lastly go to the EliteBattle_7 script and find this line:
    Code:
    return if !animid
    This is usually located on line 73. Simply replace it with this:

    Code:
    if animid

    Also make sure to add another "end" above the line that says " # decides which global move animation to play, if any"

    And now you should be able to use EBS global animations, EBS defined move animations, AND your own move animations made in the animation editor for moves that are undefined. I hope this helps other people who were experiencing this same issue but wanted to get the most out of EBS move animation script without having to resort to learning how to script all your moves via EBS, or using the boring global animations for Essentials.
     
    Last edited:
    9
    Posts
    3
    Years
    • Seen Jun 10, 2023
    I tried doing what you said but it did not work. (kept getting errors) It could possibly be because I am viewing this 2 years after it is posted. Can someone give an update on how to do it. /:
     
    9
    Posts
    3
    Years
    • Seen Jun 10, 2023
    Please post the errors.

    The 2 main issues
    1. It kept telling me syntax error on the line that I put "return if !animid" in.
    2. Not really an error but I could not find the correct place to put the "end". TheGary said to put it above " # decides which global move animation to play, if any" however I could not finds that in my script.
    Can you show me an image or something of the new code so I can compare it with mine?
     
    233
    Posts
    5
    Years
    • Seen Oct 9, 2023
    Oh I've never actually used this script before, I just asked specifically for the error message because that's always more helpful than "I got some errors". In any case, I poked around and I think I know what the issue is for newer EBS versions: all the EBS scripts (except for EBS settings) are located in this file: Data/Plugins/EBS4.rxdata. In the past, this file didn't exist because you had to install the scripts on your own, but now they are sort of "hidden" away to make installation easier. You need to extract these scripts into your project by doing the following steps:

    1. Make a new blank project (just temporarily).
    2. The new project will have a file called Scripts.rxdata located in the Data folder - replace it with EBS4.rxdata and rename that to Scripts.rxdata.
    3. Open the new project, then open the Script Editor. If done correctly, you should now ONLY see EBS scripts 0-7 in the editor.
    4. Open your current project, then copy EBS scripts 0-7 from the new project into your current (make sure it's between Compiler and Main).
    5. Delete the temporary project you made, and go back to your current project. Also delete or comment out this line: "File.runScript("Data/Plugins/EBS4.rxdata")".
    6. You can also delete EBS4.rxdata from your project now, it's not doing to do anything since you've extracted the scripts into your main script editor.
    7. You said you replaced "return if !animid" with "if animid" as per the instructions above, however you didn't do it in the correct section. You edited the line in PokeBattle_Scene, but what you ACTUALLY need to edit is in EliteBattle_7.
    8. The comment that you need to place an "end" above is also in EliteBattle_7.

    I hope all these instructions are clear! I haven't tested this out myself, but if you've followed Gary's other instructions from above correctly then I think that should be it.
     
    Back
    Top