pigu_6

Mostrar variable

Apr 19th, 2013
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. #=======================================================
  2. # Pop-up Variable
  3. # Autor: Raizen
  4. # Comunidade : www.centrorpg.com
  5. # O script permite um pop-up de uma variável a ser escolhida
  6. # abaixo, útil para ABS e outros usos com variaveis.
  7. #=======================================================
  8.  
  9. # Instruções: Basta
  10. # Chamar Script: popup_var(event_id, time)
  11. # Aonde event_id = id do evento que ocorre o popup
  12. # time = o tempo em frames que a variável ficará a amostra
  13.  
  14. module Popup_Var
  15. # Distancia em pixels que vai percorrer o popup
  16. Dist = 0
  17.  
  18. # Fonte das letras no popup
  19. Font = "arial"
  20.  
  21. # Tamanho da font
  22. Font_size = 20
  23.  
  24. # Correção da posição em X
  25. X = -10
  26.  
  27. # Correção da posição em Y
  28. Y = -90
  29.  
  30. # Variável que será escolhida para o Popup
  31.  
  32. Var = 1
  33.  
  34. end
  35.  
  36. #====================== Aqui Começa o script ===========================#
  37. class Window_Var_Pop < Window_Base
  38. def initialize
  39. super(0, 0, 150, 80)
  40. self.opacity = 0
  41. @time = 0
  42. @mtime = 0
  43. refresh
  44. end
  45. def config(event_id, time)
  46. @event_id = event_id
  47. @time = time
  48. @mtime = time
  49. draw_t
  50. end
  51. def refresh
  52. if @time >= @mtime - Popup_Var::Dist && @time != 0
  53. @time -= 1
  54. self.x = $game_map.events[@event_id].screen_x + Popup_Var::X
  55. self.y = $game_map.events[@event_id].screen_y + Popup_Var::Y + @time + Popup_Var::Dist - @mtime
  56. elsif @time > 0
  57. @time -= 1
  58. self.x = $game_map.events[@event_id].screen_x + Popup_Var::X
  59. self.y = $game_map.events[@event_id].screen_y + Popup_Var::Y
  60. else
  61. @mtime = 0
  62. self.contents.clear
  63. end
  64. end
  65. def draw_t
  66. self.contents.clear
  67. self.contents.font.name = Popup_Var::Font
  68. self.contents.font.size = Popup_Var::Font_size
  69. draw_text(0, 0, 150, 30, $game_variables[Popup_Var::Var], 0)
  70. end
  71. end
  72.  
  73. class Game_Interpreter
  74. def popup_var(event_id, time)
  75. $game_popup.config(event_id, time)
  76. end
  77. end
  78.  
  79. class Scene_Map < Scene_Base
  80. alias popup_start start
  81. alias popup_update update
  82. alias popup_terminate terminate
  83. def start
  84. popup_start
  85. $game_popup = Window_Var_Pop.new
  86. end
  87. def update
  88. popup_update
  89. $game_popup.refresh
  90. end
  91. def terminate
  92. $game_popup.dispose
  93. end
  94. end
Advertisement
Add Comment
Please, Sign In to add comment