- 318
- Posts
- 5
- Years
- Germany
- Seen yesterday
For Pokemon Essentials 18.1 see https://www.pokecommunity.com/threads/443637
UPDATED TO VERSION 1.2. This script is for Pokémon Essentials 17.2.
This Script allows a pokemon to evolve after a level up while still in battle. Then you can continue battling with your evolved pokemon. This Script is based on EVO DURING BATTLE BY Zeak6464 (Credit: Vendily), and added bug fix by WolfPP.
However I did some editing to make it drag and drop and removed some bugs.
FEATURES:
- Includes evolution during battle
- activate and deactivate it by setting the parameter EVODURINGBATTLE
BUG FIXES FROM PREVIOUS VERSIONS:
- prevents a small bug from the previous version, that a pokemon can evolve twice (first during battle and second after battle) with just one level up - by derFischae
- prevents bug that after battle the overworld music does not start - by WolfPP
- removed bug that pokemon that learned a new move on evolving during battle could not use it until switching in and out - by derFischae
INSTALLATION:
Installation as simple as it can be. Insert a new file in the script editor above main, name it Evo_During_Battle and copy this code into it.
PROPERTIES:
If you don't want to have evo during battle, you also have to change the value of the upcoming parameter EVODURINGBATTLE to false i.e.
EVODURINGBATTLE = false
UPDATED TO VERSION 1.2. This script is for Pokémon Essentials 17.2.
This Script allows a pokemon to evolve after a level up while still in battle. Then you can continue battling with your evolved pokemon. This Script is based on EVO DURING BATTLE BY Zeak6464 (Credit: Vendily), and added bug fix by WolfPP.
However I did some editing to make it drag and drop and removed some bugs.
FEATURES:
- Includes evolution during battle
- activate and deactivate it by setting the parameter EVODURINGBATTLE
BUG FIXES FROM PREVIOUS VERSIONS:
- prevents a small bug from the previous version, that a pokemon can evolve twice (first during battle and second after battle) with just one level up - by derFischae
- prevents bug that after battle the overworld music does not start - by WolfPP
- removed bug that pokemon that learned a new move on evolving during battle could not use it until switching in and out - by derFischae
INSTALLATION:
Installation as simple as it can be. Insert a new file in the script editor above main, name it Evo_During_Battle and copy this code into it.
PROPERTIES:
If you don't want to have evo during battle, you also have to change the value of the upcoming parameter EVODURINGBATTLE to false i.e.
EVODURINGBATTLE = false
Code:
#===========================================
# EVO DURING BATTLE BY Zeak6464, Credit: Vendily
#===========================================
# UPDATED TO VERSION 1.2. This script is for Pokémon Essentials 17.
#
# This Script allows a pokemon to evolve after a level up while still in battle. Then you can continue battling with your evolved pokemon.
# This Script is based on EVO DURING BATTLE BY Zeak6464 (Credit: Vendily), and added bug fix by WolfPP.
# However I did some editing to make it drag and drop and removed some bugs.
#
# FEATURES:
# - Includes evolution during battle
# - activate and deactivate it by setting the parameter EVODURINGBATTLE
#
# BUG FIXES FROM PREVIOUS VERSIONS:
# - prevents a small bug from the previous version, that a pokemon can evolve twice (first during battle and second after battle) with just one level up - by derFischae
# - prevents bug that after battle the overworld music does not start - by WolfPP
# - removed bug that pokemon that learned a new move on evolving during battle could not use it until switching in and out - by derFischae
#
# INSTALLATION:
# Installation as simple as it can be. Insert a new file in the script editor above main, name it Evo_During_Battle and copy this code into it.
#
# PROPERTIES:
# If you don't want to have evo during battle, you also have to change the value of the upcoming parameter EVODURINGBATTLE to false i.e.
# EVODURINGBATTLE = false
#============================================
# SETTINGS
#============================================
EVODURINGBATTLE = true
#true - means that your pokemon can evolve during battle
#false - means that they can only evolve after a battle as usual
#============================================
#adding new method in PokeBattle_Battler
#============================================
class PokeBattle_Battler
def name=(value)
@name=value
end
end
#============================================
#overriding pbEvolutionCheck in PField_Battles
#pbEvolutionCheck originally was used to be added
#via Event.onEndBattle in (in PField_Battles)
#============================================
alias original_pbEvolutionCheck pbEvolutionCheck
def pbEvolutionCheck(currentlevels)
return if EVODURINGBATTLE
original_pbEvolutionCheck(currentlevels)
end
#============================================
#overriding pbGainExpOne in PokeBattle_Battle
#here I include the evolution procedure at
#the end of this this method that does exp
#gain level up and learning new moves...
#
#deviding pbGainExpOne into smaller parts
#for better overview:
# pbGainEvOne
#============================================
class PokeBattle_Battle
alias original_pbGainExpOne pbGainExpOne
def pbGainExpOne(index,defeated,partic,expshare,haveexpall,showmessages=true)
thispoke=@party1[index]
# Original species, not current species
level=defeated.level
baseexp=defeated.pokemon.baseExp
evyield=defeated.pokemon.evYield
# Gain effort value points, using RS effort values
pbGainEvOne(thispoke,evyield)
# Calculate experience
isOutsider=(thispoke.trainerID!=self.pbPlayer.id ||
(thispoke.language!=0 && thispoke.language!=self.pbPlayer.language))
exp=pbCalculateExpOne(index, defeated, level, expshare, partic, haveexpall, thispoke, baseexp, isOutsider)
growthrate=thispoke.growthrate
newexp=PBExperience.pbAddExperience(thispoke.exp,exp,growthrate)
exp=newexp-thispoke.exp
# Gain experience
if exp>0
if showmessages
if isOutsider
pbDisplayPaused(_INTL("{1} gained a boosted {2} Exp. Points!",thispoke.name,exp))
else
pbDisplayPaused(_INTL("{1} gained {2} Exp. Points!",thispoke.name,exp))
end
end
newlevel=PBExperience.pbGetLevelFromExperience(newexp,growthrate)
tempexp=0
curlevel=thispoke.level
if newlevel<curlevel
debuginfo="#{thispoke.name}: #{thispoke.level}/#{newlevel} | #{thispoke.exp}/#{newexp} | gain: #{exp}"
raise RuntimeError.new(_INTL("The new level ({1}) is less than the Pokémon's\r\ncurrent level ({2}), which shouldn't happen.\r\n[Debug: {3}]",
newlevel,curlevel,debuginfo))
return
end
if thispoke.respond_to?("isShadow?") && thispoke.isShadow?
thispoke.exp+=exp
else
tempexp1=thispoke.exp
tempexp2=0
# Find battler
battler=pbFindPlayerBattler(index)
loop do
# EXP Bar animation
startexp=PBExperience.pbGetStartExperience(curlevel,growthrate)
endexp=PBExperience.pbGetStartExperience(curlevel+1,growthrate)
tempexp2=(endexp<newexp) ? endexp : newexp
thispoke.exp=tempexp2
@scene.pbEXPBar(thispoke,battler,startexp,endexp,tempexp1,tempexp2)
tempexp1=tempexp2
curlevel+=1
if curlevel>newlevel
thispoke.calcStats
battler.pbUpdate(false) if battler
@scene.pbRefresh
break
end
oldtotalhp=thispoke.totalhp
oldattack=thispoke.attack
olddefense=thispoke.defense
oldspeed=thispoke.speed
oldspatk=thispoke.spatk
oldspdef=thispoke.spdef
if battler && battler.pokemon && @internalbattle
battler.pokemon.changeHappiness("levelup")
end
thispoke.calcStats
battler.pbUpdate(false) if battler
@scene.pbRefresh
pbDisplayPaused(_INTL("{1} grew to Level {2}!",thispoke.name,curlevel))
@scene.pbLevelUp(thispoke,battler,oldtotalhp,oldattack,
olddefense,oldspeed,oldspatk,oldspdef)
# Finding all moves learned at this level
movelist=thispoke.getMoveList
for k in movelist
if k[0]==thispoke.level # Learned a new move
pbLearnMove(index,k[1])
end
end
# Evo During Battle
return if !EVODURINGBATTLE
newspecies=pbCheckEvolution(thispoke)
if newspecies>0
pbFadeOutInWithMusic(99999){
evo=PokemonEvolutionScene.new
evo.pbStartScreen(thispoke,newspecies)
evo.pbEvolution
evo.pbEndScreen
$game_map.autoplayAsCue
if battler
@scene.pbChangePokemon(@battlers[battler.index],@battlers[battler.index].pokemon)
battler.pbInitPokemon(thispoke,battler.pokemonIndex)
battler.name=thispoke.name
end
}
end
end
end
end
end
# Gain effort value points, using RS effort values
def pbGainEvOne(thispoke,evyield)
totalev=0
for k in 0...6
totalev+=thispoke.ev[k]
end
for k in 0...6
evgain=evyield[k]
evgain*=2 if isConst?(thispoke.item,PBItems,:MACHOBRACE) ||
isConst?(thispoke.itemInitial,PBItems,:MACHOBRACE)
case k
when PBStats::HP
evgain+=4 if isConst?(thispoke.item,PBItems,:POWERWEIGHT) ||
isConst?(thispoke.itemInitial,PBItems,:POWERWEIGHT)
when PBStats::ATTACK
evgain+=4 if isConst?(thispoke.item,PBItems,:POWERBRACER) ||
isConst?(thispoke.itemInitial,PBItems,:POWERBRACER)
when PBStats::DEFENSE
evgain+=4 if isConst?(thispoke.item,PBItems,:POWERBELT) ||
isConst?(thispoke.itemInitial,PBItems,:POWERBELT)
when PBStats::SPATK
evgain+=4 if isConst?(thispoke.item,PBItems,:POWERLENS) ||
isConst?(thispoke.itemInitial,PBItems,:POWERLENS)
when PBStats::SPDEF
evgain+=4 if isConst?(thispoke.item,PBItems,:POWERBAND) ||
isConst?(thispoke.itemInitial,PBItems,:POWERBAND)
when PBStats::SPEED
evgain+=4 if isConst?(thispoke.item,PBItems,:POWERANKLET) ||
isConst?(thispoke.itemInitial,PBItems,:POWERANKLET)
end
evgain*=2 if thispoke.pokerusStage>=1 # Infected or cured
if evgain>0
# Can't exceed overall limit
evgain-=totalev+evgain-PokeBattle_Pokemon::EVLIMIT if totalev+evgain>PokeBattle_Pokemon::EVLIMIT
# Can't exceed stat limit
evgain-=thispoke.ev[k]+evgain-PokeBattle_Pokemon::EVSTATLIMIT if thispoke.ev[k]+evgain>PokeBattle_Pokemon::EVSTATLIMIT
# Add EV gain
thispoke.ev[k]+=evgain
if thispoke.ev[k]>PokeBattle_Pokemon::EVSTATLIMIT
print "Single-stat EV limit #{PokeBattle_Pokemon::EVSTATLIMIT} exceeded.\r\nStat: #{k} EV gain: #{evgain} EVs: #{thispoke.ev.inspect}"
thispoke.ev[k]=PokeBattle_Pokemon::EVSTATLIMIT
end
totalev+=evgain
if totalev>PokeBattle_Pokemon::EVLIMIT
print "EV limit #{PokeBattle_Pokemon::EVLIMIT} exceeded.\r\nTotal EVs: #{totalev} EV gain: #{evgain} EVs: #{thispoke.ev.inspect}"
end
end
end
end
# Calculate experience
def pbCalculateExpOne(index, defeated, level, expshare, partic, haveexpall, thispoke, baseexp, isOutsider)
ispartic=0
ispartic=1 if defeated.participants.include?(index)
haveexpshare=(isConst?(thispoke.item,PBItems,:EXPSHARE) ||
isConst?(thispoke.itemInitial,PBItems,:EXPSHARE)) ? 1 : 0
exp=0
if expshare>0
if partic==0 # No participants, all Exp goes to Exp Share holders
exp=(level*baseexp).floor
exp=(exp/(NOSPLITEXP ? 1 : expshare)).floor*haveexpshare
else
if NOSPLITEXP
exp=(level*baseexp).floor*ispartic
exp=(level*baseexp/2).floor*haveexpshare if ispartic==0
else
exp=(level*baseexp/2).floor
exp=(exp/partic).floor*ispartic + (exp/expshare).floor*haveexpshare
end
end
elsif ispartic==1
exp=(level*baseexp/(NOSPLITEXP ? 1 : partic)).floor
elsif haveexpall
exp=(level*baseexp/2).floor
end
return if exp<=0
exp=(exp*3/2).floor if @opponent
if USESCALEDEXPFORMULA
exp=(exp/5).floor
leveladjust=(2*level+10.0)/(level+thispoke.level+10.0)
leveladjust=leveladjust**5
leveladjust=Math.sqrt(leveladjust)
exp=(exp*leveladjust).floor
exp+=1 if ispartic>0 || haveexpshare>0
else
exp=(exp/7).floor
end
#isOutsider=(thispoke.trainerID!=self.pbPlayer.id ||
# (thispoke.language!=0 && thispoke.language!=self.pbPlayer.language))
if isOutsider
if thispoke.language!=0 && thispoke.language!=self.pbPlayer.language
exp=(exp*1.7).floor
else
exp=(exp*3/2).floor
end
end
exp=(exp*3/2).floor if isConst?(thispoke.item,PBItems,:LUCKYEGG) ||
isConst?(thispoke.itemInitial,PBItems,:LUCKYEGG)
return exp
end
end
Last edited: