PDA

View Full Version : [Essentials script] Update Sprites in battle script for Pokemon Essentials


taimao
May 4th, 2011, 10:40 AM
First off I use the May 2010 version of Pokemon Essentials.

This is the def that I use to update sprites during battle for Pokemon like Castform, Cherim, Darmantian, and any others that change forms in battle. I'm not a great coder so I'm not gonna say this is best way to do it but it is the way I discovered myself and no one had come out with anything else when I coded this.
Place the def pbUpdateSprites after the def pbStartBattle in PokeBattle_ActualScene




def pbUpdateSprites (spriteIndex)
pkmn=@battle.battlers[spriteIndex].pokemon
return if @sprites["pokemon#{spriteIndex}"]==nil
if spriteIndex==0 ||spriteIndex==2
@sprites["pokemon#{spriteIndex}"].setPokemonBitmap(pkmn,true)
else
@sprites["pokemon#{spriteIndex}"].setPokemonBitmap(pkmn,false)
end
@sprites["pokemon#{spriteIndex}"].update
end

of course lets say you want castform's sprite to change so in pbForecast you would use this function call @battle.scene.pbUpdateSprites(@index) in one of the areas where castform's type changes. However, this function must be used in combination with other coding to force the sprite to change. Which will require edits to pbLoadPokemonBitmapSpecies and any other relivant section of code.

Please credit Tai Mao/taimao if you use this script in your project.

Ces soirees-la
May 4th, 2011, 01:33 PM
Thanks for this, it's going to be very useful.