• 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.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • Red, Hilda, Paxton, or Kellyn - which Pokémon protagonist is your favorite? Let us know by voting in our 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