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: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!
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
@> Conditional Branch: Script: PokemonSelection.hasValidTeam?(getSingleHeightParam)
@>PokemonSelection.choose(getSingleHeightParam)
(Things after selection)
: Else
(Things when player has invalid party)
: Branch End
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).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?
My bad.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.
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
Looks like an issue when defining both team rules and pokemon rules.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
Ofc it works with 20.1
Maybe running this would be better:
PokemonSelection.choose(1,1)
In ruby, you can only break lines in certain parts, like before a dot. So, paste:Weird then I will retry again xD
So I don't know if it's because of Pokemon Following
PokemonSelection.choose(
PokemonSelection::Parameters
.new
.setMinPokemon(1)
.setMaxPokemon(1))