• 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
  • Seen today
Sorry, i need help... I want to make a rule in my own pokemon game, the rule is if battling mewtwo, player must be using deoxys and just deoxys. Can i using this script for it? or any script?
Yes! On this script, after line 'ret=PokemonChallengeRules.new' add line 'ret.addPokemonRule(SpeciesRestriction.new(:DEOXYS))'. After that, Just use a pokémon selection for one pokémon.
 

etique

etique
268
Posts
6
Years
  • Age 36
  • Seen Oct 30, 2022
should these options appear?Sem título.png
after choosing some of these things an error occurs
Sem título1.pngSem título3.png
 
12
Posts
4
Years
  • Age 29
  • Seen Jun 26, 2022
Hi. Great script! This is exactly what I was looking for. Thank you so much! Of course I'll remember to credit you.

I just have one question. When the player doesn't have the min number of Pokemon, how do I output a text saying "You do not have the minimum number of Pokemon." Here's what I tried:
def self.hasValidTeam?(min=1, max=6, canCancel=false, acceptFainted=false)
pbBattleChallenge.set("pokemonSelectionRules",7,self.rules(min,max))
ret=pbHasEligible?
pbBattleChallenge.pbCancel
Kernel.pbMessage(_INTL("You do not have enough Pokemon for this challenge."))
return ret
end
 

FL

Pokémon Island Creator
2,445
Posts
13
Years
  • Seen today
This should display your message:
Code:
  def self.hasValidTeam?(min=1, max=6, canCancel=false, acceptFainted=false)
    Kernel.pbMessage(_INTL("You do not have enough Pokemon for this challenge.")) if min>$Trainer.party.length
    pbBattleChallenge.set("pokemonSelectionRules",7,self.rules(min,max))
    ret=pbHasEligible?
    pbBattleChallenge.pbCancel
    return ret
  end
 
73
Posts
4
Years
  • Age 28
  • Seen today
I'm getting this error, any ideas why?

Script '[Interpreter]' line 246: RuntimeError ocurred

Script error within event 6 (coords 17,11) map 86
Exception: NameError
Message: Pokemon Battle Selection:51:in 'rules' uninitialized
constant PBExperience::MAXLEVEL

***Full script:
PokemonSelection.choose(1,3)

Backtrace
Interpreter:197:in 'pbExecuteScript'
Pokemon Battle Selection:69:in 'choose'
(eval):1:in 'pbExecuteScript'
Interpreter:1458:in 'eval'
Interpreter:197:in 'pbExecuteScript'
Interpreter:1458:in 'command_355'
Interpreter:359:in 'execute_command'
Interpreter:155:in 'update'
Interpreter:102:in 'loop'
Interpreter:158:in 'update'
 
26
Posts
5
Years
  • Age 25
  • Seen Nov 25, 2021
I'm getting this error, any ideas why?

Script '[Interpreter]' line 246: RuntimeError ocurred

Script error within event 6 (coords 17,11) map 86
Exception: NameError
Message: Pokemon Battle Selection:51:in 'rules' uninitialized
constant PBExperience::MAXLEVEL

***Full script:
PokemonSelection.choose(1,3)

Backtrace
Interpreter:197:in 'pbExecuteScript'
Pokemon Battle Selection:69:in 'choose'
(eval):1:in 'pbExecuteScript'
Interpreter:1458:in 'eval'
Interpreter:197:in 'pbExecuteScript'
Interpreter:1458:in 'command_355'
Interpreter:359:in 'execute_command'
Interpreter:155:in 'update'
Interpreter:102:in 'loop'
Interpreter:158:in 'update'
I had the same problem, I edited one line and it started working again, while FL doesn't answer, you can try to edit this line by placing "#" before "ret.setLevelAdjustment(OpenLevelAdjustment.new(PBExperience::MAXLEVEL))"
 
73
Posts
4
Years
  • Age 28
  • Seen today
Interesting, thanks!
I tried something else myself.
In PBattle_OrgBattleRules, there's a line "ret.setLevelAdjustment(OpenLevelAdjustment.new(PBExperience.maxLevel))"
So I replaced "(PBExperience::MAXLEVEL))"
with "(PBExperience.maxLevel))" and it worked perfectly
 
4
Posts
3
Years
  • Age 29
  • Seen Apr 10, 2022
Hi, I've made "canCancel=true" so the player can back out of the selection, but when they do the battle just runs as normal. Can someone help me out?

Here's my event breakdown;
Code:
@>Script: pbTrainerIntro(:CADET)
@>Text: "Hi, I like shorts! They're comfy and easy to wear!"
@>Script: pbPokemonSelection.choose(3,3)
@>Conditional Branch: Script: pbTrainerBattle(CADET,"Cameron")
[INDENT]@>Control Self Switch: A =ON
@>[/INDENT]
: Branch End
@>Script: PokemonSelection.restore
@>Script: pbTrainerEnd
 

FL

Pokémon Island Creator
2,445
Posts
13
Years
  • Seen today
I had the same problem, I edited one line and it started working again, while FL doesn't answer, you can try to edit this line by placing "#" before "ret.setLevelAdjustment(OpenLevelAdjustment.new(PBExperience::MAXLEVEL))"
Thanks for the fix! I fixed the main post.

Hi, I've made "canCancel=true" so the player can back out of the selection, but when they do the battle just runs as normal. Can someone help me out?

Here's my event breakdown;
Code:
@>Script: pbTrainerIntro(:CADET)
@>Text: "Hi, I like shorts! They're comfy and easy to wear!"
@>Script: pbPokemonSelection.choose(3,3)
@>Conditional Branch: Script: pbTrainerBattle(CADET,"Cameron")
[INDENT]@>Control Self Switch: A =ON
@>[/INDENT]
: Branch End
@>Script: PokemonSelection.restore
@>Script: pbTrainerEnd
You need to do something like

Code:
@>Conditional Branch: Script: PokemonSelection.choose(3,3, true)
    @>Script: pbTrainerIntro(:CADET)
    @>Text: "Hi, I like shorts! They're comfy and easy to wear!"
    @>Conditional Branch: Script: pbTrainerBattle(CADET,"Cameron")
        @>Control Self Switch: A =ON
        @>
    : Branch End
    @>Script: PokemonSelection.restore
    @>Script: pbTrainerEnd
    @>
: Branch End
So, if the selection is cancelled, the battle won't happens.
 

FL

Pokémon Island Creator
2,445
Posts
13
Years
  • Seen today
Updated to work with Essentials v19.1
 
107
Posts
3
Years
  • Age 26
  • Seen Apr 27, 2023
Would it be possible to make the captured Pokemons compatible?
I know this is one of the problems, if one captured, the improved level doesn't match.
Would there be any way? I have a beautiful system but I would need this...
 

FL

Pokémon Island Creator
2,445
Posts
13
Years
  • Seen today
Would it be possible to make the captured Pokemons compatible?
I know this is one of the problems, if one captured, the improved level doesn't match.
Would there be any way? I have a beautiful system but I would need this...
After the script end, add
Code:
module PokemonSelection
  def self.restoreWithCaught(*args)
    newPokemonArray = []
    for partyPokemon in $Trainer.party
      isNew = !$PokemonGlobal.pokemonSelectionOriginalParty.find{|pk| 
        pk.personalID == partyPokemon.personalID
      }
      newPokemonArray.push(partyPokemon) if isNew
    end
    ret = self.restore(args)
    for pokemon in newPokemonArray
      if $Trainer.party.length==6
        $PokemonStorage.pbStoreCaught(pokemon)
      else
        $Trainer.party.push(pokemon)
      end
    end
    return ret
  end
end
And call 'PokemonSelection.restoreWithCaught' instead of 'PokemonSelection.restore'.
 
107
Posts
3
Years
  • Age 26
  • Seen Apr 27, 2023
After the script end, add
Code:
module PokemonSelection
  def self.restoreWithCaught(*args)
    newPokemonArray = []
    for partyPokemon in $Trainer.party
      isNew = !$PokemonGlobal.pokemonSelectionOriginalParty.find{|pk| 
        pk.personalID == partyPokemon.personalID
      }
      newPokemonArray.push(partyPokemon) if isNew
    end
    ret = self.restore(args)
    for pokemon in newPokemonArray
      if $Trainer.party.length==6
        $PokemonStorage.pbStoreCaught(pokemon)
      else
        $Trainer.party.push(pokemon)
      end
    end
    return ret
  end
end
And call 'PokemonSelection.restoreWithCaught' instead of 'PokemonSelection.restore'.

Obrigado mano! Sei que é BR, hauhauha
 
162
Posts
7
Years
  • Age 35
  • Seen yesterday
Hi, thanks for sharing this script!
I have a question...
Is there any way to set the rules restrictions, already mentioned by others in the thread, for each battle specifically or "call them" before the battle?

For example. A trainer wants to perform a 3 VS 3 battle with only a specific type, later another one wants to face a same species to know which one is the best?

Thank you very much
 

FL

Pokémon Island Creator
2,445
Posts
13
Years
  • Seen today
Hi, thanks for sharing this script!
I have a question...
Is there any way to set the rules restrictions, already mentioned by others in the thread, for each battle specifically or "call them" before the battle?

For example. A trainer wants to perform a 3 VS 3 battle with only a specific type, later another one wants to face a same species to know which one is the best?

Thank you very much
I edited the script, so now is more easier to define rulesets. Some examples:

To only allows Kadabra:
Code:
challenge = PokemonSelection.rules(1,6)
challenge.addPokemonRule(SpeciesRestriction.new(:KADABRA))
PokemonSelection.choose(1,6,false,false,challenge)


To only allows Fire and Water Pokémon:
Code:
challenge = PokemonSelection.rules(1,6)
challenge.addPokemonRule(TypeRestriction.new([:FIRE,:WATER],false))
PokemonSelection.choose(1,6,false,false,challenge)


I also added TypeRestriction class to the main script.
 
162
Posts
7
Years
  • Age 35
  • Seen yesterday
I edited the script, so now is more easier to define rulesets. Some examples:

To only allows Kadabra:
Code:
challenge = PokemonSelection.rules(1,6)
challenge.addPokemonRule(SpeciesRestriction.new(:KADABRA))
PokemonSelection.choose(1,6,false,false,challenge)


To only allows Fire and Water Pokémon:
Code:
challenge = PokemonSelection.rules(1,6)
challenge.addPokemonRule(TypeRestriction.new([:FIRE,:WATER],false))
PokemonSelection.choose(1,6,false,false,challenge)


I also added TypeRestriction class to the main script.

Thank you so much for this, works perfectly :)
 
Back
Top