As featured in my Fangame, Pokemon Cycle Version, I've made a new type of pokemon called Glitch pokemon.
The sprites I created for them is here: https://www.pokecommunity.com/threads/420497
They have:
1/256 chance of spawning in the wild OR IN a trainer battle, with their chance increasing up to almost 1/8 with each gym badge collected
Randomized base stats
Their second type is Glitch
Moves used against the pokemon with the Glitch type will have random effectiveness multiplier
- there is a 1/3 chance of rolling x2 SE multiplier, 1/3 chance for a x1 multiplier, a 2/9 chance for a x1/2 multiplier, and a 1/9 for a x0 multiplier
- so... if I have a Glitch Groudon, for instance. It will be ground + glitch meaning its multipliers for electric moves used against it (0 * [0,1,2,4])
- if I have a Glitch Helipotile (Normal/electric base pokemon) it will be normal + Glitch, etc
You cannot Capture glitchmons
They have their own unique battling sprites
- simply attach _glitch on their sprites
- their cry's pitch has been randomized to be 10% to 60% of their natural pitch
Credit is required to Juliorain
Special Thanks to: Vendily, Nuri Yuri, Maruno
To install,
You need to install Marin's Scripting Utilities first
In your settings script find:
and add under POKERUSCHANCE
Then in types.txt make a new glitch type LEAVING ALL effectiveness entries blank!
Then simply create a new script section above main, copy and paste:
Alternatively, you can add/replace the code in each relevant section (which requires a ton of work, but to have this script compatible with, say, other types of unique pokemon types, then you'll have to add everying method by methd.
The sprites I created for them is here: https://www.pokecommunity.com/threads/420497
They have:
1/256 chance of spawning in the wild OR IN a trainer battle, with their chance increasing up to almost 1/8 with each gym badge collected
Randomized base stats
Their second type is Glitch
Moves used against the pokemon with the Glitch type will have random effectiveness multiplier
- there is a 1/3 chance of rolling x2 SE multiplier, 1/3 chance for a x1 multiplier, a 2/9 chance for a x1/2 multiplier, and a 1/9 for a x0 multiplier
- so... if I have a Glitch Groudon, for instance. It will be ground + glitch meaning its multipliers for electric moves used against it (0 * [0,1,2,4])
- if I have a Glitch Helipotile (Normal/electric base pokemon) it will be normal + Glitch, etc
You cannot Capture glitchmons
They have their own unique battling sprites
- simply attach _glitch on their sprites
- their cry's pitch has been randomized to be 10% to 60% of their natural pitch
Credit is required to Juliorain
Special Thanks to: Vendily, Nuri Yuri, Maruno
To install,
You need to install Marin's Scripting Utilities first
In your settings script find:
Code:
MAXIMUMLEVEL = 100
EGGINITIALLEVEL = 1
SHINYPOKEMONCHANCE = 8
POKERUSCHANCE = 3
and add under POKERUSCHANCE
Code:
GLITCHMONCHANCE = 1
Then in types.txt make a new glitch type LEAVING ALL effectiveness entries blank!
Then simply create a new script section above main, copy and paste:
Alternatively, you can add/replace the code in each relevant section (which requires a ton of work, but to have this script compatible with, say, other types of unique pokemon types, then you'll have to add everying method by methd.
Spoiler:
Code:
class PokeBattle_Pokemon
attr_accessor(:glitchmon)
################################################################################
# Glitchiness
################################################################################
# Returns whether this Pokémon is a glitchmon meaning they have random stats (apart
#from HP, has a the GLITCH type as its secondary: GLITCH Type has 1/3 chance to be
#super effective, 1/3 to be neutral, 2/9 to be 0.5x and 1/0 to be immune.
#They have unique sprites.
def isGlitchmon?
return @glitchmon if @glitchmon!=nil
glitx = @glitchnum
return glitx< GLITCHMONCHANCE*($Trainer.numbadges+1)
end
def makeGlitchy
@glitchmon=true
end
def makeNotGlitchy
@glitchmon=false
end
def isBoss?
return @boss if @boss!=nil
end
def makeBoss
@boss=true
end
################################################################################
# Types
################################################################################
# Returns whether this Pokémon has the specified type.
def hasType?(type)
if type.is_a?(String) || type.is_a?(Symbol)
return isConst?(self.type1,PBTypes,type) || isConst?(self.type2,PBTypes,type)
else
return self.type1==type || self.type2==type
end
end
# Returns this Pokémon's first type.
def type1
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,self.fSpecies,8)
ret=dexdata.fgetb
dexdata.close
return ret
end
# Returns this Pokémon's second type.
def type2
if self.isGlitchmon?
ret=getID(PBTypes,:GLITCH)
else
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,self.fSpecies,9)
ret=dexdata.fgetb
dexdata.close
end
return ret
end
def baseStats
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,self.fSpecies,10)
if self.isGlitchmon?
if !@glitchstats
@glitchstats=[
dexdata.fgetb,
rand(5..32)*5,
rand(5..32)*5,
rand(5..32)*5,
rand(5..32)*5,
rand(5..32)*5,
]
end
[email protected]
else
ret=[
dexdata.fgetb, # HP
dexdata.fgetb, # Attack
dexdata.fgetb, # Defense
dexdata.fgetb, # Speed
dexdata.fgetb, # Special Attack
dexdata.fgetb # Special Defense
]
end
dexdata.close
return ret
end
# Recalculates this Pokémon's stats.
def calcStats
nature=self.nature
stats=[]
pvalues=[100,100,100,100,100]
nd5=(nature/5).floor
nm5=(nature%5).floor
if nd5!=nm5
pvalues[nd5]=110
pvalues[nm5]=90
end
level=self.level
bs=self.baseStats
for i in 0..5
base=bs[i]
if i==PBStats::HP
stats[i]=calcHP(base,level,@iv[i],@ev[i])
else
stats[i]=calcStat(base,level,@iv[i],@ev[i],pvalues[i-1])
end
end
diff=@totalhp-@hp
@totalhp=stats[0]
@glitchstats = nil
@hp=@totalhp-diff
@hp=0 if @hp<=0
@hp=@totalhp if @hp>@totalhp
@attack=stats[1]
@defense=stats[2]
@speed=stats[3]
@spatk=stats[4]
@spdef=stats[5]
end
alias __glitch_initialize initialize
def initialize(*args)
__glitch_initialize(*args)
@glitchnum = rand(256)
@glitchmon = nil
@boss = nil
end
end
##############################################################################
# Programs the Random Type Effectiveness of the Glitch Type #
##############################################################################
class PBTypes
def PBTypes.getEffectiveness(attackType,opponentType)
return 2 if !opponentType || opponentType<0
return [0,1,1,2,2,2,4,4,4][rand(9)] if opponentType.isConst?(opponentType,PBTypes,:GLITCH)
return PBTypes.loadTypeData()[2][attackType*(PBTypes.maxValue+1)+opponentType]
end
end
##############################################################################
# Displays the pokemon's glitch sprite using dexnumfsb_form index_glitch #
##############################################################################
def pbLoadPokemonBitmap(pokemon,back=false)
return pbLoadPokemonBitmapSpecies(pokemon,pokemon.species,back)
end
# 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.form rescue 0),(pokemon.isShadow? rescue false),pokemon.isGlitchmon?])
# 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=false,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,form,shadow,glitchmon])
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
#===============================================================================
# Load/play Pokémon cry files
#===============================================================================
def pbPlayCry(pokemon, volume = 90, pitch = nil)
return if !pokemon
if pokemon.is_a?(Numeric)
pbPlayCrySpecies(pokemon, 0, volume, pitch)
else
pbPlayCryPokemon(pokemon, volume, pitch)
end
end
def pbPlayCryPokemon(pokemon, volume = 90, pitch = nil)
return if pokemon.egg?
if pokemon.respond_to?(:chatter) && pokemon.chatter
pokemon.chatter.play
else
pkmnwav = pbCryFile(pokemon)
pitch ||= ((pokemon.hp * 25/ pokemon.totalhp) + 75)
pitch = (pitch * rand(10..60) / 100) if pokemon.isGlitchmon?
if pkmnwav
pbSEPlay(RPG::AudioFile.new(pkmnwav, volume, pitch)) rescue nil
end
end
end
def pbCryFile(pokemon,form=0)
return nil if !pokemon
if pokemon.is_a?(String) || pokemon.is_a?(Symbol)
pokemon = getID(PBSpecies,pokemon)
end
if pokemon.is_a?(Numeric)
filename = sprintf("Cries/%sCry_%d",getConstantName(PBSpecies,pokemon),form) rescue nil
if !pbResolveAudioSE(filename)
filename = sprintf("Cries/%03dCry_%d",pokemon,form)
if !pbResolveAudioSE(filename)
filename = sprintf("Cries/%sCry",getConstantName(PBSpecies,pokemon)) rescue nil
if !pbResolveAudioSE(filename)
filename = sprintf("Cries/%03dCry",pokemon)
end
end
end
return filename if pbResolveAudioSE(filename)
elsif !pokemon.egg?
form = (pokemon.form rescue 0)
filename = sprintf("Cries/%sCry_%d",getConstantName(PBSpecies,pokemon.species),form) rescue nil
if !pbResolveAudioSE(filename)
filename = sprintf("Cries/%03dCry_%d",pokemon.species,form)
if !pbResolveAudioSE(filename)
filename = sprintf("Cries/%sCry",getConstantName(PBSpecies,pokemon.species)) rescue nil
if !pbResolveAudioSE(filename)
filename = sprintf("Cries/%03dCry",pokemon.species)
end
end
end
return filename if pbResolveAudioSE(filename)
end
return nil
end
###############################################################################
# Glitch Battlers
##############################################################################
class PokeBattle_Battler
def isGlitchmon?
if @pokemon
return (@pokemon.isGlitchmon? rescue false)
end
return false
end
def isBoss?
if @pokemon
return (@pokemon.isBoss? rescue false)
end
return false
end
end
############################################################################
# Can't capture Glitched Battlers
############################################################################
module PokeBattle_BattleCommon
def pbThrowPokeBall(idxPokemon,ball,rareness=nil,showplayer=false)
itemname=PBItems.getName(ball)
battler=nil
if pbIsOpposing?(idxPokemon)
battler=self.battlers[idxPokemon]
else
battler=self.battlers[idxPokemon].pbOppositeOpposing
end
if battler.fainted?
battler=battler.pbPartner
end
pbDisplayBrief(_INTL("{1} threw one {2}!",self.pbPlayer.name,itemname))
if battler.fainted?
pbDisplay(_INTL("But there was no target..."))
return
end
if battler.isGlitchmon?
pbDisplay(_INTL("Glitch pokemon will fry your pokeball..."))
return
end
if battler.isBoss?
pbDisplay(_INTL("The pokemon will blocked your ball..."))
return
end
if @opponent && (!pbIsSnagBall?(ball) || !battler.isShadow?)
@scene.pbThrowAndDeflect(ball,1)
pbDisplay(_INTL("The Trainer blocked the Ball!\nDon't be a thief!"))
else
pokemon=battler.pokemon
species=pokemon.species
if $DEBUG && Input.press?(Input::CTRL)
shakes=4
else
if !rareness
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,pokemon.fSpecies,16)
rareness=dexdata.fgetb # Get rareness from dexdata file
dexdata.close
end
a=battler.totalhp
b=battler.hp
rareness=BallHandlers.modifyCatchRate(ball,rareness,self,battler)
x=(((a*3-b*2)*rareness)/(a*3)).floor
if battler.status==PBStatuses::SLEEP || battler.status==PBStatuses::FROZEN
x=(x*2.5).floor
elsif battler.status!=0
x=(x*1.5).floor
end
c=0
if $Trainer
if $Trainer.pokedexOwned>600
c=(x*2.5/6).floor
elsif $Trainer.pokedexOwned>450
c=(x*2/6).floor
elsif $Trainer.pokedexOwned>300
c=(x*1.5/6).floor
elsif $Trainer.pokedexOwned>150
c=(x*1/6).floor
elsif $Trainer.pokedexOwned>30
c=(x*0.5/6).floor
end
end
shakes=0; critical=false
if x>255 || BallHandlers.isUnconditional?(ball,self,battler)
shakes=4
else
x=1 if x<1
y = ( 65536 / ((255.0/x)**0.1875) ).floor
if USECRITICALCAPTURE && pbRandom(256)<c
critical=true
shakes=4 if pbRandom(65536)<y
else
shakes+=1 if pbRandom(65536)<y
shakes+=1 if pbRandom(65536)<y && shakes==1
shakes+=1 if pbRandom(65536)<y && shakes==2
shakes+=1 if pbRandom(65536)<y && shakes==3
end
end
end
PBDebug.log("[Threw Poké Ball] #{itemname}, #{shakes} shakes (4=capture)")
@scene.pbThrow(ball,shakes,critical,battler.index,showplayer)
case shakes
when 0
pbDisplay(_INTL("Oh no! The Pokémon broke free!"))
BallHandlers.onFailCatch(ball,self,battler)
when 1
pbDisplay(_INTL("Aww... It appeared to be caught!"))
BallHandlers.onFailCatch(ball,self,battler)
when 2
pbDisplay(_INTL("Aargh! Almost had it!"))
BallHandlers.onFailCatch(ball,self,battler)
when 3
pbDisplay(_INTL("Gah! It was so close, too!"))
BallHandlers.onFailCatch(ball,self,battler)
when 4
pbDisplayBrief(_INTL("Gotcha! {1} was caught!",pokemon.name))
@scene.pbThrowSuccess
if pbIsSnagBall?(ball) && @opponent
pbRemoveFromParty(battler.index,battler.pokemonIndex)
battler.pbReset
battler.participants=[]
else
@decision=4
end
if pbIsSnagBall?(ball)
pokemon.ot=self.pbPlayer.name
pokemon.trainerID=self.pbPlayer.id
end
BallHandlers.onCatch(ball,self,pokemon)
pokemon.ballused=pbGetBallType(ball)
((pokemon.makeUnmega if pokemon.isMega?) rescue nil)
pokemon.makeUnprimal rescue nil
pokemon.pbRecordFirstMoves
if GAINEXPFORCAPTURE
battler.captured=true
pbGainEXP
battler.captured=false
end
if !self.pbPlayer.hasOwned?(species)
self.pbPlayer.setOwned(species)
if $Trainer.pokedex
pbDisplayPaused(_INTL("{1}'s data was added to the Pokédex.",pokemon.name))
@scene.pbShowPokedex(species)
end
end
pokemon.forcedForm = false if MultipleForms.hasFunction?(pokemon.species,"getForm")
@scene.pbHideCaptureBall
if pbIsSnagBall?(ball) && @opponent
pokemon.pbUpdateShadowMoves rescue nil
@snaggedpokemon.push(pokemon)
else
pbStorePokemon(pokemon)
end
end
end
end
end
Last edited: