Hey!
So I was looking at Vendily's example here here on how to base alt sprites given a new glitchiness. It is a new thing attached to a pokemon that has all sorts of wacky features. At any rate, I defined them like a shiny pokemon in PokeBattle_Battler as such:
with
defined in def intialize.
In PSystem_FileUtilities, here is the script. I've pasted the relevant script section within the spoiler.
I have a sprite 001_glitch, 001g, for testing and they all return the default one on a glitchy bulbasaur (they have a unique typing so it is easy to tell whether or not they're glitchmons)
So I was looking at Vendily's example here here on how to base alt sprites given a new glitchiness. It is a new thing attached to a pokemon that has all sorts of wacky features. At any rate, I defined them like a shiny pokemon in PokeBattle_Battler as such:
Code:
def isGlitchmon?
return @glitchmon if @glitchmon!=nil
glitx = @glitchnum
return glitx< GLITCHMONCHANCE*($Trainer.numbadges+1)
end
def makeGltichy
@glitchmon=true
end
def makeNotGlitchy
@glitchmon=false
end
with
Code:
@glitchnum = rand(200)
@gltchmon = nil
defined in def intialize.
In PSystem_FileUtilities, here is the script. I've pasted the relevant script section within the spoiler.
Spoiler:
Code:
# Note: Returns an AnimatedBitmap, not a Bitmap
def pbLoadPokemonBitmapSpecies(pokemon,species,back=false)
ret = nil
if pokemon.egg?
bitmapFileName = sprintf("Graphics/Battlers/%segg_%d",getConstantName(PBSpecies,species),pokemon.form) rescue nil
if !pbResolveBitmap(bitmapFileName)
bitmapFileName = sprintf("Graphics/Battlers/%03degg_%d",species,pokemon.form)
if !pbResolveBitmap(bitmapFileName)
bitmapFileName = sprintf("Graphics/Battlers/%segg",getConstantName(PBSpecies,species)) rescue nil
if !pbResolveBitmap(bitmapFileName)
bitmapFileName = sprintf("Graphics/Battlers/%03degg",species)
if !pbResolveBitmap(bitmapFileName)
bitmapFileName = sprintf("Graphics/Battlers/egg")
end
end
end
end
bitmapFileName = pbResolveBitmap(bitmapFileName)
else
bitmapFileName = pbCheckPokemonBitmapFiles([species,back,(pokemon.isFemale?),
pokemon.isShiny?,pokemon.isGlitchmon?,(pokemon.form rescue 0),(pokemon.isShadow? rescue false)])
# Alter bitmap if supported
alterBitmap = (MultipleForms.getFunction(species,"alterBitmap") rescue nil)
end
if bitmapFileName && alterBitmap
animatedBitmap = AnimatedBitmap.new(bitmapFileName)
copiedBitmap = animatedBitmap.copy
animatedBitmap.dispose
copiedBitmap.each {|bitmap| alterBitmap.call(pokemon,bitmap) }
ret = copiedBitmap
elsif bitmapFileName
ret = AnimatedBitmap.new(bitmapFileName)
end
return ret
end
# Note: Returns an AnimatedBitmap, not a Bitmap
def pbLoadSpeciesBitmap(species,female=false,form=0,shiny=false,glitchmon=nil,shadow=false,back=false,egg=false)
ret = nil
if egg
bitmapFileName = sprintf("Graphics/Battlers/%segg_%d",getConstantName(PBSpecies,species),form) rescue nil
if !pbResolveBitmap(bitmapFileName)
bitmapFileName = sprintf("Graphics/Battlers/%03degg_%d",species,form)
if !pbResolveBitmap(bitmapFileName)
bitmapFileName = sprintf("Graphics/Battlers/%segg",getConstantName(PBSpecies,species)) rescue nil
if !pbResolveBitmap(bitmapFileName)
bitmapFileName = sprintf("Graphics/Battlers/%03degg",species)
if !pbResolveBitmap(bitmapFileName)
bitmapFileName = sprintf("Graphics/Battlers/egg")
end
end
end
end
bitmapFileName = pbResolveBitmap(bitmapFileName)
else
bitmapFileName = pbCheckPokemonBitmapFiles([species,back,female,shiny,glitchmon,form,shadow])
end
if bitmapFileName
ret = AnimatedBitmap.new(bitmapFileName)
end
return ret
end
def pbCheckPokemonBitmapFiles(params)
species = params[0]
back = params[1]
factors = []
factors.push([5,params[5],false]) if params[5] && params[5]!=false # shadow
factors.push([2,params[2],false]) if params[2] && params[2]!=false # gender
factors.push([3,params[3],false]) if params[3] && params[3]!=false # shiny
factors.push([6,params[6],false]) if params[6] && params[6]!=false # glitch
factors.push([4,params[4].to_s,""]) if params[4] && params[4].to_s!="" &&
params[4].to_s!="0" # form
tshadow = false
tgender = false
tshiny = false
tglitchmon = false
tform = ""
for i in 0...2**factors.length
for j in 0...factors.length
case factors[j][0]
when 2 # gender
tgender = ((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
when 3 # shiny
tshiny = ((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
when 6 # glitch
tglitchmon = ((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
when 4 # form
tform = ((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
when 5 # shadow
tshadow = ((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
end
end
bitmapFileName = sprintf("Graphics/Battlers/%s%s%s%s%s%s%s",
getConstantName(PBSpecies,species),
(tgender) ? "f" : "",
(tshiny) ? "s" : "",
(back) ? "b" : "",
(tform!="") ? "_"+tform : "",
(tshadow) ? "_shadow" : "",
(tglitchmon) ? "_glitch" : "") rescue nil
ret = pbResolveBitmap(bitmapFileName)
return ret if ret
bitmapFileName = sprintf("Graphics/Battlers/%03d%s%s%s%s%s%s",
species,
(tgender) ? "f" : "",
(tshiny) ? "s" : "",
(back) ? "b" : "",
(tform!="") ? "_"+tform : "",
(tshadow) ? "_shadow" : "",
(tglitchmon) ? "_glitch" : "")
ret = pbResolveBitmap(bitmapFileName)
return ret if ret
end
return nil
end
I have a sprite 001_glitch, 001g, for testing and they all return the default one on a glitchy bulbasaur (they have a unique typing so it is easy to tell whether or not they're glitchmons)
Last edited: