• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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.

Pokémon Selection (similar to Stadium/Battle Tower)

FL

Pokémon Island Creator
2,445
Posts
13
Years
  • Online now
New version released:
  1. Better parameter interface
  2. Better instructions
  3. Restore caught/added pokémon by default
  4. Remove the "Generate Teams" debug message
 
Last edited:
3
Posts
11
Years
  • Seen Jan 11, 2024
Hello! I'm struggling a bit with the script.
I want to make an event where:
-The player can only choose 1 Pokémon
-The Pokémons Height needs to be 6 or less
-Player can cancel the choosing
I was able to do the first two alone, but the issue is if the player doesnt have a mon that fits the criteria theres an error, and I dont seem to understand how to use the ValidTeam? thing.
Can someone show me in an event how I would do this?
Thank you a lot!
 

FL

Pokémon Island Creator
2,445
Posts
13
Years
  • Online now
Hello! I'm struggling a bit with the script.
I want to make an event where:
-The player can only choose 1 Pokémon
-The Pokémons Height needs to be 6 or less
-Player can cancel the choosing
I was able to do the first two alone, but the issue is if the player doesnt have a mon that fits the criteria theres an error, and I dont seem to understand how to use the ValidTeam? thing.
Can someone show me in an event how I would do this?
Thank you a lot!
Since defining PokemonSelection::Parameters is a multiline task, you need to put the param bulding into a method if you want to use it on PokemonSelection.hasValidTeam?. So, add the below method above main:

Code:
def getSingleHeightParam
  ret = PokemonSelection::Parameters.new
  ret.minPokemon = 1
  ret.maxPokemon = 1
  ret.baseChallenge = PokemonChallengeRules.new 
  ret.baseChallenge.addPokemonRule(HeightRestriction.new(6))
  return ret
end

At the event, do this:
Code:
@> Conditional Branch: Script: PokemonSelection.hasValidTeam?(getSingleHeightParam)
 @>PokemonSelection.choose(getSingleHeightParam)
 (Things after selection) 
: Else
 (Things when player has invalid party) 
: Branch End
 
21
Posts
4
Years
  • Age 28
  • Seen Nov 23, 2023
Hello, I'm trying to make my own rules ( the plugin looks like it works with v20) but I have one problem. if I chose ret.minPokemon = 1 and
ret.maxPokemon = 6 in my parameters, the event will reject my entire team if only one pokémon is invalid, instead of allowing me to go to the selection screen to select less than 6 pokémons. If there a way to make it work like intended? Or should I just make a test screen with min and max =1 to let the player know what's wrong?
 

FL

Pokémon Island Creator
2,445
Posts
13
Years
  • Online now
Hello, I'm trying to make my own rules ( the plugin looks like it works with v20) but I have one problem. if I chose ret.minPokemon = 1 and
ret.maxPokemon = 6 in my parameters, the event will reject my entire team if only one pokémon is invalid, instead of allowing me to go to the selection screen to select less than 6 pokémons. If there a way to make it work like intended? Or should I just make a test screen with min and max =1 to let the player know what's wrong?
On an event, do a script conditional branch with 'PokemonSelection.hasValidTeam?' (use the same arguments as PokemonSelection.choose). If you use the PokemonSelection::Parameters, do a method (I explain at the above post).
 
21
Posts
4
Years
  • Age 28
  • Seen Nov 23, 2023
Ok it looks like I wasn't clear enough, sorry. I followed your examples and I don't think the problem comes from here. My rules are something like this

def natdexban(max)
ret = PokemonSelection::Parameters.new
ret.minPokemon = 1
ret.maxPokemon = max
ret.canCancel = true
ret.baseChallenge = PokemonChallengeRules.new
ret.baseChallenge.addTeamRule(SpeciesClause.new)
... (I won't flood the post with a sea of rules)
end

So in my test situation 3 of the 6 pokémons of my team are banned in the rules.
If in my event, I followed your example above.
My problem is simple:

1) If I use max=6, it says invalid team even if I could go there with only 1 pokémon.

2) But if I call it with max=1 everything works correctly (except that obviously I can chose only 1 pkmn).

So my question was: is there a way to have it make me go to the selection screen in the first situation or should I just make a test event with situation 2 to make the player know what's wrong.
 

FL

Pokémon Island Creator
2,445
Posts
13
Years
  • Online now
Ok it looks like I wasn't clear enough, sorry. I followed your examples and I don't think the problem comes from here. My rules are something like this

def natdexban(max)
ret = PokemonSelection::Parameters.new
ret.minPokemon = 1
ret.maxPokemon = max
ret.canCancel = true
ret.baseChallenge = PokemonChallengeRules.new
ret.baseChallenge.addTeamRule(SpeciesClause.new)
... (I won't flood the post with a sea of rules)
end

So in my test situation 3 of the 6 pokémons of my team are banned in the rules.
If in my event, I followed your example above.
My problem is simple:

1) If I use max=6, it says invalid team even if I could go there with only 1 pokémon.

2) But if I call it with max=1 everything works correctly (except that obviously I can chose only 1 pkmn).

So my question was: is there a way to have it make me go to the selection screen in the first situation or should I just make a test event with situation 2 to make the player know what's wrong.
My bad.

I can't reproduce your issue. I tried, with initial Essentials party:

Code:
def getSmallHeightParam
  ret = PokemonSelection::Parameters.new
  ret.minPokemon = 1
  ret.maxPokemon = 6
  ret.baseChallenge = PokemonChallengeRules.new 
  ret.baseChallenge.addPokemonRule(HeightRestriction.new(1))
  return ret
end

And worked as intended (on v19.1, at least).

Can you post a set of rules, so I can reproduce the issue?
 
21
Posts
4
Years
  • Age 28
  • Seen Nov 23, 2023
After some testing it looks like the problem comes from
ret.baseChallenge.addTeamRule(SpeciesClause.new)
ret.baseChallenge.addTeamRule(ItemClause.new)

and ofc I have different items and pokémons in my test team


It looks like it's not even checking anything in my test situation 1 (I added a print in the clause class and nothing comes if max=6 but works normally with max=1, weird)

def bob(max)
ret = PokemonSelection::Parameters.new
ret.minPokemon = 1
ret.maxPokemon = max
ret.canCancel = true
ret.baseChallenge = PokemonChallengeRules.new
ret.baseChallenge.addTeamRule(SpeciesClause.new)
ret.baseChallenge.addTeamRule(ItemClause.new)
ret.baseChallenge.addPokemonRule(BannedSpeciesRestriction.new(:PIKACHU))
return ret
end

I used this for testing
 
Last edited:

FL

Pokémon Island Creator
2,445
Posts
13
Years
  • Online now
After some testing it looks like the problem comes from
ret.baseChallenge.addTeamRule(SpeciesClause.new)
ret.baseChallenge.addTeamRule(ItemClause.new)

and ofc I have different items and pokémons in my test team


It looks like it's not even checking anything in my test situation 1 (I added a print in the clause class and nothing comes if max=6 but works normally with max=1, weird)

def bob(max)
ret = PokemonSelection::Parameters.new
ret.minPokemon = 1
ret.maxPokemon = max
ret.canCancel = true
ret.baseChallenge = PokemonChallengeRules.new
ret.baseChallenge.addTeamRule(SpeciesClause.new)
ret.baseChallenge.addTeamRule(ItemClause.new)
ret.baseChallenge.addPokemonRule(BannedSpeciesRestriction.new(:PIKACHU))
return ret
end

I used this for testing
Looks like an issue when defining both team rules and pokemon rules.

On my script, change 'pbEachCombination(team,teamNumber){|comb|' to 'pbEachCombination(team,self.minLength){|comb|'.

I updated the script.
 

AskipLudo

The Masked Guy
159
Posts
7
Years
Ofc it works with 20.1

Weird then I will retry again xD

So I don't know if it's because of Pokemon Following

Poke-Select.png
 
Last edited:
21
Posts
4
Years
  • Age 28
  • Seen Nov 23, 2023
Maybe running this would be better:
PokemonSelection.choose(1,1)
 

FL

Pokémon Island Creator
2,445
Posts
13
Years
  • Online now
Weird then I will retry again xD

So I don't know if it's because of Pokemon Following

Poke-Select.png
In ruby, you can only break lines in certain parts, like before a dot. So, paste:

Code:
PokemonSelection.choose(
PokemonSelection::Parameters
.new
.setMinPokemon(1)
.setMaxPokemon(1))

Alternatively, run extendtext.ext before opening the text dialog.
 

AskipLudo

The Masked Guy
159
Posts
7
Years
Hello, I'm back so funny thing happened to me xD So I choosed my 2 pokemon for a fight and after the end of the fight with the trainer my party was only 2 pokemon seems like the 3rd got deleted to oblivion. Idk what caused that tho
 
21
Posts
4
Years
  • Age 28
  • Seen Nov 23, 2023
You need to restore your previous team. call PokemonSelection.restore after the battle
 
1
Posts
1
Years
  • Age 18
  • Seen Jul 16, 2023
Hi, just wanted to report something I found while using this script on Pokémon Essentials v19.1. The selection and party changing related works fine when opening the game the first time, but then if I soft reset using F12, the selection still works, but the party is unchanged from the original party. But then if I close the game and reopen it, the party changing works again.
 
Back
Top