Advertisement
Vendily

follow old

Aug 27th, 2018
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 81.10 KB | None | 0 0
  1. #===============================================================================
  2. # * Config Script For Your Game Here. Change the emo_ to what ever number is
  3. #        the cell holding the animation.
  4. #===============================================================================
  5. Following_Activated_Switch = 100      # Switch should be reserved
  6. Toggle_Following_Switch = 99         # Switch should be reserved
  7. Current_Following_Variable = 100       # Variable should be reserved
  8. CommonEvent = 4                       # Common Event space needed
  9. ItemWalk=99                           # Variable should be reserved
  10. Walking_Time_Variable = 98            # Variable should be reserved
  11. Walking_Item_Variable = 97            # Variable should be reserved
  12. Animation_Come_Out = 93              
  13. Animation_Come_In = 94
  14. Emo_Happy = 95
  15. Emo_Normal = 96
  16. Emo_Hate = 97
  17. Emo_Poison= 98
  18. Emo_sing= 99
  19. Emo_love= 100
  20.  
  21. # * Support for Pokemon Birthsigns script
  22. Emo_Cake= 92 if self.class.const_defined?(:PBBirthsigns) &&  self.class.const_get(:PBBirthsigns).instance_of?(::Module)
  23.  
  24. ALLOWTOGGLEFOLLOW = false             # Allow the player to toggle followers on/off
  25. ALLOWFIELDSWITCHING = true          # Allow the player to cycle through pokemon
  26. APPLYSTATUSTONES = false # Add tone to follower if statused
  27. #Status tones to be used, if the above is true (Red,Green,Blue,Gray)
  28. BURNTONE = [204,51,51,50]
  29. POISONTONE = [153,102,204,50]
  30. PARALYSISTONE = [255,255,153,50]
  31. FREEZETONE = [153,204,204,50]
  32. SLEEPTONE = [0,0,0,0]  # I did not use this tone, but you may if you wish
  33. ALWAYS_ANIMATE  = true # Follower sprite will always animated while standing still
  34. #Regardless of the above setting,the species in this array will always animate
  35. ALWAYS_ANIMATED_FOLLOWERS=[151]  # Mew
  36. #Add exclusions to always animated (small birds like Pidgey mostly hop, due to small wings)
  37. ALWAYS_ANIMATED_EXCEPTION=[16] #Pidgey
  38. #Removed for now
  39. #REGULAR_WALKING = true  
  40. WATERPOKEMONCANSURF = false  # Allow water pokemon to follow the player while surfing
  41. WATERPOKEMONCANDIVE = false #Allow water pokemon to follow the player while diving
  42. ALWAYS_ANIMATED_CAN_SURF = false #Pokemon that are always animated can follow you
  43.                                 # across water (flying, levitating, or specified)
  44.  
  45. #Don't change
  46. FOLLOWER_FILE_PATH = "Graphics/Characters/"
  47. #The subfolder where your follower sprites are located
  48. #Has to be within Graphics/Characters
  49. FOLLOWER_FILE_DIR = ""
  50.                                            
  51.  
  52. #===============================================================================
  53. # * Credit to Help-14 for both the original scripts and sprites
  54. # * Change Log:
  55. #===============================================================================
  56.  
  57. #===============================================================================
  58. # * Edited by zingzags
  59. #===============================================================================
  60. # * Fixed bugs
  61. # * Clean ups
  62. # * Fixed Surf Bug (After Surf is done)
  63. # * Fixed def talk_to_pokemon while in surf
  64. # * Fixed Surf Check
  65. # * Fixed Type Check
  66. # * Added Door Support
  67. # * Fixed Hp Bug
  68. # * Added Pokemon Center Support
  69. # * Animation problems
  70. # * Fixed Walk_time_variable problem
  71. # * Added random item loot
  72. # * Added egg check
  73. #===============================================================================
  74.  
  75. #===============================================================================
  76. # * Edited by Rayd12smitty
  77. # * Version 1.0
  78. #===============================================================================
  79. # * Fixed Walk_Time_Variable
  80. # * Fixed crash when talking to Pokemon on a different map than the original
  81. #   they appeared on
  82. # * Receiving Items from Pokemon now works
  83. # * Improved Talk_to_Pokemon wiht more messages and special messages
  84. # * Added messages for all Status Conditions
  85. # * Added Party Rotation to switch follower
  86. # * Made Following Pokemon Toggleable
  87. # * Added Animation for Pokemon coming out of Pokeball in sprite_refresh
  88. # * Tidied up script layout and made more user friendly
  89. # * Fixed Issues with Pokemon jumping around on ledges
  90. # * Fixed Badge for Surf Typo in the script
  91. #===============================================================================
  92. # * Version 1.1
  93. #===============================================================================
  94. # * Fixed Surfing so Pokemon doesn't reappear on water when toggled off
  95. # * Changed Layout and location of Toggle Script
  96. #===============================================================================
  97.  
  98. #===============================================================================
  99. # * Edited by Rayd12smitty and venom12
  100. # * Version 1.2
  101. #===============================================================================
  102. # * Fixed Walk step count so it doesn't add on when Pokemon is toggled off
  103. # * No longer have to manually set Toggle_Following_Switch and
  104. #   Following_Activated_Switch whenever "pbPokemonFollow(x)" is called
  105. # * Now supports Pokemon with multiple forms
  106. # * Items found on specific maps support
  107. # * Support for messages when on a map including a word/phrase in its name
  108. #   rather than a single map
  109. # * Added stepping animation for follower
  110. # * Fixed dismount bike so Pokemon reappears
  111. # * Fixed bike so if it couldn't be used it now can
  112. # * Few other small bike fixes
  113. #===============================================================================
  114.  
  115. #===============================================================================
  116. # * Version 1.3
  117. #===============================================================================
  118. # * Fixed bug with surf where the Follower could block the player from being
  119. #   able to surf, possibly stranding the player
  120. # * Added script to animate all events named "Poke"
  121. # * Increased time to find an item. I realize now that 5000 frames is less than
  122. #   5 min. Way too short.
  123. #===============================================================================
  124.  
  125. #===============================================================================
  126. # * Edited by mej71
  127. # * Version 1.4
  128. #===============================================================================
  129. # * Combined all into one script section for ease of installation
  130. # * Added setting to allow/disallow cycling through pokemon in field
  131. # * Added tone effect to following pokemon if statused
  132. # * Fixed follower grass animations
  133. # * NPCs won't walk over the follower
  134. # * Fixed crash caused by toggling follower when loading a map sometimes
  135. # * Prevent some HM usage when having a nonfollower dependent event
  136. #   so hopefully this will lead more towards support for regular dependent events
  137. # * Your followers don't automatically turn when you do, so it looks more natural
  138. # * There's a setting now to make pokemon always animate while you're standing still
  139. #   Note that flying, levitating, or any pokemon species specified will always animate
  140. #   regardless of this setting
  141. # *Reflected sprites support for followers
  142. # *Player transfer works a bit better, your follower shouldn't appear on top of
  143. #  you anymore
  144. # *There's a setting that allows water pokemon to follow you over water
  145. # *Additional setting allows flying, levitating, or other pokemon species to also
  146. #  follow you over water
  147. # *Sprite refreshes after evolution
  148. # *Blacking out won't cause errors
  149. # *v15.1 compatability
  150. # *Followers walk cycle works properly
  151. # *Move routes work properly (they worked in old versions, but were temporarily
  152. #  broken in my version)
  153. # *Pokemon get put away when transferring to a bike only map
  154. # *Follower gets checked when going underwater (water pokemon can follow underwater)
  155. # * Support for Pokemon Birthsigns script
  156. #===============================================================================
  157.  
  158. #===============================================================================
  159. # * To Do
  160. #===============================================================================
  161. # * None.  Perfect?
  162. #===============================================================================
  163.  
  164.  
  165.  
  166. #===============================================================================
  167. # * Control the following Pokemon
  168. # * Example:
  169. #     FollowingMoveRoute([
  170. #         PBMoveRoute::TurnRight,
  171. #         PBMoveRoute::Wait,4,
  172. #         PBMoveRoute::Jump,0,0
  173. #     ])
  174. # * The Pokemon turns Right, waits 4 frames, and then jumps
  175. # * Call pbPokeStep to animate all events on the map named "Poke"
  176. #===============================================================================
  177. def FollowingMoveRoute(commands,waitComplete=false)
  178.   return if $Trainer.party[0].hp<=0 || $Trainer.party[0].isEgg? ||
  179.       $game_variables[Current_Following_Variable]==0 ||
  180.       !$game_switches[Toggle_Following_Switch]
  181.   $PokemonTemp.dependentEvents.SetMoveRoute(commands,waitComplete)
  182. end
  183.  
  184. def pbPokeStep
  185.   for event in $game_map.events.values
  186.     if event.name=="Poke"              
  187.       pbMoveRoute(event,[PBMoveRoute::StepAnimeOn])
  188.     end
  189.   end
  190. end
  191. #===============================================================================
  192. # * Toggle for Following Pokemon
  193. #===============================================================================
  194. def pbToggleFollowingPokemon
  195.   return if $Trainer.party[0].hp<=0 || $Trainer.party[0].isEgg?
  196.   if $game_switches[Following_Activated_Switch]
  197.     if $game_switches[Toggle_Following_Switch]
  198.       $game_switches[Toggle_Following_Switch]=false
  199.       $PokemonTemp.dependentEvents.remove_sprite(true)
  200.       pbWait(1)      
  201.     else
  202.       $game_switches[Toggle_Following_Switch]=true
  203.       $PokemonTemp.dependentEvents.refresh_sprite
  204.       pbWait(1)
  205.      
  206.     end
  207.   end
  208. end
  209.  
  210.  
  211.  
  212. class DependentEvents
  213.   attr_accessor :realEvents
  214. #===============================================================================
  215. # Raises The Current Pokemon's Happiness level +1 per each time the
  216. # Walk_time_Variable reachs 5000 then resets to 0
  217. # ItemWalk, is when the variable reaches a certain amount, that you are able
  218. # to talk to your pokemon to recieve an item
  219. #===============================================================================
  220.   def add_following_time
  221.     if $game_switches[Toggle_Following_Switch] && $Trainer.party.length>=1
  222.       $game_variables[Walking_Time_Variable]+=1 if $game_variables[Current_Following_Variable]!=0
  223.       $game_variables[Walking_Item_Variable]+=1 if $game_variables[Current_Following_Variable]!=0
  224.       if $game_variables[Walking_Time_Variable]==5000
  225.         $Trainer.party[0].happiness+=1
  226.         $game_variables[Walking_Time_Variable]=0
  227.       end
  228.       if $game_variables[Walking_Item_Variable]==1000
  229.         if $game_variables[ItemWalk]==15
  230.         else
  231.           $game_variables[ItemWalk]+=1
  232.         end
  233.         $game_variables[Walking_Item_Variable]=0
  234.       end
  235.     end
  236.   end
  237. #===============================================================================
  238. # * refresh_sprite
  239. # * Updates the sprite sprite with an animation
  240. #===============================================================================
  241.   def refresh_sprite(animation=true)
  242.     if $game_variables[Current_Following_Variable]!=0
  243.       return unless $game_switches[Toggle_Following_Switch]
  244.       return if $PokemonGlobal.bicycle
  245.       if $Trainer.party[0].isShiny?
  246.         shiny=true
  247.       else
  248.         shiny=false
  249.       end
  250.       if $Trainer.party[0].form>0
  251.         form=$Trainer.party[0].form
  252.       else
  253.         form=nil
  254.       end
  255.       if defined?($Trainer.party[0].isShadow?)
  256.         shadow = $Trainer.party[0].isShadow?
  257.       else
  258.         shadow = false
  259.       end
  260.       if $PokemonGlobal.surfing
  261.         if $Trainer.party[0].hp>0 && !$Trainer.party[0].isEgg? && $Trainer.party[0].hasType?(:WATER)
  262.           events=$PokemonGlobal.dependentEvents
  263.           if animation
  264.             for i in 0...events.length
  265.               $scene.spriteset.addUserAnimation(Animation_Come_Out,@realEvents[i].x,@realEvents[i].y)
  266.               pbWait(10)
  267.             end
  268.           end
  269.           change_sprite($Trainer.party[0].species, shiny, false, form, $Trainer.party[0].gender, shadow)
  270.         elsif ALWAYS_ANIMATED_CAN_SURF && ($Trainer.party[0].hasType?(:FLYING) ||
  271.           isConst?($Trainer.party[0].ability,PBAbilities,:LEVITATE) ||
  272.           ALWAYS_ANIMATED_FOLLOWERS.include?($Trainer.party[0].species)) &&
  273.           !(ALWAYS_ANIMATED_EXCEPTION.include?($Trainer.party[0].species)) &&
  274.           $Trainer.party[0].hp>0 && !$Trainer.party[0].isEgg?
  275.           events=$PokemonGlobal.dependentEvents
  276.           if animation
  277.             for i in 0...events.length
  278.               $scene.spriteset.addUserAnimation(Animation_Come_Out,@realEvents[i].x,@realEvents[i].y)
  279.               pbWait(10)
  280.             end
  281.           end
  282.           change_sprite($Trainer.party[0].species, shiny, false, form, $Trainer.party[0].gender, shadow)
  283.         else
  284.           remove_sprite(false)
  285.         end  
  286.       elsif $PokemonGlobal.diving
  287.         if $Trainer.party[0].hp>0 && !$Trainer.party[0].isEgg? && $Trainer.party[0].hasType?(:WATER) && WATERPOKEMONCANDIVE
  288.           events=$PokemonGlobal.dependentEvents
  289.           if animation
  290.             for i in 0...events.length
  291.               $scene.spriteset.addUserAnimation(Animation_Come_Out,@realEvents[i].x,@realEvents[i].y)
  292.               pbWait(10)
  293.             end
  294.           end
  295.           change_sprite($Trainer.party[0].species, shiny, false, form, $Trainer.party[0].gender, shadow)
  296.         else
  297.           remove_sprite(false)
  298.         end  
  299.       else
  300.         if $Trainer.party[0].hp>0 && !$Trainer.party[0].isEgg? && $scene.is_a?(Scene_Map)
  301.           events=$PokemonGlobal.dependentEvents
  302.           if animation
  303.             for i in 0...events.length
  304.               $scene.spriteset.addUserAnimation(Animation_Come_Out,@realEvents[i].x,@realEvents[i].y)
  305.               pbWait(10)
  306.             end
  307.           end
  308.           change_sprite($Trainer.party[0].species, shiny, false, form, $Trainer.party[0].gender, shadow)
  309.         elsif $Trainer.party[0].hp<=0 || $Trainer.party[0].isEgg?
  310.           remove_sprite(animation)
  311.         end
  312.       end
  313.     else
  314.       check_faint
  315.     end
  316.   end
  317. #===============================================================================
  318. # * change_sprite(id, shiny, animation)
  319. # * Example, to change sprite to shiny lugia with animation:
  320. #     change_sprite(249, true, true)
  321. # * If just change sprite:
  322. #     change_sprite(249)
  323. #===============================================================================
  324.   def change_sprite(id, shiny=nil, animation=nil, form=nil, gender=nil, shadow=false)
  325.     events=$PokemonGlobal.dependentEvents
  326.     for i in 0...events.length
  327.       if events[i] && events[i][8]=="Dependent"
  328.         tgender = (gender==1)? "f" : ""
  329.         tshiny  = (shiny)? "s" : ""
  330.         tform   = (form && form>0) ? "_#{form}" : ""
  331.         tshadow = (shadow)? "_shadow": ""
  332.         speciesname = getConstantName(PBSpecies,id)
  333.         bitmapFileName=sprintf("%s%s%s%s%s",speciesname,tgender,tshiny,tform,tshadow)
  334.         if pbResolveBitmap(FOLLOWER_FILE_PATH+FOLLOWER_FILE_DIR+bitmapFileName)
  335.           events[i][6] = FOLLOWER_FILE_DIR+bitmapFileName
  336.           @realEvents[i].character_name=FOLLOWER_FILE_DIR+bitmapFileName
  337.         else
  338.           bitmapFileName=sprintf("%s%s",speciesname,tshiny)
  339.           if pbResolveBitmap(FOLLOWER_FILE_PATH+FOLLOWER_FILE_DIR+bitmapFileName)
  340.             events[i][6] = FOLLOWER_FILE_DIR+bitmapFileName
  341.             @realEvents[i].character_name=FOLLOWER_FILE_DIR+bitmapFileName
  342.           else
  343.             bitmapFileName=sprintf("%s",speciesname)
  344.             if pbResolveBitmap(FOLLOWER_FILE_PATH+FOLLOWER_FILE_DIR+bitmapFileName)
  345.               events[i][6] = FOLLOWER_FILE_DIR+bitmapFileName
  346.               @realEvents[i].character_name=FOLLOWER_FILE_DIR+bitmapFileName
  347.             else  
  348.               bitmapFileName=sprintf("%03d%s%s%s%s",id,tgender,tshiny,tform,tshadow)
  349.               if pbResolveBitmap(FOLLOWER_FILE_PATH+FOLLOWER_FILE_DIR+bitmapFileName)
  350.                 events[i][6] = FOLLOWER_FILE_DIR+bitmapFileName
  351.                 @realEvents[i].character_name=FOLLOWER_FILE_DIR+bitmapFileName
  352.               else  
  353.                 bitmapFileName=sprintf("%03d%s%s%s",id,tshiny,tform,tshadow)
  354.                 if pbResolveBitmap(FOLLOWER_FILE_PATH+FOLLOWER_FILE_DIR+bitmapFileName)
  355.                   events[i][6] = FOLLOWER_FILE_DIR+bitmapFileName
  356.                   @realEvents[i].character_name=FOLLOWER_FILE_DIR+bitmapFileName
  357.                 else
  358.                   bitmapFileName=sprintf("%03d%s",id,tshiny)
  359.                   if pbResolveBitmap(FOLLOWER_FILE_PATH+FOLLOWER_FILE_DIR+bitmapFileName)
  360.                     events[i][6] = FOLLOWER_FILE_DIR+bitmapFileName
  361.                     @realEvents[i].character_name=FOLLOWER_FILE_DIR+bitmapFileName
  362.                   else
  363.                     bitmapFileName=sprintf("%03d",id)
  364.                     events[i][6] = FOLLOWER_FILE_DIR+bitmapFileName
  365.                     @realEvents[i].character_name=FOLLOWER_FILE_DIR+bitmapFileName
  366.                   end
  367.                 end
  368.               end
  369.             end
  370.           end
  371.         end
  372.         if animation
  373.           $scene.spriteset.addUserAnimation(Animation_Come_Out,@realEvents[i].x,@realEvents[i].y)
  374.         end
  375.         $game_variables[Walking_Time_Variable]=0
  376.       end
  377.     end
  378.   end
  379. #===============================================================================
  380. # * update_stepping
  381. # * Adds step animation for followers
  382. #===============================================================================  
  383.   def update_stepping
  384.     FollowingMoveRoute([PBMoveRoute::StepAnimeOn])
  385.   end
  386.  
  387.   def stop_stepping
  388.     FollowingMoveRoute([PBMoveRoute::StepAnimeOff])
  389.   end
  390. #===============================================================================
  391. # * remove_sprite(animation)
  392. # * Example, to remove sprite with animation:
  393. #     remove_sprite(true)
  394. # * If just remove sprite:
  395. #     remove_sprite
  396. #===============================================================================
  397.   def remove_sprite(animation=nil)
  398.     events=$PokemonGlobal.dependentEvents
  399.     for i in 0...events.length
  400.       if events[i] && events[i][8]=="Dependent"
  401.         events[i][6]=sprintf("nil")
  402.         @realEvents[i].character_name=sprintf("nil")
  403.         if animation==true
  404.           $scene.spriteset.addUserAnimation(Animation_Come_In,@realEvents[i].x,@realEvents[i].y)
  405.           pbWait(10)
  406.         end
  407.         $game_variables[Current_Following_Variable]=$Trainer.party[0]
  408.         $game_variables[Walking_Time_Variable]=0
  409.       end
  410.     end
  411.   end
  412. #===============================================================================
  413. # * check_surf(animation)
  414. # * If current Pokemon is a water Pokemon, it is still following.
  415. # * If current Pokemon is not a water Pokemon, remove sprite.
  416. # * Require Water_Pokemon_Can_Surf = true to enable
  417. #===============================================================================
  418.   def check_surf(animation=nil)
  419.     if $Trainer.party[0].hp>0 && !$Trainer.party[0].isEgg?
  420.       if ALWAYS_ANIMATED_CAN_SURF && ($Trainer.party[0].hasType?(:FLYING) ||
  421.         isConst?($Trainer.party[0].ability,PBAbilities,:LEVITATE) ||
  422.         ALWAYS_ANIMATED_FOLLOWERS.include?($Trainer.party[0].species)) &&
  423.         !(ALWAYS_ANIMATED_EXCEPTION.include?($Trainer.party[0].species))
  424.        
  425.           #do nothing
  426.       elsif $Trainer.party[0].hasType?(:WATER) && WATERPOKEMONCANSURF
  427.         #do nothing
  428.       else
  429.         remove_sprite(animation)
  430.       end
  431.      
  432.     end
  433.   end
  434. #===============================================================================
  435. # * talk_to_pokemon
  436. # * It will run when you talk to Pokemon following
  437. #===============================================================================
  438.   def talk_to_pokemon
  439.     e=$Trainer.party[0]
  440.     events=$PokemonGlobal.dependentEvents
  441.     for i in 0...events.length
  442.       if events[i] && events[i][8]=="Dependent"
  443.         pos_x=@realEvents[i].x
  444.         pos_y=@realEvents[i].y
  445.         case $game_player.direction
  446.         when 2 # Facing Down
  447.           return if $game_player.x != pos_x
  448.           return if $game_player.y != pos_y-1
  449.         when 4 # Facing Left
  450.           return if $game_player.x != pos_x+1
  451.           return if $game_player.y != pos_y
  452.         when 6 # Facing Right
  453.           return if $game_player.x != pos_x-1
  454.           return if $game_player.y != pos_y
  455.         when 8 # Facing Up
  456.           return if $game_player.x != pos_x
  457.           return if $game_player.y != pos_y+1
  458.         else
  459.           return false
  460.         end
  461.       end
  462.     end
  463.     if e != 0
  464.       if e.hp > 0 && !$Trainer.party[0].isEgg?        
  465.         if $PokemonGlobal.bicycle
  466.           return
  467.         elsif $PokemonGlobal.surfing
  468.           flag = true
  469.           if WATERPOKEMONCANSURF && $Trainer.party[0].hasType?(:WATER)
  470.             flag = false
  471.           elsif ALWAYS_ANIMATED_CAN_SURF && ($Trainer.party[0].hasType?(:FLYING) ||
  472.               isConst?($Trainer.party[0].ability,PBAbilities,:LEVITATE) ||
  473.               ALWAYS_ANIMATED_FOLLOWERS.include?($Trainer.party[0].species)) &&
  474.               !(ALWAYS_ANIMATED_EXCEPTION.include?($Trainer.party[0].species))
  475.             flag = false
  476.           end
  477.           return if flag
  478.         elsif $PokemonGlobal.diving && (!WATERPOKEMONCANDIVE || !$Trainer.party[0].hasType?(:WATER))
  479.           return
  480.         end
  481. #===============================================================================
  482. # * Checks to make sure the Pokemon isn't blocking a surfable water surface
  483. # * If the water is blocked by the sprite (even though it is invisible) and
  484. #   the player should be able to surf, calls surf
  485. #===============================================================================
  486.         terrain=Kernel.pbFacingTerrainTag
  487.         notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
  488.         if PBTerrain.isWater?(terrain) || !notCliff
  489.           if !pbGetMetadata($game_map.map_id,MetadataBicycleAlways) && !$PokemonGlobal.surfing
  490.             if $DEBUG
  491.               Kernel.pbSurf
  492.               return
  493.             elsif (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
  494.               Kernel.pbSurf
  495.               return
  496.             end
  497.           end
  498.         end
  499. #===============================================================================
  500. # * talk_to_pokemon when possible begins here
  501. #===============================================================================
  502.         if e != 6 && $game_switches[Toggle_Following_Switch]==true
  503.           pbPlayCry(e.species)
  504.           random1=rand(7) # random message if no special conditions apply
  505.           mapname=$game_map.name # Get's current map name
  506. #===============================================================================
  507. # * Pokemon Messages when Status Condition
  508. #===============================================================================          
  509.           if e.hp <= e.totalhp / 4
  510.             $scene.spriteset.addUserAnimation(Emo_Normal, pos_x, pos_y-2)
  511.             pbWait(70)
  512.             Kernel.pbMessage(_INTL("{1} is weak from its injuries.",e.name))
  513.            
  514.           elsif e.status==PBStatuses::POISON && e.hp>0 && !e.isEgg? # Pokemon Poisoned
  515.             $scene.spriteset.addUserAnimation(Emo_Poison, pos_x, pos_y-2)
  516.             pbWait(120)
  517.             Kernel.pbMessage(_INTL("{1} is shivering with the effects of being poisoned.",e.name))
  518.            
  519.           elsif e.status==PBStatuses::BURN && e.hp>0 && !e.isEgg? # Pokemon Burned
  520.             $scene.spriteset.addUserAnimation(Emo_Hate, pos_x, pos_y-2)
  521.             pbWait(70)
  522.             Kernel.pbMessage(_INTL("{1}'s burn looks painful.",e.name))
  523.            
  524.           elsif e.status==PBStatuses::FROZEN && e.hp>0 && !e.isEgg? # Pokemon Frozen
  525.             $scene.spriteset.addUserAnimation(Emo_Normal, pos_x, pos_y-2)
  526.             pbWait(100)
  527.             Kernel.pbMessage(_INTL("{1} seems very cold. It's frozen solid!",e.name))
  528.          
  529.           elsif e.status==PBStatuses::SLEEP && e.hp>0 && !e.isEgg? # Pokemon Asleep
  530.             $scene.spriteset.addUserAnimation(Emo_Normal, pos_x, pos_y-2)
  531.             pbWait(100)
  532.             Kernel.pbMessage(_INTL("{1} seems really tired.",e.name))
  533.            
  534.           elsif e.status==PBStatuses::PARALYSIS && e.hp>0 && !e.isEgg? # Pokemon Paralyzed
  535.             $scene.spriteset.addUserAnimation(Emo_Normal, pos_x, pos_y-2)
  536.             pbWait(100)
  537.             Kernel.pbMessage(_INTL("{1} is standing still and twitching.",e.name))
  538. #===============================================================================
  539. # * Pokemon is holding an item on a Specific Map
  540. #===============================================================================          
  541.           elsif $game_variables[ItemWalk]==15 and mapname=="Item Map" # Pokemon has item and is on map "Item Map"
  542.             items=[:MASTERBALL,:MASTERBALL] # This array can be edited and extended. Look at the one below for a guide
  543.             random2=0
  544.             loop do
  545.               random2=rand(items.length)
  546.               break if hasConst?(PBItems,items[random2])
  547.             end
  548.             Kernel.pbMessage(_INTL("{1} seems to be holding something.",e.name))
  549.             Kernel.pbPokemonFound(getConst(PBItems,items[random2]))
  550.             $game_variables[ItemWalk]=0
  551. #===============================================================================
  552. # * Pokemon is holding an item on any other map
  553. #===============================================================================            
  554.           elsif $game_variables[ItemWalk]==15 # Pokemon has Item
  555.             items=[:POTION,:SUPERPOTION,:FULLRESTORE,:REVIVE,:PPUP,
  556.                  :PPMAX,:RARECANDY,:REPEL,:MAXREPEL,:ESCAPEROPE,
  557.                  :HONEY,:TINYMUSHROOM,:PEARL,:NUGGET,:GREATBALL,
  558.                  :ULTRABALL,:THUNDERSTONE,:MOONSTONE,:SUNSTONE,:DUSKSTONE,
  559.                  :REDAPRICORN,:BLUAPRICORN,:YLWAPRICORN,:GRNAPRICORN,:PNKAPRICORN,
  560.                  :BLKAPRICORN,:WHTAPRICORN
  561.             ]
  562.             random2=0
  563.             loop do
  564.               random2=rand(items.length)
  565.               break if hasConst?(PBItems,items[random2])
  566.             end
  567.  
  568.             Kernel.pbMessage(_INTL("{1} seems to be holding something.",e.name))
  569.             Kernel.pbPokemonFound(getConst(PBItems,items[random2]))
  570.             $game_variables[ItemWalk]=0
  571. #===============================================================================
  572. # * Examples of Map Specific Messages
  573. #===============================================================================
  574.           elsif mapname=="Dusk Forest" && e.hasType?(:BUG) # Bug Type in Dusk Forest
  575.             $scene.spriteset.addUserAnimation(Emo_sing, pos_x, pos_y-2)
  576.             pbWait(50)
  577.             random3=rand(3)
  578.             if random3==0
  579.               Kernel.pbMessage(_INTL("{1} seems highly interested in the trees.",e.name,$Trainer.name))
  580.             elsif random3==1
  581.               Kernel.pbMessage(_INTL("{1} seems to enjoy the buzzing of the bug Pokémon.",e.name,$Trainer.name))
  582.             elsif random3==2
  583.               Kernel.pbMessage(_INTL("{1} is jumping around restlessly in the forest.",e.name,$Trainer.name))
  584.             end
  585.          
  586.           elsif mapname=="Old Lab" # In the Old Lab
  587.             $scene.spriteset.addUserAnimation(Emo_Normal, pos_x, pos_y-2)
  588.             pbWait(100)
  589.             random3=rand(3)
  590.             if random3==0
  591.               Kernel.pbMessage(_INTL("{1} is touching some kind of switch.",e.name,$Trainer.name))
  592.             elsif random3==1
  593.               Kernel.pbMessage(_INTL("{1} has a cord in its mouth!",e.name,$Trainer.name))
  594.             elsif random3==2
  595.               Kernel.pbMessage(_INTL("{1} seems to want to touch the machinery.",e.name,$Trainer.name))
  596.             end  
  597.            
  598.           elsif mapname=="\PN's House" # In the Player's Home
  599.             $scene.spriteset.addUserAnimation(Emo_Happy, pos_x, pos_y-2)
  600.             pbWait(70)
  601.             random3=rand(3)
  602.             if random3==0
  603.               Kernel.pbMessage(_INTL("{1} is sniffing around the room.",e.name,$Trainer.name))
  604.             elsif random3==1
  605.               Kernel.pbMessage(_INTL("{1} noticed {2}'s dad is nearby.",e.name,$Trainer.name))
  606.             elsif random3==2
  607.               Kernel.pbMessage(_INTL("{1} seems to want to settle down at home.",e.name,$Trainer.name))
  608.             end
  609. #===============================================================================
  610. # * Pokemon Messages when birthday
  611. # * Support for Pokemon Birthsigns script
  612. #===============================================================================          
  613.           elsif defined?(e.isBirthday?) && e.isBirthday?
  614.             $scene.spriteset.addUserAnimation(Emo_Cake, pos_x, pos_y-2)
  615.             pbWait(50)
  616.             messages=rand(10)
  617.             case messages
  618.             when 0
  619.               Kernel.pbMessage(_INTL("{1} seems to be reminiscing on all it has learned in the last year.",e.name,$Trainer.name))
  620.             when 1
  621.               Kernel.pbMessage(_INTL("{1} seems glad to be spending its birthday with {2}.",e.name,$Trainer.name))
  622.             when 2
  623.               Kernel.pbMessage(_INTL("{1} is having the best birthday ever!",e.name,$Trainer.name))
  624.             when 3
  625.               Kernel.pbMessage(_INTL("{1} can't believe its been a whole year already!",e.name,$Trainer.name))
  626.             when 4
  627.               Kernel.pbMessage(_INTL("{1} seems to be sniffing around for presents...",e.name,$Trainer.name))
  628.             when 5
  629.               Kernel.pbMessage(_INTL("{1} seems a bit out of breath...\nYou're getting old!",e.name,$Trainer.name))
  630.             when 6
  631.               Kernel.pbMessage(_INTL("{1} looks ready to party!",e.name,$Trainer.name))
  632.             when 7
  633.               Kernel.pbMessage(_INTL("You wish {1} a happy birthday.\nHappy birthday, {1}!",e.name,$Trainer.name))
  634.             when 8
  635.               Kernel.pbMessage(_INTL("{1} seems to be looking forward to another year with {2}.",e.name,$Trainer.name))
  636.             when 9
  637.               Kernel.pbMessage(_INTL("{1} wants to eat some cake!",e.name,$Trainer.name))
  638.             end
  639. #===============================================================================
  640. # * Random Messages if none of the above apply
  641. #===============================================================================            
  642.           elsif random1==0 # Music Note
  643.             $scene.spriteset.addUserAnimation(Emo_sing, pos_x, pos_y-2)
  644.             pbWait(50)
  645.             random3=rand(5)
  646.             if random3==0
  647.               Kernel.pbMessage(_INTL("{1} seems to want to play with {2}.",e.name,$Trainer.name))
  648.             elsif random3==1
  649.               Kernel.pbMessage(_INTL("{1} is singing and humming.",e.name,$Trainer.name))
  650.             elsif random3==2
  651.               Kernel.pbMessage(_INTL("{1} is looking up at the sky.",e.name,$Trainer.name))
  652.             elsif random3==3
  653.               Kernel.pbMessage(_INTL("{1} swayed and danced around as it pleased.",e.name,$Trainer.name))
  654.             elsif random3==4
  655.               Kernel.pbMessage(_INTL("{1} is pulling out the grass.",e.name,$Trainer.name))
  656.             end
  657.            
  658.           elsif random1==1 # Hate/Angry Face
  659.             $scene.spriteset.addUserAnimation(Emo_Hate, pos_x, pos_y-2)
  660.             pbWait(70)
  661.             random3=rand(5)
  662.             if random3==0
  663.               Kernel.pbMessage(_INTL("{1} let out a roar!",e.name,$Trainer.name))
  664.             elsif random3==1
  665.               Kernel.pbMessage(_INTL("{1} is making a face like it's angry!",e.name,$Trainer.name))
  666.             elsif random3==2
  667.               Kernel.pbMessage(_INTL("{1} seems to be angry for some reason.",e.name,$Trainer.name))
  668.             elsif random3==3
  669.               Kernel.pbMessage(_INTL("{1} chewed on your feet.",e.name,$Trainer.name))
  670.             elsif random3==4
  671.               Kernel.pbMessage(_INTL("{1} is trying to be intimidating.",e.name,$Trainer.name))
  672.             end
  673.            
  674.           elsif random1==2 # ... Emoji
  675.             $scene.spriteset.addUserAnimation(Emo_Normal, pos_x, pos_y-2)
  676.             pbWait(70)
  677.             random3=rand(5)
  678.             if random3==0
  679.               Kernel.pbMessage(_INTL("{1} is looking down steadily.",e.name,$Trainer.name))
  680.             elsif random3==1
  681.               Kernel.pbMessage(_INTL("{1} is sniffing at the floor.",e.name,$Trainer.name))
  682.             elsif random3==2
  683.               Kernel.pbMessage(_INTL("{1} is concentrating deeply.",e.name,$Trainer.name))
  684.             elsif random3==3
  685.               Kernel.pbMessage(_INTL("{1} faced this way and nodded.",e.name,$Trainer.name))
  686.             elsif random3==4
  687.               Kernel.pbMessage(_INTL("{1} is glaring straight into {2}'s eyes.",e.name,$Trainer.name))
  688.             end
  689.            
  690.           elsif random1==3 # Happy Face
  691.             $scene.spriteset.addUserAnimation(Emo_Happy, pos_x, pos_y-2)
  692.             pbWait(70)
  693.             random3=rand(5)
  694.             if random3==0
  695.               Kernel.pbMessage(_INTL("{1} began poking you in the stomach.",e.name,$Trainer.name))
  696.             elsif random3==1
  697.               Kernel.pbMessage(_INTL("{1} looks very happy.",e.name,$Trainer.name))
  698.             elsif random3==2
  699.               Kernel.pbMessage(_INTL("{1} happily cuddled up to you.",e.name,$Trainer.name))
  700.             elsif random3==3
  701.               Kernel.pbMessage(_INTL("{1} is so happy that it can't stand still.",e.name,$Trainer.name))
  702.             elsif random3==4
  703.               Kernel.pbMessage(_INTL("{1} looks like it wants to lead!",e.name,$Trainer.name))
  704.             end
  705.            
  706.           elsif random1==4 # Heart Emoji
  707.             $scene.spriteset.addUserAnimation(Emo_love, pos_x, pos_y-2)
  708.             pbWait(70)
  709.             random3=rand(5)
  710.             if random3==0
  711.               Kernel.pbMessage(_INTL("{1} suddenly started walking closer.",e.name,$Trainer.name))
  712.             elsif random3==1
  713.               Kernel.pbMessage(_INTL("Woah! {1} suddenly hugged {2}.",e.name,$Trainer.name))
  714.             elsif random3==2
  715.               Kernel.pbMessage(_INTL("{1} is rubbing up against you.",e.name,$Trainer.name))
  716.             elsif random3==3
  717.               Kernel.pbMessage(_INTL("{1} is keeping close to {2}.",e.name,$Trainer.name))
  718.             elsif random3==4
  719.               Kernel.pbMessage(_INTL("{1} blushed.",e.name,$Trainer.name))
  720.             end
  721.            
  722.           elsif random1==5 # No Emoji
  723.             random3=rand(5)
  724.             if random3==0
  725.               Kernel.pbMessage(_INTL("{1} spun around in a circle!",e.name,$Trainer.name))
  726.             elsif random3==1
  727.               pbPlayCry(e)
  728.               Kernel.pbMessage(_INTL("{1} let our a battle cry.",e.name,$Trainer.name))
  729.             elsif random3==2
  730.               Kernel.pbMessage(_INTL("{1} is on the lookout!",e.name,$Trainer.name))
  731.             elsif random3==3
  732.               Kernel.pbMessage(_INTL("{1} is standing patiently.",e.name,$Trainer.name))
  733.             elsif random3==4
  734.               Kernel.pbMessage(_INTL("{1} is looking around restlessly.",e.name,$Trainer.name))
  735.             end
  736. #===============================================================================
  737. # * This random message shows the Pokemon's Happiness Level
  738. #===============================================================================            
  739.           elsif random1==6 # Check Happiness Level
  740.             if e.happiness>0 && e.happiness<=50
  741.               $scene.spriteset.addUserAnimation(Emo_Hate, pos_x, pos_y-2)
  742.               pbWait(70)
  743.               Kernel.pbMessage(_INTL("{1} hates to travel with {2}.",e.name,$Trainer.name))
  744.             elsif e.happiness>50 && e.happiness<=100
  745.               $scene.spriteset.addUserAnimation(Emo_Normal, pos_x, pos_y-2)
  746.               pbWait(100)
  747.               Kernel.pbMessage(_INTL("{1} is still unsure about traveling with {2} is a good thing or not.",e.name,$Trainer.name))
  748.             elsif e.happiness>100 && e.happiness<150
  749.               $scene.spriteset.addUserAnimation(Emo_Happy, pos_x, pos_y-2)
  750.               Kernel.pbMessage(_INTL("{1} is happy traveling with {2}.",e.name,$Trainer.name))
  751.             elsif e.happiness>=150
  752.               $scene.spriteset.addUserAnimation(Emo_love, pos_x, pos_y-2)
  753.               pbWait(70)
  754.               Kernel.pbMessage(_INTL("{1} loves traveling with {2}.",e.name,$Trainer.name))
  755.             end
  756.           end
  757.         else
  758.         end
  759.     end
  760.   end
  761. end
  762. #===============================================================================
  763. # * Pokemon reapear after using surf
  764. #===============================================================================
  765. def Come_back(shiny=nil, animation=nil)
  766.   return if !$game_variables[Following_Activated_Switch]
  767.   return if $Trainer.party.length==0
  768.   $PokemonTemp.dependentEvents.pbMoveDependentEvents
  769.   events=$PokemonGlobal.dependentEvents
  770.   if $game_variables[Current_Following_Variable]==$Trainer.party[0]
  771.     remove_sprite(false)
  772.     if $scene.is_a?(Scene_Map)
  773.       for i in 0...events.length
  774.         $scene.spriteset.addUserAnimation(Animation_Come_Out,@realEvents[i].x,@realEvents[i].y)
  775.       end
  776.     end
  777.   end
  778.   if $Trainer.party[0].hp>0 && !$Trainer.party[0].isEgg?
  779.     $game_variables[Current_Following_Variable]=$Trainer.party[0]
  780.     refresh_sprite(animation)
  781.   end
  782.   for i in 0...events.length
  783.     if events[i] && events[i][8]=="Dependent"
  784.       id = $Trainer.party[0].species
  785.       tgender = ($Trainer.party[0].gender==1)? "f" : ""
  786.       tshiny  = ($Trainer.party[0].isShiny?)? "s" : ""
  787.       tform   = ($Trainer.party[0].form && $Trainer.party[0].form>0) ? "_#{$Trainer.party[0].form}" : ""
  788.       tshadow = ($Trainer.party[0].shadow)? "_shadow": ""
  789.       speciesname = getConstantName(PBSpecies,id)
  790.       bitmapFileName=sprintf("%s%s%s%s%s",speciesname,tgender,tshiny,tform,tshadow)
  791.       if pbResolveBitmap(FOLLOWER_FILE_PATH+FOLLOWER_FILE_DIR+bitmapFileName)
  792.         events[i][6] = FOLLOWER_FILE_DIR+bitmapFileName
  793.         @realEvents[i].character_name=FOLLOWER_FILE_DIR+bitmapFileName
  794.       else
  795.         bitmapFileName=sprintf("%s%s",speciesname,tshiny)
  796.         if pbResolveBitmap(FOLLOWER_FILE_PATH+FOLLOWER_FILE_DIR+bitmapFileName)
  797.           events[i][6] = FOLLOWER_FILE_DIR+bitmapFileName
  798.           @realEvents[i].character_name=FOLLOWER_FILE_DIR+bitmapFileName
  799.         else
  800.           bitmapFileName=sprintf("%s",speciesname)
  801.           if pbResolveBitmap(FOLLOWER_FILE_PATH+FOLLOWER_FILE_DIR+bitmapFileName)
  802.             events[i][6] = FOLLOWER_FILE_DIR+bitmapFileName
  803.             @realEvents[i].character_name=FOLLOWER_FILE_DIR+bitmapFileName
  804.           else  
  805.             bitmapFileName=sprintf("%03d%s%s%s%s",id,tgender,tshiny,tform,tshadow)
  806.             if pbResolveBitmap(FOLLOWER_FILE_PATH+FOLLOWER_FILE_DIR+bitmapFileName)
  807.               events[i][6] = FOLLOWER_FILE_DIR+bitmapFileName
  808.               @realEvents[i].character_name=FOLLOWER_FILE_DIR+bitmapFileName
  809.             else  
  810.               bitmapFileName=sprintf("%03d%s",id,tshiny)
  811.               if pbResolveBitmap(FOLLOWER_FILE_PATH+FOLLOWER_FILE_DIR+bitmapFileName)
  812.                 events[i][6] = FOLLOWER_FILE_DIR+bitmapFileName
  813.                 @realEvents[i].character_name=FOLLOWER_FILE_DIR+bitmapFileName
  814.               else
  815.                 bitmapFileName=sprintf("%03d",id)
  816.                 events[i][6] = FOLLOWER_FILE_DIR+bitmapFileName
  817.                 @realEvents[i].character_name=FOLLOWER_FILE_DIR+bitmapFileName
  818.               end
  819.             end
  820.           end
  821.         end
  822.       end
  823.     end
  824.   end
  825. end
  826. #===============================================================================
  827. # * check_faint
  828. # * If current Pokemon is fainted, removes the sprite
  829. #===============================================================================
  830. def check_faint
  831.   return if !$game_switches[Following_Activated_Switch] || $Trainer.party.length<=0
  832.   if $PokemonGlobal.bicycle
  833.     return
  834.   elsif $PokemonGlobal.diving && WATERPOKEMONCANDIVE && $Trainer.party[0].hasType?(:WATER)
  835.     return
  836.   elsif $PokemonGlobal.surfing && WATERPOKEMONCANSURF && $Trainer.party[0].hasType?(:WATER)
  837.     return
  838.   elsif $PokemonGlobal.surfing && ALWAYS_ANIMATED_CAN_SURF && ($Trainer.party[0].hasType?(:FLYING) ||
  839.         isConst?($Trainer.party[0].ability,PBAbilities,:LEVITATE) ||
  840.         ALWAYS_ANIMATED_FOLLOWERS.include?($Trainer.party[0].species)) &&
  841.         !(ALWAYS_ANIMATED_EXCEPTION.include?($Trainer.party[0].species))
  842.     return
  843.   else
  844.     if $Trainer.party[0].hp<=0
  845.       $game_variables[Current_Following_Variable]=0
  846.       remove_sprite
  847.     elsif $Trainer.party[0].hp>0 && !$Trainer.party[0].isEgg? && $game_variables[Current_Following_Variable]==0
  848.         $game_variables[Current_Following_Variable]=$Trainer.party[0]
  849.         refresh_sprite
  850.     end
  851.   end
  852. end
  853. #===============================================================================
  854. # * SetMoveRoute
  855. # * Used in the "Control Following Pokemon" Script listed farther above
  856. #===============================================================================
  857. def SetMoveRoute(commands,waitComplete=true)
  858.     events=$PokemonGlobal.dependentEvents
  859.     for i in 0...events.length
  860.       if events[i] && events[i][8]=="Dependent"
  861.         pbMoveRoute(@realEvents[i],commands,waitComplete)
  862.       end
  863.     end
  864.   end
  865. end
  866.  
  867.  
  868.  
  869. #===============================================================================
  870. # * Update followers for surfing
  871. # * Non-follower dependent events not allowed
  872. #===============================================================================
  873. def Kernel.pbSurf
  874.   if $game_player.pbHasDependentEvents? && !$game_switches[Following_Activated_Switch]
  875.     return false
  876.   end
  877.   if $DEBUG ||
  878.     (HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
  879.     movefinder=Kernel.pbCheckMove(:SURF)
  880.     if movefinder || $DEBUG
  881.       if Kernel.pbConfirmMessage(_INTL("The water is dyed a deep blue...  Would you like to surf?"))
  882.         speciesname=!movefinder ? $Trainer.name : movefinder.name
  883.         Kernel.pbMessage(_INTL("{1} used Surf!",speciesname))
  884.         pbHiddenMoveAnimation(movefinder)
  885.         surfbgm=pbGetMetadata(0,MetadataSurfBGM)
  886.         $PokemonTemp.dependentEvents.check_surf(true)
  887.         if surfbgm
  888.           pbCueBGM(surfbgm,0.5)
  889.         end
  890.         pbStartSurfing(movefinder)
  891.         return true
  892.       end
  893.     end
  894.   end
  895.   return false
  896. end
  897.  
  898. alias follow_pbStartSurfing pbStartSurfing
  899. def pbStartSurfing(movefinder=nil)
  900.   follow_pbStartSurfing(movefinder)
  901.   $PokemonGlobal.surfing=true
  902. end
  903.  
  904. alias follow_pbEndSurf pbEndSurf
  905. def pbEndSurf(xOffset,yOffset)
  906.   ret = follow_pbEndSurf(xOffset,yOffset)
  907.   if $game_switches[Toggle_Following_Switch] && ret && $game_variables[Current_Following_Variable]!=0
  908.     if WATERPOKEMONCANSURF && $Trainer.party[0].hasType?(:WATER)
  909.       $PokemonTemp.dependentEvents.Come_back($Trainer.party[0].isShiny?,false)
  910.     elsif ALWAYS_ANIMATED_CAN_SURF && ($Trainer.party[0].hasType?(:FLYING) ||
  911.         isConst?($Trainer.party[0].ability,PBAbilities,:LEVITATE) ||
  912.         ALWAYS_ANIMATED_FOLLOWERS.include?($Trainer.party[0].species)) &&
  913.         !(ALWAYS_ANIMATED_EXCEPTION.include?($Trainer.party[0].species))
  914.         $PokemonTemp.dependentEvents.Come_back($Trainer.party[0].isShiny?,false)
  915.     else
  916.       $PokemonTemp.dependentEvents.Come_back(true)
  917.     end
  918.   end
  919. end
  920.  
  921. #===============================================================================
  922. # * Auto add Script to Kernel.pbCanUseHiddenMove, fix HM bug
  923. # * Fixed so non-pokemon follower dependent events will return false
  924. #===============================================================================
  925. def Kernel.pbCanUseHiddenMove?(pkmn,move)
  926.   case move
  927.     when PBMoves::FLY
  928.       if !$DEBUG && !$Trainer.badges[BADGEFORFLY]
  929.         Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
  930.         return false
  931.       end
  932.      if $game_player.pbHasDependentEvents? && !$game_switches[Following_Activated_Switch]
  933.        Kernel.pbMessage(_INTL("You can't use that if you have someone with you."))
  934.        return false
  935.      end
  936.       if !pbGetMetadata($game_map.map_id,MetadataOutdoor)
  937.         Kernel.pbMessage(_INTL("Can't use that here."))
  938.         return false
  939.       end
  940.       return true
  941.     when PBMoves::CUT
  942.       if !$DEBUG && !$Trainer.badges[BADGEFORCUT]
  943.         Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
  944.         return false
  945.       end
  946.       facingEvent=$game_player.pbFacingEvent
  947.       if !facingEvent || facingEvent.name!="Tree"
  948.         Kernel.pbMessage(_INTL("Can't use that here."))
  949.         return false
  950.       end
  951.       return true
  952.     when PBMoves::HEADBUTT
  953.       facingEvent=$game_player.pbFacingEvent
  954.       if !facingEvent || facingEvent.name!="HeadbuttTree"
  955.         Kernel.pbMessage(_INTL("Can't use that here."))
  956.         return false
  957.       end
  958.       return true
  959.     when PBMoves::SURF
  960.       terrain=Kernel.pbFacingTerrainTag
  961.       if !$DEBUG && !$Trainer.badges[BADGEFORSURF]
  962.         Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
  963.         return false
  964.       end
  965.       if $PokemonGlobal.surfing
  966.         Kernel.pbMessage(_INTL("You're already surfing."))
  967.         return false
  968.       end
  969.       if $game_player.pbHasDependentEvents? && !$game_switches[Following_Activated_Switch]
  970.          Kernel.pbMessage(_INTL("You can't use that if you have someone with you."))
  971.          return false
  972.       end
  973.       terrain=Kernel.pbFacingTerrainTag
  974.       if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
  975.         Kernel.pbMessage(_INTL("Let's enjoy cycling!"))
  976.         return false
  977.       end
  978.       if !PBTerrain.isWater?(terrain)
  979.         Kernel.pbMessage(_INTL("No surfing here!"))
  980.         return false
  981.       end
  982.       return true
  983.     when PBMoves::STRENGTH
  984.       if !$DEBUG && !$Trainer.badges[BADGEFORSTRENGTH]
  985.         Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
  986.         return false
  987.       end
  988.       facingEvent=$game_player.pbFacingEvent
  989.       if !facingEvent || facingEvent.name!="Boulder"
  990.         Kernel.pbMessage(_INTL("Can't use that here."))
  991.         return false
  992.       end
  993.       return true  
  994.     when PBMoves::ROCKSMASH
  995.       terrain=Kernel.pbFacingTerrainTag
  996.       if !$DEBUG && !$Trainer.badges[BADGEFORROCKSMASH]
  997.         Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
  998.         return false
  999.       end
  1000.       facingEvent=$game_player.pbFacingEvent
  1001.       if !facingEvent || facingEvent.name!="Rock"
  1002.         Kernel.pbMessage(_INTL("Can't use that here."))
  1003.         return false
  1004.       end
  1005.       return true  
  1006.     when PBMoves::FLASH
  1007.       if !$DEBUG && !$Trainer.badges[BADGEFORFLASH]
  1008.         Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
  1009.         return false
  1010.       end
  1011.       if !pbGetMetadata($game_map.map_id,MetadataDarkMap)
  1012.         Kernel.pbMessage(_INTL("Can't use that here."))
  1013.         return false
  1014.       end
  1015.       if $PokemonGlobal.flashUsed
  1016.         Kernel.pbMessage(_INTL("This is in use already."))
  1017.         return false
  1018.       end
  1019.       return true
  1020.     when PBMoves::WATERFALL
  1021.       if !$DEBUG && !$Trainer.badges[BADGEFORWATERFALL]
  1022.         Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
  1023.         return false
  1024.       end
  1025.       terrain=Kernel.pbFacingTerrainTag
  1026.       if terrain!=PBTerrain::Waterfall
  1027.         Kernel.pbMessage(_INTL("Can't use that here."))
  1028.         return false
  1029.       end
  1030.       return true
  1031.     when PBMoves::DIVE
  1032.       if !$DEBUG && !$Trainer.badges[BADGEFORDIVE]
  1033.         Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
  1034.         return false
  1035.       end
  1036.       if $PokemonGlobal.diving
  1037.         return true
  1038.       end
  1039.       if $game_player.terrain_tag!=PBTerrain::DeepWater
  1040.         Kernel.pbMessage(_INTL("Can't use that here."))
  1041.         return false
  1042.       end
  1043.       if !pbGetMetadata($game_map.map_id,MetadataDiveMap)
  1044.         Kernel.pbMessage(_INTL("Can't use that here."))
  1045.         return false
  1046.       end
  1047.       return true
  1048.     when PBMoves::TELEPORT
  1049.       if !pbGetMetadata($game_map.map_id,MetadataOutdoor)
  1050.         Kernel.pbMessage(_INTL("Can't use that here."))
  1051.         return false
  1052.       end
  1053.      if $game_player.pbHasDependentEvents? && !$game_switches[Following_Activated_Switch]
  1054.        Kernel.pbMessage(_INTL("You can't use that if you have someone with you."))
  1055.        return false
  1056.      end
  1057.       healing=$PokemonGlobal.healingSpot
  1058.       if !healing
  1059.         healing=pbGetMetadata(0,MetadataHome) # Home
  1060.       end
  1061.       if healing
  1062.         mapname=pbGetMapNameFromId(healing[0])
  1063.         if Kernel.pbConfirmMessage(_INTL("Want to return to the healing spot used last in {1}?",mapname))
  1064.           return true
  1065.         end
  1066.         return false
  1067.       else
  1068.         Kernel.pbMessage(_INTL("Can't use that here."))
  1069.         return false
  1070.       end
  1071.     when PBMoves::DIG
  1072.       escape=($PokemonGlobal.escapePoint rescue nil)
  1073.       if !escape || escape.empty?
  1074.         Kernel.pbMessage(_INTL("Can't use that here."))
  1075.         return false
  1076.       end
  1077.       if $game_player.pbHasDependentEvents? && !$game_switches[Following_Activated_Switch]
  1078.         Kernel.pbMessage(_INTL("You can't use that if you have someone with you."))
  1079.         return false
  1080.       end
  1081.       mapname=pbGetMapNameFromId(escape[0])
  1082.       if Kernel.pbConfirmMessage(_INTL("Want to escape from here and return to {1}?",mapname))
  1083.         return true
  1084.       end
  1085.       return false
  1086.     when PBMoves::SWEETSCENT
  1087.       return true
  1088.     else
  1089.       return HiddenMoveHandlers.triggerCanUseMove(move,pkmn)
  1090.     end
  1091.   return false
  1092. end
  1093.  
  1094.  
  1095. #===============================================================================
  1096. # * Modifies bike scripts to properly affect the follower sprites
  1097. #===============================================================================
  1098. module Kernel
  1099.   class << self
  1100.     alias follow_pbDismountBike pbDismountBike
  1101.     alias follow_pbMountBike pbMountBike
  1102.     alias follow_pbCancelVehicles pbCancelVehicles
  1103.   end
  1104.  
  1105.   def self.pbDismountBike
  1106.     return if !$PokemonGlobal.bicycle
  1107.     ret=follow_pbDismountBike
  1108.     if $game_switches[Toggle_Following_Switch]
  1109.       $PokemonTemp.dependentEvents.Come_back(true)
  1110.     end
  1111.     $PokemonTemp.dependentEvents.refresh_sprite
  1112.     return ret
  1113.   end
  1114.  
  1115.   def self.pbMountBike
  1116.     ret=follow_pbMountBike
  1117.     if $game_switches[Toggle_Following_Switch]
  1118.       if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
  1119.         $PokemonTemp.dependentEvents.remove_sprite
  1120.       else
  1121.         $PokemonTemp.dependentEvents.remove_sprite(true)
  1122.       end
  1123.     end
  1124.     return ret
  1125.   end
  1126.  
  1127.   def self.pbCancelVehicles(destination=nil)
  1128.     if $game_switches[Toggle_Following_Switch] && ($PokemonGlobal.bicycle ||
  1129.                                                     $PokemonGlobal.diving) &&
  1130.                                                     destination.nil?
  1131.       $PokemonTemp.dependentEvents.Come_back(false)
  1132.     end
  1133.     return follow_pbCancelVehicles(destination)
  1134.   end
  1135.  
  1136. end
  1137.  
  1138. #===============================================================================
  1139. # * Replaces pbBikeCheck
  1140. # * Can still reject for dependent events if the pokemon follower has been removed
  1141. #===============================================================================
  1142. def pbBikeCheck
  1143.   if $PokemonGlobal.surfing ||
  1144.      (!$PokemonGlobal.bicycle && pbGetTerrainTag==PBTerrain::TallGrass)
  1145.     Kernel.pbMessage(_INTL("Can't use that here."))
  1146.     return false
  1147.   end
  1148.   if $game_player.pbHasDependentEvents? && !$game_switches[Following_Activated_Switch]
  1149.     Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
  1150.     return false
  1151.   end
  1152.   if $PokemonGlobal.bicycle
  1153.     if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)
  1154.       Kernel.pbMessage(_INTL("You can't dismount your Bike here."))
  1155.       return false
  1156.     end
  1157.     return true
  1158.   else
  1159.     val=pbGetMetadata($game_map.map_id,MetadataBicycle)
  1160.     val=pbGetMetadata($game_map.map_id,MetadataOutdoor) if val==nil
  1161.     if !val
  1162.       Kernel.pbMessage(_INTL("Can't use that here."))
  1163.       return false
  1164.     end
  1165.     return true
  1166.   end
  1167. end
  1168.  
  1169.  
  1170.  
  1171. #===============================================================================
  1172. # * Refresh follower after accessing TrainerPC
  1173. #===============================================================================
  1174.  
  1175. alias follow_pbTrainerPC pbTrainerPC
  1176. def pbTrainerPC
  1177.   follow_pbTrainerPC
  1178.   $PokemonTemp.dependentEvents.refresh_sprite
  1179. end
  1180.  
  1181. #===============================================================================
  1182. # * Refresh follower after accessing TrainerPC
  1183. #===============================================================================
  1184. class TrainerPC
  1185.  
  1186.   alias follow_access access
  1187.   def access
  1188.     follow_access
  1189.     $PokemonTemp.dependentEvents.refresh_sprite
  1190.   end
  1191. end
  1192.  
  1193. #===============================================================================
  1194. # * Auto add Script to pbPokeCenterPC
  1195. #===============================================================================
  1196. alias follow_pbPokeCenterPC pbPokeCenterPC
  1197. def pbPokeCenterPC
  1198.   follow_pbPokeCenterPC
  1199.   $PokemonTemp.dependentEvents.refresh_sprite
  1200. end
  1201.  
  1202. #===============================================================================
  1203. #Fix for followers having animations (grass, etc) when toggled off
  1204. #Treats followers as if they are under a bridge when toggled
  1205. #===============================================================================
  1206. alias follow_pbGetTerrainTag pbGetTerrainTag
  1207. def pbGetTerrainTag(event=nil,countBridge=false)
  1208.   ret=follow_pbGetTerrainTag(event,countBridge)
  1209.   if event && event!=$game_player
  1210.     for devent in $PokemonGlobal.dependentEvents
  1211.       if event.id==devent[1] && (!$game_switches[Toggle_Following_Switch] ||
  1212.                                   $Trainer.party.length==0 ||
  1213.                                   $Trainer.party[0].isEgg? || $Trainer.party[0].hp<=0)
  1214.         ret = PBTerrain::Bridge
  1215.         break
  1216.       end
  1217.     end
  1218.   end
  1219.   return ret
  1220. end
  1221.  
  1222.  
  1223.  
  1224.  
  1225. #===============================================================================
  1226. # * Start Pokemon Following
  1227. # * x is the Event ID that will become the follower
  1228. #===============================================================================
  1229. def pbPokemonFollow(x)
  1230.   Kernel.pbAddDependency2(x, "Dependent", CommonEvent)
  1231.   $PokemonTemp.dependentEvents.refresh_sprite
  1232.   $PokemonTemp.dependentEvents.Come_back(nil,false)
  1233.   $game_switches[Following_Activated_Switch]=true
  1234.   $game_switches[Toggle_Following_Switch]=true
  1235. end
  1236.  
  1237.  
  1238. def pbTestPass(follower,x,y,direction=nil)
  1239.   return $MapFactory.isPassable?(follower.map.map_id,x,y,follower)
  1240. end
  1241.  
  1242.  
  1243. class DependentEvents
  1244.  
  1245.   def pbFollowEventAcrossMaps(leader,follower,instant=false,leaderIsTrueLeader=true)
  1246.     d=leader.direction
  1247.     areConnected=$MapFactory.areConnected?(leader.map.map_id,follower.map.map_id)
  1248.     # Get the rear facing tile of leader
  1249.     facingDirection=[0,0,8,0,6,0,4,0,2][d]
  1250.     if !leaderIsTrueLeader && areConnected
  1251.       relativePos=$MapFactory.getThisAndOtherEventRelativePos(leader,follower)
  1252.       if (relativePos[1]==0 && relativePos[0]==2) # 2 spaces to the right of leader
  1253.         facingDirection=6
  1254.       elsif (relativePos[1]==0 && relativePos[0]==-2) # 2 spaces to the left of leader
  1255.         facingDirection=4
  1256.       elsif relativePos[1]==-2 && relativePos[0]==0 # 2 spaces above leader
  1257.         facingDirection=8
  1258.       elsif relativePos[1]==2 && relativePos[0]==0 # 2 spaces below leader
  1259.         facingDirection=2
  1260.       end
  1261.     end
  1262.     facings=[facingDirection] # Get facing from behind
  1263.     facings.push([0,0,4,0,8,0,2,0,6][d]) # Get right facing
  1264.     facings.push([0,0,6,0,2,0,8,0,4][d]) # Get left facing
  1265.     if !leaderIsTrueLeader
  1266.       facings.push([0,0,2,0,4,0,6,0,8][d]) # Get forward facing
  1267.     end
  1268.     mapTile=nil
  1269.     if areConnected
  1270.       bestRelativePos=-1
  1271.       oldthrough=follower.through
  1272.       follower.through=false
  1273.       for i in 0...facings.length
  1274.         facing=facings[i]
  1275.         tile=$MapFactory.getFacingTile(facing,leader)
  1276.         passable=tile && $MapFactory.isPassable?(tile[0],tile[1],tile[2],follower)
  1277.         if passable && !$PokemonGlobal.surfing
  1278.           passable=!PBTerrain.isWater?($MapFactory.getTerrainTag(tile[0],tile[1],tile[2]))
  1279.         end
  1280.         if i==0 && !passable && tile &&
  1281.            $MapFactory.getTerrainTag(tile[0],tile[1],tile[2],true)==PBTerrain::Ledge
  1282.           # If the tile isn't passable and the tile is a ledge,
  1283.           # get tile from further behind
  1284.           tile=$MapFactory.getFacingTileFromPos(tile[0],tile[1],tile[2],facing)
  1285.           passable=tile && $MapFactory.isPassable?(tile[0],tile[1],tile[2],follower)
  1286.           if passable && !$PokemonGlobal.surfing
  1287.             passable=!PBTerrain.isWater?($MapFactory.getTerrainTag(tile[0],tile[1],tile[2]))
  1288.           end
  1289.         end
  1290.         if passable
  1291.           relativePos=$MapFactory.getThisAndOtherPosRelativePos(
  1292.              follower,tile[0],tile[1],tile[2])
  1293.           distance=Math.sqrt(relativePos[0]*relativePos[0]+relativePos[1]*relativePos[1])
  1294.           if bestRelativePos==-1 || bestRelativePos>distance
  1295.             bestRelativePos=distance
  1296.             mapTile=tile
  1297.           end
  1298.           if i==0 && distance<=1 # Prefer behind if tile can move up to 1 space
  1299.             break
  1300.           end
  1301.         end
  1302.       end
  1303.       follower.through=oldthrough
  1304.     else
  1305.       tile=$MapFactory.getFacingTile(facings[0],leader)
  1306.       passable=tile && $MapFactory.isPassable?(
  1307.          tile[0],tile[1],tile[2],follower)
  1308.       mapTile=passable ? mapTile : nil
  1309.     end
  1310.     if mapTile && follower.map.map_id==mapTile[0]
  1311.       # Follower is on same map
  1312.       newX=mapTile[1]
  1313.       newY=mapTile[2]
  1314.       deltaX=(d == 6 ? -1 : d == 4 ? 1 : 0)
  1315.       deltaY=(d == 2 ? -1 : d == 8 ? 1 : 0)
  1316.       posX = newX + deltaX
  1317.       posY = newY + deltaY
  1318.       follower.move_speed=leader.move_speed # sync movespeed
  1319.       if (follower.x-newX==-1 && follower.y==newY) ||
  1320.          (follower.x-newX==1 && follower.y==newY) ||
  1321.          (follower.y-newY==-1 && follower.x==newX) ||
  1322.          (follower.y-newY==1 && follower.x==newX)
  1323.         if instant
  1324.           follower.moveto(newX,newY)
  1325.         else
  1326.           pbFancyMoveTo(follower,newX,newY)
  1327.         end
  1328.       elsif (follower.x-newX==-2 && follower.y==newY) ||
  1329.             (follower.x-newX==2 && follower.y==newY) ||
  1330.             (follower.y-newY==-2 && follower.x==newX) ||
  1331.             (follower.y-newY==2 && follower.x==newX)
  1332.         if instant
  1333.           follower.moveto(newX,newY)
  1334.         else
  1335.           pbFancyMoveTo(follower,newX,newY)
  1336.         end
  1337.       elsif follower.x!=posX || follower.y!=posY
  1338.         if instant
  1339.           follower.moveto(newX,newY)
  1340.         else
  1341.           pbFancyMoveTo(follower,posX,posY)
  1342.           pbFancyMoveTo(follower,newX,newY)
  1343.         end
  1344.       end
  1345.       #pbTurnTowardEvent(follower,leader)
  1346.     else
  1347.       if !mapTile
  1348.         # Make current position into leader's position
  1349.         mapTile=[leader.map.map_id,leader.x,leader.y]
  1350.       end
  1351.       if follower.map.map_id==mapTile[0]
  1352.         # Follower is on same map as leader
  1353.         follower.moveto(leader.x,leader.y)
  1354.         #pbTurnTowardEvent(follower,leader)
  1355.       else
  1356.         # Follower will move to different map
  1357.         events=$PokemonGlobal.dependentEvents
  1358.         eventIndex=pbEnsureEvent(follower,mapTile[0])
  1359.         if eventIndex>=0
  1360.           newFollower=@realEvents[eventIndex]
  1361.           newEventData=events[eventIndex]
  1362.           newFollower.moveto(mapTile[1],mapTile[2])
  1363.           newEventData[3]=mapTile[1]
  1364.           newEventData[4]=mapTile[2]
  1365.           if mapTile[0]==leader.map.map_id
  1366.             #pbTurnTowardEvent(follower,leader)
  1367.           end
  1368.         end
  1369.       end
  1370.     end
  1371.   end
  1372.  
  1373.   #Fix follower not being in the same spot upon save
  1374.   def pbMapChangeMoveDependentEvents
  1375.     return
  1376.   end
  1377. end
  1378.  
  1379.  
  1380.  
  1381. class DependentEventSprites
  1382.  
  1383.   attr_accessor :sprites
  1384.  
  1385.   def refresh
  1386.     for sprite in @sprites
  1387.       sprite.dispose
  1388.     end
  1389.     @sprites.clear
  1390.     $PokemonTemp.dependentEvents.eachEvent {|event,data|
  1391.        if data[0]==@map.map_id # Check original map
  1392.          #@map.events[data[1]].erase
  1393.        end
  1394.        if data[2]==@map.map_id # Check current map
  1395.          spr = Sprite_Character.new(@viewport,event)
  1396.          @sprites.push(spr)
  1397.        end
  1398.     }
  1399.   end
  1400.  
  1401.   def update
  1402.     if $PokemonTemp.dependentEvents.lastUpdate != @lastUpdate
  1403.       refresh
  1404.       @lastUpdate=$PokemonTemp.dependentEvents.lastUpdate
  1405.     end
  1406.     for sprite in @sprites
  1407.       sprite.update
  1408.     end
  1409.     for i in 0...@sprites.length
  1410.       pbDayNightTint(@sprites[i])
  1411.       if $game_switches[Toggle_Following_Switch] && APPLYSTATUSTONES && $Trainer.party[0] && $Trainer.party[0].hp>0
  1412.         case $Trainer.party[0].status
  1413.         when PBStatuses::BURN
  1414.           @sprites[i].tone.set(@sprites[i].tone.red+BURNTONE[0],@sprites[i].tone.green+BURNTONE[1],@sprites[i].tone.blue+BURNTONE[2],@sprites[i].tone.gray+BURNTONE[3])
  1415.         when PBStatuses::POISON
  1416.           @sprites[i].tone.set(@sprites[i].tone.red+POISONTONE[0],@sprites[i].tone.green+POISONTONE[1],@sprites[i].tone.blue+POISONTONE[2],@sprites[i].tone.gray+POISONTONE[3])
  1417.         when PBStatuses::PARALYSIS
  1418.           @sprites[i].tone.set(@sprites[i].tone.red+PARALYSISTONE[0],@sprites[i].tone.green+PARALYSISTONE[1],@sprites[i].tone.blue+PARALYSISTONE[2],@sprites[i].tone.gray+PARALYSISTONE[3])
  1419.         when PBStatuses::FROZEN
  1420.           @sprites[i].tone.set(@sprites[i].tone.red+FREEZETONE[0],@sprites[i].tone.green+FREEZETONE[1],@sprites[i].tone.blue+FREEZETONE[2],@sprites[i].tone.gray+FREEZETONE[3])
  1421.         when PBStatuses::SLEEP
  1422.           @sprites[i].tone.set(@sprites[i].tone.red+SLEEPTONE[0],@sprites[i].tone.green+SLEEPTONE[1],@sprites[i].tone.blue+SLEEPTONE[2],@sprites[i].tone.gray+SLEEPTONE[3])
  1423.         end
  1424.       end
  1425.     end
  1426.   end
  1427.  
  1428. end
  1429.  
  1430.  
  1431. #Refresh following pokemon after switching pokemon around
  1432. class PokemonScreen
  1433.  
  1434.   alias follow_pbSwitch pbSwitch
  1435.   def pbSwitch(oldid,newid)
  1436.     follow_pbSwitch(oldid,newid)
  1437.     $PokemonTemp.dependentEvents.refresh_sprite(false)
  1438.   end
  1439.  
  1440.   alias follow_pbRefreshSingle pbRefreshSingle
  1441.   def pbRefreshSingle(pkmnid)
  1442.     follow_pbRefreshSingle(pkmnid)
  1443.     $PokemonTemp.dependentEvents.refresh_sprite(false)
  1444.   end
  1445.  
  1446. end
  1447.  
  1448. #Refresh after evolution
  1449. class PokemonEvolutionScene
  1450.  
  1451.   alias follow_pbEndScreen pbEndScreen
  1452.   def pbEndScreen
  1453.     follow_pbEndScreen
  1454.     if @pokemon==$Trainer.party[0]
  1455.       $PokemonTemp.dependentEvents.refresh_sprite(false)
  1456.     end
  1457.   end
  1458.  
  1459. end
  1460.  
  1461. #Update follower's following time
  1462. class Game_Player < Game_Character
  1463.  
  1464.   alias follow_update update
  1465.   def update
  1466.     follow_update
  1467.     $PokemonTemp.dependentEvents.add_following_time
  1468.   end
  1469.  
  1470.   alias follow_moveto moveto
  1471.   def moveto(x,y)
  1472.     ret = follow_moveto(x,y)
  1473.     events=$PokemonGlobal.dependentEvents
  1474.     leader=$game_player
  1475.     for i in 0...events.length
  1476.       event=$PokemonTemp.dependentEvents.realEvents[i]
  1477.       $PokemonTemp.dependentEvents.pbFollowEventAcrossMaps(leader,event,true,i==0)
  1478.     end
  1479.     return ret
  1480.   end
  1481.  
  1482. end
  1483.  
  1484. #Update follower after battle
  1485. class PokeBattle_Scene
  1486.  
  1487.   alias follow_pbEndBattle pbEndBattle
  1488.   def pbEndBattle(result)
  1489.     follow_pbEndBattle(result)
  1490.     $PokemonTemp.dependentEvents.check_faint
  1491.   end
  1492.  
  1493. end
  1494.  
  1495. #Script for when a pokemon finds an item in the field
  1496. class PokemonField
  1497.  
  1498.   def Kernel.pbPokemonFound(item,quantity=1,plural=nil)
  1499.     itemname=PBItems.getName(item)
  1500.     pocket=pbGetPocket(item)
  1501.     e=$Trainer.party[0].name
  1502.     if $PokemonBag.pbStoreItem(item,quantity)
  1503.       pbWait(5)
  1504.       if $ItemData[item][ITEMUSE]==3 || $ItemData[item][ITEMUSE]==4
  1505.         Kernel.pbMessage(_INTL("\\se[]{1} found {2}!\\se[itemlevel]\\nIt contained {3}.\\wtnp[30]",e,itemname,PBMoves.getName($ItemData[item][ITEMMACHINE])))
  1506.         Kernel.pbMessage(_INTL("{1} put the {2}\r\nin the {3} Pocket.",$Trainer.name,itemname,PokemonBag.pocketNames()[pocket]))
  1507.       elsif PBItems.const_defined?(:LEFTOVERS) && isConst?(item,PBItems,:LEFTOVERS)
  1508.         Kernel.pbMessage(_INTL("\\se[]{1} found some {2}!\\se[itemlevel]\\wtnp[30]",e,itemname))
  1509.         Kernel.pbMessage(_INTL("{1} put the {2}\r\nin the {3} Pocket.",$Trainer.name,itemname,PokemonBag.pocketNames()[pocket]))
  1510.       else
  1511.         if quantity>1
  1512.           if plural
  1513.             Kernel.pbMessage(_INTL("\\se[]{1} found {2} {3}!\\se[itemlevel]\\wtnp[30]",e,quantity,plural))
  1514.             Kernel.pbMessage(_INTL("{1} put the {2}\r\nin the {3} Pocket.",$Trainer.name,plural,PokemonBag.pocketNames()[pocket]))
  1515.           else
  1516.             Kernel.pbMessage(_INTL("\\se[]{1} found {2} {3}s!\\se[itemlevel]\\wtnp[30]",e,quantity,itemname))
  1517.             Kernel.pbMessage(_INTL("{1} put the {2}s\r\nin the {3} Pocket.",$Trainer.name,itemname,PokemonBag.pocketNames()[pocket]))
  1518.           end
  1519.         else
  1520.           Kernel.pbMessage(_INTL("\\se[]{1} found one {2}!\\se[itemlevel]\\wtnp[30]",e,itemname))
  1521.           Kernel.pbMessage(_INTL("{1} put the {2}\r\nin the {3} Pocket.",$Trainer.name,itemname,PokemonBag.pocketNames()[pocket]))
  1522.         end
  1523.       end
  1524.       return true
  1525.     else   # Can't add the item
  1526.       if $ItemData[item][ITEMUSE]==3 || $ItemData[item][ITEMUSE]==4
  1527.         Kernel.pbMessage(_INTL("{1} found {2}!\\wtnp[20]",e,itemname))
  1528.       elsif PBItems.const_defined?(:LEFTOVERS) && isConst?(item,PBItems,:LEFTOVERS)
  1529.         Kernel.pbMessage(_INTL("{1} found some {2}!\\wtnp[20]",$Trainer.name,itemname))
  1530.       else
  1531.         if quantity>1
  1532.           if plural
  1533.             Kernel.pbMessage(_INTL("{1} found {2} {3}!\\wtnp[20]",e,quantity,plural))
  1534.           else
  1535.             Kernel.pbMessage(_INTL("{1} found {2} {3}s!\\wtnp[20]",$Trainer.name,quantity,itemname))
  1536.           end
  1537.         else
  1538.           Kernel.pbMessage(_INTL("{1} found one {2}!\\wtnp[20]",e,itemname))
  1539.         end
  1540.       end
  1541.       Kernel.pbMessage(_INTL("Too bad... The Bag is full..."))
  1542.       return false
  1543.     end
  1544.   end
  1545. end
  1546.  
  1547. $IssueStop = false
  1548.  
  1549. #Toggle follower, cycle through pokemon in field
  1550. class Scene_Map
  1551.  
  1552.   alias follow_update update
  1553.   def update
  1554.     follow_update
  1555.     return if $FollowerMoveRoute
  1556.     for i in 0...$PokemonGlobal.dependentEvents.length
  1557.       event=$PokemonTemp.dependentEvents.realEvents[i]
  1558.       return if event.move_route_forcing
  1559.     end    
  1560.     if $game_switches[Following_Activated_Switch] && $Trainer.party.length>0
  1561.       if Input.trigger?(Input::C) # try to talk to pokemon
  1562.         $PokemonTemp.dependentEvents.talk_to_pokemon
  1563.       end
  1564.       # Pokemon always move if switch is on, have flying type, or are in a settings array
  1565.       moving = Input.press?(Input::DOWN) || Input.press?(Input::UP) ||
  1566.                 Input.press?(Input::RIGHT) || Input.press?(Input::LEFT)
  1567.       if (ALWAYS_ANIMATE || $game_player.moving? || moving ||
  1568.         $Trainer.party[0].hasType?(:FLYING) ||
  1569.         isConst?($Trainer.party[0].ability,PBAbilities,:LEVITATE) ||
  1570.         ALWAYS_ANIMATED_FOLLOWERS.include?($Trainer.party[0].species)) &&
  1571.         !$PokemonGlobal.surfing
  1572.           if !(ALWAYS_ANIMATED_EXCEPTION.include?($Trainer.party[0].species))
  1573.             $PokemonTemp.dependentEvents.update_stepping
  1574.           end
  1575.       elsif $PokemonGlobal.surfing && $Trainer.party[0].hasType?(:WATER)
  1576.         if !(ALWAYS_ANIMATED_EXCEPTION.include?($Trainer.party[0].species))
  1577.           $PokemonTemp.dependentEvents.update_stepping
  1578.         end
  1579.       elsif $PokemonGlobal.surfing &&
  1580.                 ALWAYS_ANIMATED_CAN_SURF && ($Trainer.party[0].hasType?(:FLYING) ||
  1581.                 isConst?($Trainer.party[0].ability,PBAbilities,:LEVITATE) ||
  1582.                 ALWAYS_ANIMATED_FOLLOWERS.include?($Trainer.party[0].species)) &&
  1583.                 !(ALWAYS_ANIMATED_EXCEPTION.include?($Trainer.party[0].species)) &&
  1584.                 $Trainer.party[0].hp>0 && !$Trainer.party[0].isEgg?
  1585.           $PokemonTemp.dependentEvents.update_stepping
  1586.       elsif $PokemonGlobal.diving && $Trainer.party[0].hp>0 && !$Trainer.party[0].isEgg? && $Trainer.party[0].hasType?(:WATER)  && WATERPOKEMONCANDIVE
  1587.             $PokemonTemp.dependentEvents.update_stepping
  1588.       else
  1589.             $PokemonTemp.dependentEvents.stop_stepping
  1590.       end
  1591.       if Input.trigger?(Input::CTRL) && ALLOWTOGGLEFOLLOW && !$PokemonGlobal.bicycle
  1592.         if $PokemonGlobal.surfing
  1593.           if $Trainer.party[0].hp>0 && !$Trainer.party[0].isEgg? && $Trainer.party[0].hasType?(:WATER)
  1594.             if WATERPOKEMONCANSURF
  1595.               pbToggleFollowingPokemon
  1596.             end
  1597.           elsif ALWAYS_ANIMATED_CAN_SURF && ($Trainer.party[0].hasType?(:FLYING) ||
  1598.             isConst?($Trainer.party[0].ability,PBAbilities,:LEVITATE) ||
  1599.             ALWAYS_ANIMATED_FOLLOWERS.include?($Trainer.party[0].species)) &&
  1600.             !(ALWAYS_ANIMATED_EXCEPTION.include?($Trainer.party[0].species))
  1601.            
  1602.             pbToggleFollowingPokemon
  1603.           end
  1604.         elsif $PokemonGlobal.diving
  1605.           if $Trainer.party[0].hp>0 && !$Trainer.party[0].isEgg? && $Trainer.party[0].hasType?(:WATER)
  1606.             if WATERPOKEMONCANDIVE
  1607.               pbToggleFollowingPokemon
  1608.             end
  1609.           end
  1610.         else
  1611.           pbToggleFollowingPokemon
  1612.         end
  1613.       end
  1614.       if ALLOWFIELDSWITCHING && !$PokemonGlobal.bicycle
  1615.         tlength=$Trainer.party.length-1
  1616.         tparty=$Trainer.party
  1617.         return if tlength<=0
  1618.         if Input.trigger?(Input::X) && $Trainer.party.size > 1
  1619.           tparty.push(tparty.delete_at(0))
  1620.           $hud_need_refresh = true
  1621.           if $game_switches[Toggle_Following_Switch]
  1622.             if $PokemonGlobal.surfing
  1623.               if tparty[0].hp>0 && !tparty[0].isEgg? && tparty[0].hasType?(:WATER)
  1624.                 $PokemonTemp.dependentEvents.refresh_sprite
  1625.               elsif ALWAYS_ANIMATED_CAN_SURF && ($Trainer.party[0].hasType?(:FLYING) ||
  1626.                 isConst?($Trainer.party[0].ability,PBAbilities,:LEVITATE) ||
  1627.                 ALWAYS_ANIMATED_FOLLOWERS.include?($Trainer.party[0].species)) &&
  1628.                 !(ALWAYS_ANIMATED_EXCEPTION.include?($Trainer.party[0].species)) &&
  1629.                 tparty[0].hp>0 && !tparty[0].isEgg?
  1630.                
  1631.                 $PokemonTemp.dependentEvents.refresh_sprite
  1632.               else
  1633.                 $PokemonTemp.dependentEvents.refresh_sprite(false)
  1634.               end
  1635.               if tparty[tlength].hp>0 && !tparty[tlength].isEgg? && tparty[tlength].hasType?(:WATER)
  1636.                 $PokemonTemp.dependentEvents.check_surf(true)
  1637.               elsif ALWAYS_ANIMATED_CAN_SURF && ($Trainer.party[tlength].hasType?(:FLYING) ||
  1638.                 isConst?($Trainer.party[tlength].ability,PBAbilities,:LEVITATE) ||
  1639.                 ALWAYS_ANIMATED_FOLLOWERS.include?($Trainer.party[tlength].species)) &&
  1640.                 !(ALWAYS_ANIMATED_EXCEPTION.include?($Trainer.party[tlength].species)) &&
  1641.                 tparty[tlength].hp>0 && !tparty[tlength].isEgg?
  1642.                
  1643.                 $PokemonTemp.dependentEvents.check_surf(true)
  1644.               else
  1645.                 $PokemonTemp.dependentEvents.check_surf(false)
  1646.               end
  1647.             elsif $PokemonGlobal.diving
  1648.               if tparty[0].hp>0 && !tparty[0].isEgg? && tparty[0].hasType?(:WATER) && WATERPOKEMONCANDIVE
  1649.                 $PokemonTemp.dependentEvents.refresh_sprite
  1650.               end
  1651.               if tparty[tlength].hp>0 && !tparty[tlength].isEgg? && tparty[tlength].hasType?(:WATER) && WATERPOKEMONCANDIVE
  1652.                 $PokemonTemp.dependentEvents.check_surf(true)
  1653.               end
  1654.             else
  1655.               $PokemonTemp.dependentEvents.refresh_sprite
  1656.             end
  1657.           end
  1658.         end
  1659.         if Input.trigger?(Input::Z) && $Trainer.party.size > 1
  1660.           $Trainer.party.insert(0,$Trainer.party.pop)
  1661.           $hud_need_refresh = true
  1662.           if $game_switches[Toggle_Following_Switch]
  1663.             if $PokemonGlobal.surfing
  1664.               if tparty[0].hp>0 && !tparty[0].isEgg? && tparty[0].hasType?(:WATER)
  1665.                 $PokemonTemp.dependentEvents.refresh_sprite
  1666.               elsif ALWAYS_ANIMATED_CAN_SURF && ($Trainer.party[0].hasType?(:FLYING) ||
  1667.                 isConst?($Trainer.party[0].ability,PBAbilities,:LEVITATE) ||
  1668.                 ALWAYS_ANIMATED_FOLLOWERS.include?($Trainer.party[0].species)) &&
  1669.                 !(ALWAYS_ANIMATED_EXCEPTION.include?($Trainer.party[0].species)) &&
  1670.                 tparty[0].hp>0 && !tparty[0].isEgg?
  1671.                
  1672.                 $PokemonTemp.dependentEvents.refresh_sprite
  1673.                
  1674.               else
  1675.                 $PokemonTemp.dependentEvents.refresh_sprite(false)
  1676.               end
  1677.               if tparty[1].hp>0 && !tparty[1].isEgg? && tparty[1].hasType?(:WATER)
  1678.                 $PokemonTemp.dependentEvents.check_surf(true)
  1679.               elsif ALWAYS_ANIMATED_CAN_SURF && ($Trainer.party[1].hasType?(:FLYING) ||
  1680.                 isConst?($Trainer.party[1].ability,PBAbilities,:LEVITATE) ||
  1681.                 ALWAYS_ANIMATED_FOLLOWERS.include?($Trainer.party[1].species)) &&
  1682.                 !(ALWAYS_ANIMATED_EXCEPTION.include?($Trainer.party[1].species)) &&
  1683.                 tparty[1].hp>0 && !tparty[1].isEgg?
  1684.                
  1685.                 $PokemonTemp.dependentEvents.check_surf(true)
  1686.               else
  1687.                 $PokemonTemp.dependentEvents.check_surf(false)
  1688.               end
  1689.             elsif $PokemonGlobal.diving
  1690.                if tparty[0].hp>0 && !tparty[0].isEgg? && tparty[0].hasType?(:WATER)  && WATERPOKEMONCANDIVE
  1691.                 $PokemonTemp.dependentEvents.refresh_sprite
  1692.               end
  1693.               if tparty[1].hp>0 && !tparty[1].isEgg? && tparty[1].hasType?(:WATER) && WATERPOKEMONCANDIVE
  1694.                 $PokemonTemp.dependentEvents.check_surf(true)
  1695.               end
  1696.             else
  1697.               $PokemonTemp.dependentEvents.refresh_sprite
  1698.             end
  1699.           end
  1700.         end
  1701.       end
  1702.     end
  1703.   end
  1704.  
  1705.   alias follow_transfer transfer_player
  1706.   def transfer_player(cancelVehicles=true)
  1707.     follow_transfer(cancelVehicles)
  1708.     events=$PokemonGlobal.dependentEvents
  1709.     $PokemonTemp.dependentEvents.updateDependentEvents
  1710.     leader=$game_player
  1711.     for i in 0...events.length
  1712.       event=$PokemonTemp.dependentEvents.realEvents[i]
  1713.       $PokemonTemp.dependentEvents.pbFollowEventAcrossMaps(leader,event,false,i==0)
  1714.     end
  1715.     $PokemonTemp.dependentEvents.refresh_sprite
  1716.   end
  1717.  
  1718. end
  1719.  
  1720. #Fix follower landing on player when transfering
  1721. $NeedFollowerUpdate = false
  1722. #Don't try to unlock the follower events
  1723. class Interpreter
  1724.  
  1725.   def command_end
  1726.     # Clear list of event commands
  1727.     @list = nil
  1728.     # If main map event and event ID are valid
  1729.     if @main && @event_id > 0 && !($game_map.events[@event_id] && $game_map.events[@event_id].name=="Dependent")
  1730.       # Unlock event
  1731.       $game_map.events[@event_id].unlock if $game_map.events[@event_id]
  1732.     end
  1733.     if $NeedFollowerUpdate
  1734.       events=$PokemonGlobal.dependentEvents
  1735.       $PokemonTemp.dependentEvents.updateDependentEvents
  1736.       leader=$game_player
  1737.       for i in 0...events.length
  1738.         event=$PokemonTemp.dependentEvents.realEvents[i]
  1739.         $PokemonTemp.dependentEvents.pbFollowEventAcrossMaps(leader,event,false,i==0)
  1740.       end
  1741.       $NeedFollowerUpdate=false
  1742.     end
  1743.   end
  1744.  
  1745.   alias follow_201 command_201
  1746.   def command_201
  1747.     ret=follow_201
  1748.     $NeedFollowerUpdate=true
  1749.     return ret
  1750.   end
  1751.  
  1752. end
  1753.  
  1754.  
  1755. # Fix other events walking through dependent events
  1756. class Game_Map
  1757.  
  1758.   alias follow_passable? passable?
  1759.   def passable?(x, y, d, self_event=nil)
  1760.     ret=follow_passable?(x,y,d,self_event)
  1761.     if !ret && !$game_temp.player_transferring && $game_player.pbHasDependentEvents? && $game_switches[Toggle_Following_Switch] &&
  1762.        self_event != $game_player
  1763.          dependent=pbGetDependency("Dependent")
  1764.          if dependent != nil && self_event != dependent
  1765.            if dependent.x==x && dependent.y==y
  1766.              return false
  1767.            end
  1768.          end
  1769.     end
  1770.     return ret
  1771.    end
  1772.    
  1773. end
  1774.  
  1775.  
  1776. class Spriteset_Map
  1777.  
  1778.   alias follower_update update
  1779.   def update
  1780.     follower_update
  1781.     return if $FollowerMoveRoute
  1782.     #add to reflected sprites if not already
  1783.     if $game_player.pbHasDependentEvents? && !$game_temp.player_transferring
  1784.       for i in 0...@usersprites.length
  1785.         if @usersprites[i].is_a?(DependentEventSprites)
  1786.           @followersprite = @usersprites[i]
  1787.           event = $PokemonTemp.dependentEvents.realEvents[0]
  1788.           count = 0
  1789.           fsprite = nil
  1790.           for sprite in @reflectedSprites
  1791.             if sprite.event == event
  1792.               if count==1 #if there are multiple of this same event
  1793.                 sprite.dispose
  1794.                 @reflectedSprites.delete(sprite)
  1795.                 @reflectedSprites.delete(fsprite) if fsprite
  1796.               else
  1797.                 fsprite = sprite
  1798.                 count = 1
  1799.               end
  1800.             end
  1801.           end
  1802.           if count==0 || fsprite.nil?
  1803.             @reflectedSprites.push(ReflectedSprite.new(@usersprites[i].sprites[0],event,@viewport1))
  1804.             follower_update
  1805.           elsif fsprite || fsprite.transfer
  1806.             @reflectedSprites.delete(fsprite)
  1807.             fsprite.dispose
  1808.             @reflectedSprites.push(ReflectedSprite.new(@usersprites[i].sprites[0],event,@viewport1))
  1809.             follower_update
  1810.           end
  1811.           break
  1812.         end
  1813.       end
  1814.     end
  1815.   end
  1816.  
  1817. end
  1818.  
  1819. class ReflectedSprite
  1820.  
  1821.   alias follow_update update
  1822.   def update
  1823.     return false if !@rsprite || @rsprite.nil? || @rsprite.disposed?
  1824.     ret=follow_update
  1825.     return ret
  1826.   end
  1827.  
  1828. end
  1829.  
  1830.  
  1831. #v15 compatibility
  1832. if !PBTerrain.respond_to?(:isWater?)
  1833.   module PBTerrain
  1834.     def PBTerrain.isWater?(tag)
  1835.       return pbIsWaterTag?(tag)
  1836.     end
  1837.   end
  1838. end
  1839.  
  1840.  
  1841. #Fix blacking out
  1842. #overwrite starting over to fix black out error
  1843. def Kernel.pbStartOver(gameover=false)
  1844.   if pbInBugContest?
  1845.     Kernel.pbBugContestStartOver
  1846.     return
  1847.   end
  1848.   pbHealAll()
  1849.   if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId>=0
  1850.     if gameover
  1851.       Kernel.pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]After the unfortunate defeat, {1} scurried to a Pokémon Center.",$Trainer.name))
  1852.     else
  1853.       Kernel.pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]{1} scurried to a Pokémon Center, protecting the exhausted and fainted Pokémon from further harm.",$Trainer.name))
  1854.     end
  1855.     Kernel.pbCancelVehicles
  1856.     pbRemoveDependencies()
  1857.     $game_switches[STARTING_OVER_SWITCH]=true
  1858.     $game_temp.player_new_map_id=$PokemonGlobal.pokecenterMapId
  1859.     $game_temp.player_new_x=$PokemonGlobal.pokecenterX
  1860.     $game_temp.player_new_y=$PokemonGlobal.pokecenterY
  1861.     $game_temp.player_new_direction=$PokemonGlobal.pokecenterDirection
  1862.     $scene.transfer_player if $scene.is_a?(Scene_Map)
  1863.     $game_map.refresh
  1864.   else
  1865.     homedata=pbGetMetadata(0,MetadataHome)
  1866.     if (homedata && !pbRxdataExists?(sprintf("Data/Map%03d",homedata[0])) )
  1867.       if $DEBUG
  1868.         Kernel.pbMessage(_ISPRINTF("Can't find the map 'Map{1:03d}' in the Data folder. The game will resume at the player's position.",homedata[0]))
  1869.       end
  1870.       pbHealAll()
  1871.       return
  1872.     end
  1873.     if gameover
  1874.       Kernel.pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]After the unfortunate defeat, {1} scurried home.",$Trainer.name))
  1875.     else
  1876.       Kernel.pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]{1} scurried home, protecting the exhausted and fainted Pokémon from further harm.",$Trainer.name))
  1877.     end
  1878.     if homedata
  1879.       Kernel.pbCancelVehicles
  1880.       pbRemoveDependencies() if !$game_switches[Following_Activated_Switch]
  1881.       $game_switches[STARTING_OVER_SWITCH]=true
  1882.       $game_temp.player_new_map_id=homedata[0]
  1883.       $game_temp.player_new_x=homedata[1]
  1884.       $game_temp.player_new_y=homedata[2]
  1885.       $game_temp.player_new_direction=homedata[3]
  1886.       $scene.transfer_player if $scene.is_a?(Scene_Map)
  1887.       $game_map.refresh
  1888.     else
  1889.       pbHealAll()
  1890.     end
  1891.   end
  1892.   pbEraseEscapePoint
  1893. end
  1894.  
  1895. #Fix Escape Rope
  1896. ItemHandlers::UseInField.add(:ESCAPEROPE,proc{|item|
  1897.    escape=($PokemonGlobal.escapePoint rescue nil)
  1898.    if !escape || escape==[]
  1899.      Kernel.pbMessage(_INTL("Can't use that here."))
  1900.      next
  1901.    end
  1902.    if $game_player.pbHasDependentEvents? && !$game_switches[Following_Activated_Switch]
  1903.      Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
  1904.      next
  1905.    end
  1906.    Kernel.pbMessage(_INTL("{1} used the {2}.",$Trainer.name,PBItems.getName(item)))
  1907.    pbFadeOutIn(99999){
  1908.       Kernel.pbCancelVehicles
  1909.       $game_temp.player_new_map_id=escape[0]
  1910.       $game_temp.player_new_x=escape[1]
  1911.       $game_temp.player_new_y=escape[2]
  1912.       $game_temp.player_new_direction=escape[3]
  1913.       $scene.transfer_player
  1914.       $game_map.autoplay
  1915.       $game_map.refresh
  1916.    }
  1917.    pbEraseEscapePoint
  1918. })
  1919.  
  1920.  
  1921. ItemHandlers::UseFromBag.add(:ESCAPEROPE,proc{|item|
  1922.    if $game_player.pbHasDependentEvents? && !$game_switches[Following_Activated_Switch]
  1923.      Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
  1924.      next 0
  1925.    end
  1926.    if ($PokemonGlobal.escapePoint rescue false) && $PokemonGlobal.escapePoint.length>0
  1927.      next 4 # End screen and consume item
  1928.    else
  1929.      Kernel.pbMessage(_INTL("Can't use that here."))
  1930.      next 0
  1931.    end
  1932. })
  1933.  
  1934.  
  1935. #Update sprites on give item
  1936. class PokemonScreen
  1937.  
  1938.   alias follow_pbPokemonGiveScreen pbPokemonGiveScreen
  1939.   def pbPokemonGiveScreen(item)
  1940.     ret=follow_pbPokemonGiveScreen(item)
  1941.     $PokemonTemp.dependentEvents.refresh_sprite(false) if ret
  1942.     return ret
  1943.   end
  1944.  
  1945. end
  1946.  
  1947. #Update sprites on use item
  1948. module ItemHandlers
  1949.  
  1950.   class << self
  1951.     alias follow_triggerUseOnPokemon triggerUseOnPokemon
  1952.   end
  1953.  
  1954.   def self.triggerUseOnPokemon(item,pokemon,scene,partyc)
  1955.     ret = follow_triggerUseOnPokemon(item,pokemon,scene,partyc)
  1956.     $PokemonTemp.dependentEvents.refresh_sprite(false) if ret
  1957.     return ret
  1958.   end
  1959.  
  1960. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement