- 3
- Posts
- 3
- Years
- Seen Dec 3, 2021
In my game I want all 'boss' trainers to scale with the player's Pokémon, but I can't find a complete script that works with PE v19.1. Somehow I've managed to build a script, borrowing heavily from the existing 'trainer modifier' script within Overworld_EncounterModifiers, plus code from wtmn_bk and thor348 (links below for reference).
Wtmn_bk - (broken link removed)
Thor348 - https://www.pokecommunity.com/showthread.php?t=309204&highlight=happiness
Here is the actual script:
The script will update the Pokémon's stats , but doesn't account for Pokémon evolution. This wasn't an issue for me as all my trainers will have teams based on the number of badges the player has and the region is split into different 'zones' to prevent players running through the whole game without battling the gyms (which would result in high level, non-evolved Pokémon battles).
The only thing I will mention is that the Pokémon's moves won't update. This is because I wanted to use moves defined in trainers.txt and when I added pkm.reset_moves to the script it would only use moves the Pokémon knows at that level.
I haven't been able to work out how the script calculates the levels of the opponent's Pokémon. I looked at Thundaga's tutorial, which also uses thor348's script, but that only suggests you play around with the numbers to change the levels rather than describing what they actually do. (Note: I am not hating on Thundaga - his tutorials have been incredibly helpful and he will be getting lots of credit in my game.) If you are able to explain, I would be eternally grateful.
Anyway I wanted to contribute something to the community to say thanks for all the help you've unknowingly given me. I hope this helps at least one of you. Feel free to improve upon the script or make any additions. No credit required as I have very little scripting knowledge and pretty much stumbled on this by pure luck!
Wtmn_bk - (broken link removed)
Thor348 - https://www.pokecommunity.com/showthread.php?t=309204&highlight=happiness
Here is the actual script:
Spoiler:
Events.onTrainerPartyLoad += proc { |_sender, trainer|
if $game_switches[150]==true
if trainer
pkm = trainer[0].party[0]
pkm.level = pbBalancedLevel($Trainer.party) - rand(9)
pkm.calc_stats
if pkm.level<=1
pkm.level=2 + rand(3)
end
if pkm.level>100
pkm.level=100 - rand(8)
end
if pkm.level>
pkm.level = pbBalancedLevel($Trainer.party) - rand(3)
end
else
pkm.level=poke[TPLEVEL]
end
end
}
if $game_switches[150]==true
if trainer
pkm = trainer[0].party[0]
pkm.level = pbBalancedLevel($Trainer.party) - rand(9)
pkm.calc_stats
if pkm.level<=1
pkm.level=2 + rand(3)
end
if pkm.level>100
pkm.level=100 - rand(8)
end
if pkm.level>
pkm.level = pbBalancedLevel($Trainer.party) - rand(3)
end
else
pkm.level=poke[TPLEVEL]
end
end
}
The script will update the Pokémon's stats , but doesn't account for Pokémon evolution. This wasn't an issue for me as all my trainers will have teams based on the number of badges the player has and the region is split into different 'zones' to prevent players running through the whole game without battling the gyms (which would result in high level, non-evolved Pokémon battles).
The only thing I will mention is that the Pokémon's moves won't update. This is because I wanted to use moves defined in trainers.txt and when I added pkm.reset_moves to the script it would only use moves the Pokémon knows at that level.
I haven't been able to work out how the script calculates the levels of the opponent's Pokémon. I looked at Thundaga's tutorial, which also uses thor348's script, but that only suggests you play around with the numbers to change the levels rather than describing what they actually do. (Note: I am not hating on Thundaga - his tutorials have been incredibly helpful and he will be getting lots of credit in my game.) If you are able to explain, I would be eternally grateful.
Anyway I wanted to contribute something to the community to say thanks for all the help you've unknowingly given me. I hope this helps at least one of you. Feel free to improve upon the script or make any additions. No credit required as I have very little scripting knowledge and pretty much stumbled on this by pure luck!