• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] URGENT, I NEED SIMPLE HELP WITH THIS SCRIPT

They helped me make a script that makes the trainer lose levels by losing games and going to the pokémon center.
But when I load a pokemon egg there is a bug because the game cannot identify it because it is level 0.

This is the level loss script.
Spoiler:


Esse é o BUG que acontece comigo...
Spoiler:


Can someone help me?
 
Simply add this line of code between the 5th and 6th lines of the code you posted:
Code:
next if pkmn.egg?
Thus the whole code would look like this:
Code:
Events.onEndBattle += proc { |_sender,e|
decision = e[0]
canLose = e[1]
if decision == 2 && !canLose
$Trainer.party.each{|pkmn|
next if pkmn.egg?
newLv = pkmn.level - (rand(1) + 1)
newLv.clamp(1,PBExperience.maxLevel)
pkmn.level = newLv
pkmn.calcStats
}
end
}
 
Back
Top