Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # * Pokémon Selection - by FL (Credits will be apreciated)
- #===============================================================================
- #
- # This script is for Pokémon Essentials. It makes a pokémon selection system
- # similar to Stadium/Battle Tower, where you can choose a certain number and
- # order of pokémon.
- #
- #===============================================================================
- #
- # To this script works, put it above main and use in script command
- # 'PokemonSelection.choose(min, max, canCancel, acceptFainted)' where min and
- # max are the minimum and maximum pokémon number selection (default values are
- # 1 and 6), canCancel when true the player can cancel the selection (default
- # is false) and acceptFainted that when true the player can choose fainted
- # pokémon and eggs (default is false). This method return if a party is choosen.
- #
- # To restore the previous party, use 'PokemonSelection.restore'. This do nothing
- # is there's no party to restore. Ths method returns if the party is restored.
- #
- # Between the two commands, don't allow the player to caught or deposit/withdraw
- # any pokémon or the pokémon will be lost! However, you pokémon can gain
- # exp/level, evolve, change hold item/moves normally. If you try to choose a
- # new party before restore the old one, the game raises an error. This won't
- # occurs if the previous selection is only an order change. ONLY in Debug mode
- # you get the phrase "Generate Pokemon teams for this challenge?", always
- # choose "No".
- #
- # 'PokemonSelection.hasValidTeam?(min, max, canCancel, acceptFainted)' returns
- # if your team is valid. If you try to use a invalid team (like putting the
- # minimum pokémon number as 3, but only having 2 pokémon), the selection is
- # treats as canceled. If the canCancel=false, the game goes in an infinite loop.
- #
- # Example: To make a 3vs3 battle, use 'PokemonSelection.choose(3,3)' and, after
- # the battle (regardless of result) use 'PokemonSelection.restore'. Only allows
- # the player to go in the battle if 'PokemonSelection.hasValidTeam?(3,3)' is
- # true, or set the minimum as 1.
- #
- # To perform only an order change, use
- # 'PokemonSelection.choose($Trainer,party.size,$Trainer,party.size,true,true)'.
- #
- # If you take a look in PokemonChallengeRules applications in scripts you can
- # customize some others choice conditions like have a certain level or ban
- # certain pokémon.
- #
- #===============================================================================
- module PokemonSelection
- def self.rules(min=1, max=6, canCancel=false, acceptFainted=false)
- ret=PokemonChallengeRules.new
- ret.setLevelAdjustment(OpenLevelAdjustment.new(PBExperience::MAXLEVEL))
- ret.addPokemonRule(AblePokemonRestriction.new) if !acceptFainted
- ret.ruleset.setNumberRange(min,max)
- return ret
- end
- def self.hasValidTeam?(min=1, max=6, canCancel=false, acceptFainted=false)
- pbBattleChallenge.set("pokemonSelectionRules",7,self.rules(min,max))
- ret=pbHasEligible?
- pbBattleChallenge.pbCancel
- return ret
- end
- def self.choose(min=1, max=6, canCancel=false, acceptFainted=false)
- if $PokemonGlobal.pokemonSelectionOriginalParty
- raise "Can't choose a new party until restore the old one"
- end
- validPartyChosen=false
- pbBattleChallenge.set("pokemonSelectionRules",7,self.rules(min,max))
- loop do
- pbEntryScreen
- validPartyChosen=(pbBattleChallenge.getParty!=nil)
- break if(canCancel || validPartyChosen)
- break if pbBattleChallenge.getParty==nil
- Kernel.pbMessage(_INTL("Choose a Pokémon."))
- end
- if validPartyChosen
- # If the party size is the same, it is only an order change
- if($Trainer.party.size != pbBattleChallenge.getParty.size)
- $PokemonGlobal.pokemonSelectionOriginalParty=$Trainer.party
- end
- $Trainer.party=pbBattleChallenge.getParty
- end
- pbBattleChallenge.pbCancel
- return validPartyChosen
- end
- def self.restore(*args)
- hasSavedTeam=($PokemonGlobal.pokemonSelectionOriginalParty!=nil)
- if hasSavedTeam
- $Trainer.party=$PokemonGlobal.pokemonSelectionOriginalParty
- $PokemonGlobal.pokemonSelectionOriginalParty=nil
- end
- return hasSavedTeam
- end
- end
- class PokemonRuleSet # Redefined to fix a bug
- def hasValidTeam?(team)
- if !team || team.length<self.minTeamLength
- return false
- end
- teamNumber=[self.maxLength,team.length].min
- validPokemon=[]
- for pokemon in team
- if isPokemonValid?(pokemon)
- validPokemon.push(pokemon)
- end
- end
- #if validPokemon.length<teamNumber # original
- if validPokemon.length<self.minLength # fixedd return falses ende if @teamRules.length>0
- pbEachCombination(team,teamNumber){|comb|
- if isValid?(comb)
- return true
- end
- }
- return false
- end
- return true
- end
- end
- class BattleChallenge; def getParty; return @bc.party; end; end
- class PokemonGlobalMetadata; attr_accessor :pokemonSelectionOriginalParty; end
- #----------------------------------------------------------------
- Temp Replace party example
- otherparty=$Trainer.party
- pok=PokeBattle_Pokemon.new(PBSpecies::MEWTWO,70,$Trainer)
- $Trainer.party=[pok]
- #---------------------------------------------------------------------
- Quote:
- Originally Posted by Rot8er_ConeX View Post
- There's probably a cleaner way of doing this, but here's how I'd do it, since AFAIK, pokemon.level is just a function that calculates itself based on pokemon.exp:
- In Pokemon_MultipleForms, around line 152 (in my game, though I think I added some stuff so it should be higher for you), do this
- Code:
- alias __mf_baseStats baseStats
- alias __mf_ability ability
- alias __mf_type1 type1
- alias __mf_type2 type2
- alias __mf_weight weight
- alias __mf_getMoveList getMoveList
- alias __mf_wildHoldItems wildHoldItems
- alias __mf_baseExp baseExp
- alias __mf_evYield evYield
- alias __mf_initialize initialize
- alias __mf_level level
- def level
- if $game_switches[98]
- return 100
- else
- return __mf_level
- end
- end
- Put the information shown in the picture attached, in the event data for the door that leads into the room where you want all Pokemon to be level 100. For the door that leads out, add something similar, but turn switch 98 OFF.
- Note, however, that this method affects Pokemon in both your party and opponents' parties, meaning if you wanted to do a room where the Devine Power Of Arceus is flowing through you and you show this by making your Pokemon level 100 and enemies' Pokemon level 1, this method wouldn't work. But I'm working under the assumption you just want to make something like the Battle Maison, where levels are equalized across the board.
- The levels are listed as 100, but the stats are still the same. Why is this?
- Old June 6th, 2016 (10:06 AM).
- Rot8er_ConeX's Avatar
- Rot8er_ConeX Rot8er_ConeX is offline
- Mystic
- Join Date: May 2015
- Location: The Dissa Region
- Gender: Male
- Posts: 823
- Quote:
- Originally Posted by Tigerfang98 View Post
- The levels are listed as 100, but the stats are still the same. Why is this?
- In your event, after turning the switch on, and again after turning the switch off, you need to add this as a script chunk:
- Code:
- for i in $Trainer.party
- i.calcStats
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement