Advertisement
Guest User

Untitled

a guest
May 24th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.46 KB | None | 0 0
  1. #===============================================================================
  2. # * Pokémon Selection - by FL (Credits will be apreciated)
  3. #===============================================================================
  4. #
  5. # This script is for Pokémon Essentials. It makes a pokémon selection system
  6. # similar to Stadium/Battle Tower, where you can choose a certain number and
  7. # order of pokémon.
  8. #
  9. #===============================================================================
  10. #
  11. # To this script works, put it above main and use in script command
  12. # 'PokemonSelection.choose(min, max, canCancel, acceptFainted)' where min and
  13. # max are the minimum and maximum pokémon number selection (default values are
  14. # 1 and 6), canCancel when true the player can cancel the selection (default
  15. # is false) and acceptFainted that when true the player can choose fainted
  16. # pokémon and eggs (default is false). This method return if a party is choosen.
  17. #
  18. # To restore the previous party, use 'PokemonSelection.restore'. This do nothing
  19. # is there's no party to restore. Ths method returns if the party is restored.
  20. #
  21. # Between the two commands, don't allow the player to caught or deposit/withdraw
  22. # any pokémon or the pokémon will be lost! However, you pokémon can gain
  23. # exp/level, evolve, change hold item/moves normally. If you try to choose a
  24. # new party before restore the old one, the game raises an error. This won't
  25. # occurs if the previous selection is only an order change. ONLY in Debug mode
  26. # you get the phrase "Generate Pokemon teams for this challenge?", always
  27. # choose "No".
  28. #
  29. # 'PokemonSelection.hasValidTeam?(min, max, canCancel, acceptFainted)' returns
  30. # if your team is valid. If you try to use a invalid team (like putting the
  31. # minimum pokémon number as 3, but only having 2 pokémon), the selection is
  32. # treats as canceled. If the canCancel=false, the game goes in an infinite loop.
  33. #
  34. # Example: To make a 3vs3 battle, use 'PokemonSelection.choose(3,3)' and, after
  35. # the battle (regardless of result) use 'PokemonSelection.restore'. Only allows
  36. # the player to go in the battle if 'PokemonSelection.hasValidTeam?(3,3)' is
  37. # true, or set the minimum as 1.
  38. #
  39. # To perform only an order change, use
  40. # 'PokemonSelection.choose($Trainer,party.size,$Trainer,party.size,true,true)'.
  41. #
  42. # If you take a look in PokemonChallengeRules applications in scripts you can
  43. # customize some others choice conditions like have a certain level or ban
  44. # certain pokémon.
  45. #
  46. #===============================================================================
  47.  
  48. module PokemonSelection
  49. def self.rules(min=1, max=6, canCancel=false, acceptFainted=false)
  50. ret=PokemonChallengeRules.new
  51. ret.setLevelAdjustment(OpenLevelAdjustment.new(PBExperience::MAXLEVEL))
  52. ret.addPokemonRule(AblePokemonRestriction.new) if !acceptFainted
  53. ret.ruleset.setNumberRange(min,max)
  54. return ret
  55. end
  56.  
  57. def self.hasValidTeam?(min=1, max=6, canCancel=false, acceptFainted=false)
  58. pbBattleChallenge.set("pokemonSelectionRules",7,self.rules(min,max))
  59. ret=pbHasEligible?
  60. pbBattleChallenge.pbCancel
  61. return ret
  62. end
  63.  
  64. def self.choose(min=1, max=6, canCancel=false, acceptFainted=false)
  65. if $PokemonGlobal.pokemonSelectionOriginalParty
  66. raise "Can't choose a new party until restore the old one"
  67. end
  68. validPartyChosen=false
  69. pbBattleChallenge.set("pokemonSelectionRules",7,self.rules(min,max))
  70. loop do
  71. pbEntryScreen
  72. validPartyChosen=(pbBattleChallenge.getParty!=nil)
  73. break if(canCancel || validPartyChosen)
  74. break if pbBattleChallenge.getParty==nil
  75. Kernel.pbMessage(_INTL("Choose a Pokémon."))
  76. end
  77. if validPartyChosen
  78. # If the party size is the same, it is only an order change
  79. if($Trainer.party.size != pbBattleChallenge.getParty.size)
  80. $PokemonGlobal.pokemonSelectionOriginalParty=$Trainer.party
  81. end
  82. $Trainer.party=pbBattleChallenge.getParty
  83. end
  84. pbBattleChallenge.pbCancel
  85. return validPartyChosen
  86. end
  87.  
  88. def self.restore(*args)
  89. hasSavedTeam=($PokemonGlobal.pokemonSelectionOriginalParty!=nil)
  90. if hasSavedTeam
  91. $Trainer.party=$PokemonGlobal.pokemonSelectionOriginalParty
  92. $PokemonGlobal.pokemonSelectionOriginalParty=nil
  93. end
  94. return hasSavedTeam
  95. end
  96. end
  97.  
  98. class PokemonRuleSet # Redefined to fix a bug
  99. def hasValidTeam?(team)
  100. if !team || team.length<self.minTeamLength
  101. return false
  102. end
  103. teamNumber=[self.maxLength,team.length].min
  104. validPokemon=[]
  105. for pokemon in team
  106. if isPokemonValid?(pokemon)
  107. validPokemon.push(pokemon)
  108. end
  109. end
  110. #if validPokemon.length<teamNumber # original
  111. if validPokemon.length<self.minLength # fixedd return falses ende if @teamRules.length>0
  112. pbEachCombination(team,teamNumber){|comb|
  113. if isValid?(comb)
  114. return true
  115. end
  116. }
  117. return false
  118. end
  119. return true
  120. end
  121. end
  122.  
  123. class BattleChallenge; def getParty; return @bc.party; end; end
  124.  
  125. class PokemonGlobalMetadata; attr_accessor :pokemonSelectionOriginalParty; end
  126.  
  127.  
  128. #----------------------------------------------------------------
  129.  
  130. Temp Replace party example
  131. otherparty=$Trainer.party
  132. pok=PokeBattle_Pokemon.new(PBSpecies::MEWTWO,70,$Trainer)
  133. $Trainer.party=[pok]
  134.  
  135. #---------------------------------------------------------------------
  136. Quote:
  137. Originally Posted by Rot8er_ConeX View Post
  138. 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:
  139.  
  140. 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
  141.  
  142. Code:
  143. alias __mf_baseStats baseStats
  144. alias __mf_ability ability
  145. alias __mf_type1 type1
  146. alias __mf_type2 type2
  147. alias __mf_weight weight
  148. alias __mf_getMoveList getMoveList
  149. alias __mf_wildHoldItems wildHoldItems
  150. alias __mf_baseExp baseExp
  151. alias __mf_evYield evYield
  152. alias __mf_initialize initialize
  153. alias __mf_level level
  154.  
  155. def level
  156. if $game_switches[98]
  157. return 100
  158. else
  159. return __mf_level
  160. end
  161. end
  162. 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.
  163.  
  164. 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.
  165. The levels are listed as 100, but the stats are still the same. Why is this?
  166.  
  167. Old June 6th, 2016 (10:06 AM).
  168. Rot8er_ConeX's Avatar
  169. Rot8er_ConeX Rot8er_ConeX is offline
  170. Mystic
  171. Join Date: May 2015
  172. Location: The Dissa Region
  173. Gender: Male
  174. Posts: 823
  175. Quote:
  176. Originally Posted by Tigerfang98 View Post
  177. The levels are listed as 100, but the stats are still the same. Why is this?
  178. In your event, after turning the switch on, and again after turning the switch off, you need to add this as a script chunk:
  179.  
  180. Code:
  181. for i in $Trainer.party
  182. i.calcStats
  183. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement