Resource icon

[EBS]Cache In-battle Animations to Reduce Lag

Pokémon Essentials Version
v17.2 ✅
Cache In-Battle Animations

Pkmn Essentials v17.2 + EBS



-If you use Pokemon Reborn's Battle Animations files in your game, and you also use the EBS system, you may notice a 1.5 second hang each time the game loads a battle animation. You can remove this lag by caching the animations files.

-First things first, this will obviously only work if you use Pokemon Reborn's animations. So, download the game and copy over two files from the "Data" folder, and paste them inside the "Data" folder of your project.


-PkmnAnimations.rxdata
-Move2anim.dat


-Then, open your script editor within your project.
-Go to your EBS Settings (SJPlugins_Settings), and set

CUSTOMANIMATIONS = false
REPLACEMISSINGANIM = true


-Then, make a new script section above "Main", and paste the following code:

#Animations Cache
class PokemonTemp
attr_accessor :cachePkmnAnims
end

def pbLoadCachedAnimations
$PokemonTemp=PokemonTemp.new if !$PokemonTemp
if !$PokemonTemp.cachePkmnAnims
$PokemonTemp.cachePkmnAnims=load_data("Data/PkmnAnimations.rxdata")
end
return $PokemonTemp.cachePkmnAnims
end



-Then, make another new section and paste this:


#Moves2Anim Cache
class PokemonTemp
attr_accessor :cachePkmnAnims2
end

def pbLoadCachedAnimations2
$PokemonTemp=PokemonTemp.new if !$PokemonTemp
if !$PokemonTemp.cachePkmnAnims2
$PokemonTemp.cachePkmnAnims2=load_data("Data/move2anim.dat")
end
return $PokemonTemp.cachePkmnAnims2
end



-Next, go to PField_Metadata, and go to class PokemonTemp, and add the following to the bottom of the class, under forceSingleBattle:


attr_accessor :cachePkmnAnims
attr_accessor :cachePkmnAnims2


-After you do that, go to PokeBattle_Scene, in the def pbFindAnimation, where move2anim is referenced and replace the line:

move2anim=load_data("Data/move2anim.dat")
with
move2anim=pbLoadCachedAnimations2


-Next, go to the def pbCommonAnimation, and replace the line:

animations=load_data("Data/PkmnAnimations.rxdata")
with
animations=pbLoadCachedAnimations


-Right below in pbAnimation, replace the line:

animations=load_data("Data/PkmnAnimations.rxdata")
with
animations=pbLoadCachedAnimations



Now, in the script section EliteBattle_2 (or Animations Script if it's renamed) under def PbAnimation, below "anim=animid[0]" replace:

animations=load_data("Data/PkmnAnimations.rxdata")
with
animations=pbLoadCachedAnimations


In the script section EliteBattle_7 (), under "if REPLACEMISSINGANIM" right under "anim=animid[0], replace

animations=load_data("Data/PkmnAnimations.rxdata")
with
animations=pbLoadCachedAnimations


Lastly, if you happen to use KleinStudio's Transform Mosaic script, go to the class PokeBattle_Scene's def pbAnimation, under anim=animid[0], replace:

animations=load_data("Data/PkmnAnimations.rxdata")
with
animations=pbLoadCachedAnimations


Once you do all that, you should have lagless battle animations! Let me know if you have any questions!
Credits
Vendily ~Scripting help
Luka S.J. ~EBS
Mde2001 ~Pokemon Reborn Animations
Smeargletail ~Pokemon Reborn Animations
Likes: PB7361
Author
thepsynergist
First release
Last update
Rating
0.00 star(s) 0 ratings

Latest updates

  1. New Game addendum

    I forgot to update the script to cache the animations when you load a new game. Edit the...
Top