Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.59 KB | None | 0 0
  1. Guys, for Power Construct I made this:
  2.  
  3. In 'PokeBattle_Battler' added:
  4. attr_accessor :captured
  5. attr_accessor :startform # Greninja, Zygarde and Minior
  6. attr_accessor :originalhp # Zygarde
  7.  
  8.  
  9. In ' def pbInitPokemon(pkmn,pkmnIndex)':
  10. @iv[4] = pkmn.iv[4]
  11. @iv[5] = pkmn.iv[5]
  12. @startform = @form # Minior
  13. @originalhp = @hp # Zygarde
  14. end
  15.  
  16. Inside ' def pbFaint(showMessage=true)':
  17. @pokemon.makeUnmega if self.isMega?
  18. @pokemon.makeUnprimal if self.isPrimal?
  19. if isConst?(self.species,PBSpecies,:GRENINJA); self.form=0; end
  20. if isConst?(self.species,PBSpecies,:MIMIKYU); self.form=0; end
  21. if isConst?(self.species,PBSpecies,:ZYGARDE) && self.form==2
  22. if self.startform>0; self.form=startform; else; self.form=rand(2); end
  23. end
  24. @fainted=true
  25. # reset choice
  26.  
  27. And works perfectly when Pokémon dies inside the battle.
  28.  
  29. To trigger the ability, I added below Moxie's code (inside PokeBattle_Battle script):
  30. for i in priority
  31. next if i.fainted?
  32. # Power Construct
  33. if i.hasWorkingAbility(:POWERCONSTRUCT) && isConst?(i.species,PBSpecies,:ZYGARDE)
  34. if i.hp<((i.totalhp/2).floor) && i.form!=2
  35. i.startform=i.form
  36. i.originalhp=i.hp
  37. i.form=2
  38. pbDisplay(_INTL("You sense the presence of many!"))
  39. pbCommonAnimation("PowerConstruct",i,nil)
  40. i.pbUpdate(true)
  41. scene.pbChangePokemon(i,i.pokemon)
  42. i.type1=getConst(PBTypes,:DRAGON); i.type2=getConst(PBTypes,:GROUND)
  43. pbCommonAnimation("PowerConstruct2",i,nil)
  44. pbDisplay(_INTL("{1} transformed into its Complete Forme!",i.pbThis))
  45. PBDebug.log("[Form changed] #{i.pbThis} changed to form #{i.form}")
  46. end
  47. end
  48.  
  49. But if I add here:
  50. def pbAfterBattle(decision,canlose)
  51. for i in $Trainer.party
  52. (i.makeUnmega rescue nil); (i.makeUnprimal rescue nil)
  53. if isConst?(i.species,PBSpecies,:GRENINJA); i.form=0; end
  54. if isConst?(i.species,PBSpecies,:MIMIKYU); i.form=0; end
  55. if isConst?(i.species,PBSpecies,:ZYGARDE) && i.form==2
  56. if i.startform>0; i.form=startform
  57. else; i.form=rand(2)
  58. end
  59. if originalhp>i.totalhp; i.hp=i.totalhp
  60. else; i.hp=originalhp
  61. end
  62. end
  63. end
  64. if $PokemonGlobal.partner
  65.  
  66.  
  67. After battle, give me error because the game didn't recognize 'startform' (possibly originalhp too). Here the issue:
  68. ---------------------------
  69. Pokemon Essentials
  70. ---------------------------
  71. [Pokémon Essentials version 17.2]
  72.  
  73. Exception: RuntimeError
  74.  
  75. Message: Script error within event 16 (coords 26,6), map 3 (Red's house):
  76.  
  77. Exception: NoMethodError
  78.  
  79. Message: PField_Battles:395:in `pbAfterBattle'undefined method `startform' for #<PokeBattle_Pokemon:0x9ae2ea8>
  80.  
  81. ***Full script:
  82.  
  83. #pbDoubleWildBattle(:KAKUNA,95,:METAPOD,100)
  84. pbWildBattle(:REGIGIGAS,55)
  85.  
  86.  
  87. Interpreter:243:in `pbExecuteScript'
  88.  
  89. PField_Battles:390:in `each'
  90.  
  91. PField_Battles:390:in `pbAfterBattle'
  92.  
  93. PField_Battles:102:in `pbWildBattle'
  94.  
  95. PField_Battles:98:in `pbBattleAnimation'
  96.  
  97. PField_Battles:98:in `pbWildBattle'
  98.  
  99. (eval):2:in `pbExecuteScript'
  100.  
  101. Interpreter:1606:in `eval'
  102.  
  103. Interpreter:243:in `pbExecuteScript'
  104.  
  105. Interpreter:1606:in `command_355'
  106.  
  107.  
  108.  
  109. Interpreter:276:in `pbExecuteScript'
  110.  
  111. Interpreter:1606:in `command_355'
  112.  
  113. Interpreter:494:in `execute_command'
  114.  
  115. Interpreter:193:in `update'
  116.  
  117. Interpreter:106:in `loop'
  118.  
  119. Interpreter:198:in `update'
  120.  
  121. Scene_Map:163:in `update'
  122.  
  123. Scene_Map:161:in `loop'
  124.  
  125. Scene_Map:170:in `update'
  126.  
  127. Scene_Map:234:in `main'
  128.  
  129.  
  130.  
  131.  
  132. What could be?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement