• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • 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.

Script: [v13+] Pokémon Selection (similar to Stadium/Battle Tower)

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.
 
should these options appear?[PokeCommunity.com] [v13+] Pokémon Selection (similar to Stadium/Battle Tower)
after choosing some of these things an error occurs
[PokeCommunity.com] [v13+] Pokémon Selection (similar to Stadium/Battle Tower)[PokeCommunity.com] [v13+] Pokémon Selection (similar to Stadium/Battle Tower)
 
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
 
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
 
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'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))"
 
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
 
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
 
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.
 
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...
 
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'.
 
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
 
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
 
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.
 
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