Advertisement
SSTrihan

HorrorVale - VarShowPic

Apr 30th, 2023
893
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.97 KB | Source Code | 0 0
  1. #-------------------------------------------------------------------------------
  2. # Don't remove this header!
  3. #-------------------------------------------------------------------------------
  4. # Show Picture/Variable with Switch
  5. # by Trihan
  6. #
  7. # Version: 1.0
  8. #
  9. # This script is commissioned by Batworks Software.
  10. #-------------------------------------------------------------------------------
  11.  
  12. #-------------------------------------------------------------------------------
  13. # Version History
  14. #-------------------------------------------------------------------------------
  15. # 1.0 - Initial script.
  16. #-------------------------------------------------------------------------------
  17.  
  18. module TLBVarShowPic
  19. #-------------------------------------------------------------------------------
  20. #  Config
  21.  
  22.    SwitchID = 1
  23.    VarID = 1
  24.    Pic = "Nature"
  25.    PicX = 10
  26.    PicY = 10
  27.    VarOffsetX = 50
  28.    VarOffsetY = 20
  29.  
  30. #  ** End Config **
  31. #
  32. # WARNING: Editing anything beyond this point may result in the script no
  33. # longer functioning as intended.
  34. #-------------------------------------------------------------------------------
  35. end
  36.  
  37. class Scene_Map < Scene_Base
  38.   include TLBVarShowPic
  39.   alias :tlb_vsp_update_7xl6 :update
  40.   def update
  41.     tlb_vsp_update_7xl6
  42.     if $game_switches[SwitchID]
  43.       @tlb_varpic = Sprite.new if !@tlb_varpic
  44.       @tlb_varpic.bitmap = Cache.system(Pic)
  45.       @tlb_varpic.x = PicX
  46.       @tlb_varpic.y = PicY
  47.       @tlb_var = Sprite.new if !@tlb_var
  48.       value = $game_variables[VarID].to_s
  49.       text_width = @tlb_varpic.bitmap.text_size(value)
  50.       @tlb_var.bitmap = Bitmap.new(text_width.width, 24)
  51.       @tlb_var.bitmap.draw_text(0, 0, text_width, 24, value)
  52.       @tlb_var.x = @tlb_varpic.x + VarOffsetX
  53.       @tlb_var.y = @tlb_varpic.y + VarOffsetY
  54.       @tlb_varpic.visible = true
  55.       @tlb_var.visible = true
  56.     else
  57.       @tlb_varpic.visible = false if @tlb_varpic
  58.       @tlb_var.visible = false if @tlb_var
  59.     end
  60.   end
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement