BeAGoodOne
ShinyMimikyu
- 20
- Posts
- 6
- Years
- Germany
- Seen Apr 6, 2022
Pretty self explanatory. I haven't found an answer yet
Thanks in advance
Thanks in advance
Sure. But you're gonna have to specify how that order should be determined.
I'll leave a few examples below:
Sort by species:$Trainer.party.sort { |a, b| a.species <=> b.species }
Sort by level:$Trainer.party.sort { |a, b| a.level <=> b.level }
a.level and b.level aren't Pokemon, it's just the Syntax Array Sorting for array sorting. Even if the Party has 2 Pokémon or 6, the above code will always sort by level.
That one would sort by species, right?
what about the code that sorts by species?
Okay, let's say I want to sort by species, withI think you answered yourself:
Okay, let's say I want to sort by species, with
1. Ferrothorn
2. Metagross
3. Scizor
4. Magnezone
5. Steelix
6. Exadrill
In that order, how would that code look like, and where would it have to go?
I'm not sure but either in Pokedex order or in Species name alphabetical order.
I think the code goes in PField_EncounterModifiers
And how exactly would this code look?
Now uncomment those lines and you should be good to go.
Okay, let's say I want to sort by species, with
1. Ferrothorn
2. Metagross
3. Scizor
4. Magnezone
5. Steelix
6. Exadrill
In that order, how would that code look like, and where would it have to go?
order = [
PBSpecies::FERROTHORN,
PBSpecies::METAGROSS,
PBSpecies::SCIZOR,
PBSpecies::MAGNEZONE,
PBSpecies::STEELIX,
PBSpecies::EXCADRILL
]
$Trainer.party.sort { |a, b| order.index(a.species) <=> order.index(b.species) }
I am sorry, again, no Coding expierence xd. What would I have to do now, to uncomment those lines?
EDIT: Okay I have found out what you mean, however now I got a syntex Error https://imgur.com/ouP8D1X https://imgur.com/VHlDku4
Since you have six entries here, does this mean the player could only ever have these 6 Pokémon in the party at this time? If so, you can use the following method:
Code:order = [ PBSpecies::FERROTHORN, PBSpecies::METAGROSS, PBSpecies::SCIZOR, PBSpecies::MAGNEZONE, PBSpecies::STEELIX, PBSpecies::EXCADRILL ] $Trainer.party.sort { |a, b| order.index(a.species) <=> order.index(b.species) }
Use extendtext.exe if it doesn't fit in your script window.
You need to uncomment every line from Events.onTrainerPartyLoad to the last '}'
EDIT: This code will sort the party of every trainer in your game. To fix that add "if $game_switches[123]" before the sort and "end" after the sort. This will make it so that the part will sort only if the switch 123 is on. You can change 123 to whatever you want.
Right, so I did as you told me, https://imgur.com/TN81ey5 and the Game Launches now, however it doesn't seem to work. I used both the "Species Script" and the "Level Script". A mistake on my end?