Advertisement
roninator2

Help Window for Choices mod

Dec 7th, 2024
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.72 KB | None | 0 0
  1. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2. #             Help Window for Choices
  3. #             Version: 2.1
  4. #             Authors: DiamondandPlatinum3
  5. #                       Roninator2
  6. #             Date: December 4, 2012  (Original)
  7. #                   December 14, 2013 (Updated)
  8. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  9. #  Description:
  10. #
  11. #    This script adds on to the default choice system, allowing you to have a
  12. #    help window at the top of the screen to assist players in the choices they
  13. #    have to make
  14. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15.  
  16. =begin
  17. ##    *Addition by Roninator2
  18. ##    Displays a dim background instead of default window
  19. ##  
  20. ##    Only setting is the opacity of the window
  21. ##    Values from 0-255
  22. ##  
  23. ##    Adjust position depending on where you place the message. E.g. top or bottom
  24. ##    0 for top, (depending on your screen resolution) 400 for bottom
  25. =end
  26.  
  27. #==============================================================================
  28. # Setting
  29. #==============================================================================
  30. module R2DP3CH
  31.  
  32.   #Help Window Opacity 0-255
  33.   View = 180
  34.  
  35.   #Help Window Y position
  36.   WinY = 400
  37. end
  38.  
  39. #==============================================================================
  40. # Addon Script
  41. #==============================================================================
  42. class DP3_Choice_Window_Help < Window_Help
  43.    
  44.   def initialize(text, position)
  45.     super( [text.split("\n").size, 2].max )
  46.     self.y = position * (Graphics.height - self.height) / 2
  47.     self.openness = 255
  48.     set_text(text)
  49.     self.windowskin = Cache.system("Window_blank")
  50.     self.opacity = R2DP3CH::View
  51.     create_back_bitmap_CH
  52.     create_back_sprite_CH
  53.     refresh
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # * Create Background Bitmap
  57.   #--------------------------------------------------------------------------
  58.   def create_back_bitmap_CH
  59.     @back_bitmap_CH = Bitmap.new(width, height) if @back_bitmap_CH.nil?
  60.     rect1 = Rect.new(0, 0, width, 12)
  61.     rect2 = Rect.new(0, 12, width, height - 24)
  62.     rect3 = Rect.new(0, height - 12, width, 12)
  63.     @back_bitmap_CH.gradient_fill_rect(rect1, back_color2, back_color1, true)
  64.     @back_bitmap_CH.fill_rect(rect2, back_color1)
  65.     @back_bitmap_CH.gradient_fill_rect(rect3, back_color1, back_color2, true)
  66.   end
  67.   #--------------------------------------------------------------------------
  68.   # * Get Background Color 1
  69.   #--------------------------------------------------------------------------
  70.   def back_color1
  71.     Color.new(0, 0, 0, R2DP3CH::View)
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # * Get Background Color 2
  75.   #--------------------------------------------------------------------------
  76.   def back_color2
  77.     Color.new(0, 0, 0, R2DP3CH::View)
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # * Create Background Sprite
  81.   #--------------------------------------------------------------------------
  82.   def create_back_sprite_CH
  83.     @back_sprite_CH = Sprite.new if @back_sprite_CH.nil?
  84.     @back_sprite_CH.bitmap = @back_bitmap_CH
  85.     @back_sprite_CH.z = z - 1
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # * Frame Update
  89.   #--------------------------------------------------------------------------
  90.   def update
  91.     super
  92.     update_back_sprite_CH
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # * Free
  96.   #--------------------------------------------------------------------------
  97.   def dispose
  98.     super
  99.     dispose_back_bitmap_CH
  100.     dispose_back_sprite_CH
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # * Update Background Sprite
  104.   #--------------------------------------------------------------------------
  105.   def update_back_sprite_CH
  106.     @back_sprite_CH.visible = $game_message.visible ? true : false
  107.     @back_sprite_CH.opacity = R2DP3CH::View
  108.     @back_sprite_CH.y = R2DP3CH::WinY
  109.     @back_sprite_CH.update
  110.   end
  111.   #--------------------------------------------------------------------------
  112.   # * Free Background Bitmap
  113.   #--------------------------------------------------------------------------
  114.   def dispose_back_bitmap_CH
  115.     @back_bitmap_CH.dispose
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # * Free Background Sprite
  119.   #--------------------------------------------------------------------------
  120.   def dispose_back_sprite_CH
  121.     @back_sprite_CH.dispose
  122.   end
  123.  
  124. end
  125.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement