Advertisement
DrDhoom

[RGSS3] CP Scan - Pictures Addon

Sep 22nd, 2014
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.72 KB | None | 0 0
  1. #===============================================================================
  2. # CP Scan - Picture Addon
  3. # by DrDhoom
  4. # v1.0a - 9-22-14
  5. #===============================================================================
  6.  
  7. module Dhoom
  8.   module CPScan    
  9.     #True : Use battler picture, False : Use picture in Pictures folder
  10.     Use_Battler_Picture = true
  11.    
  12.     #If not using battler picture. Put picture in Pictures folder.
  13.     #No picture will be displayed if there is no matching filename.
  14.    
  15.     #"Filename_Prefix+Battler name"
  16.     #Example: "CP_Slime", "CP_Bat"
  17.     Filename_Prefix = "CP_"
  18.    
  19.     #Picture coordinate
  20.     Pictures_XY = [0,208]
  21.     #Picture starting point, 1-9
  22.     Pictures_StartPoint = 4
  23.   end
  24. end
  25.  
  26. class Scene_Battle < Scene_Base
  27.   alias dhoom_cpscan_battle_create_scan_windows create_scan_windows
  28.   def create_scan_windows
  29.     dhoom_cpscan_battle_create_scan_windows
  30.     @scan_pict = Sprite.new(@scan_viewport)    
  31.   end
  32.  
  33.   def refresh_cpscan_battler_picture
  34.     enemy = $game_troop.alive_members[@scan_bio.index].enemy
  35.     if Dhoom::CPScan::Use_Battler_Picture
  36.       @scan_pict.bitmap = Cache.battler(enemy.battler_name, enemy.battler_hue)
  37.     else
  38.       file = Dhoom::CPScan::Filename_Prefix+enemy.name
  39.       begin
  40.         @scan_pict.bitmap = Cache.picture(file)
  41.       rescue
  42.         @scan_pict.bitmap = Bitmap.new(32,32)
  43.         return
  44.       end
  45.     end
  46.     start = Dhoom::CPScan::Pictures_StartPoint
  47.     @scan_pict.ox = 0 if [1,4,7].include?(start)
  48.     @scan_pict.ox = @scan_pict.width if [3,6,9].include?(start)
  49.     @scan_pict.ox = @scan_pict.width/2 if [2,5,8].include?(start)
  50.     @scan_pict.oy = 0 if [7,8,9].include?(start)
  51.     @scan_pict.oy = @scan_pict.height if [1,2,3].include?(start)
  52.     @scan_pict.oy = @scan_pict.height/2 if [4,5,6].include?(start)
  53.     @scan_pict.x = Dhoom::CPScan::Pictures_XY[0]
  54.     @scan_pict.y = Dhoom::CPScan::Pictures_XY[1]
  55.   end
  56.  
  57.   alias dhoom_cpscan_battle_next_enemy next_enemy
  58.   def next_enemy
  59.     dhoom_cpscan_battle_next_enemy
  60.     refresh_cpscan_battler_picture
  61.   end
  62.  
  63.   alias dhoom_cpscan_battle_last_enemy last_enemy
  64.   def last_enemy
  65.     dhoom_cpscan_battle_last_enemy
  66.     refresh_cpscan_battler_picture
  67.   end
  68.  
  69.   alias dhoom_cpscan_battle_open_scan_window open_scan_window
  70.   def open_scan_window
  71.     dhoom_cpscan_battle_open_scan_window
  72.     @scan_pict.visible = true
  73.     refresh_cpscan_battler_picture    
  74.   end
  75.  
  76.   alias dhoom_cpscan_battle_close_scan_window close_scan_window
  77.   def close_scan_window
  78.     dhoom_cpscan_battle_close_scan_window
  79.     @scan_pict.visible = false
  80.   end
  81.  
  82.   alias dhoom_cpscan_battle_terminate terminate
  83.   def terminate
  84.     dhoom_cpscan_battle_terminate
  85.     @scan_pict.dispose
  86.   end
  87. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement