Guill

nome

Oct 20th, 2012
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.28 KB | None | 0 0
  1. #==============================================================================
  2. # ** Evento Mostrar Texto
  3. #==============================================================================
  4. # Criado por: Áص¹
  5. # Modificado, Adaptado e Melhorado por: Nietore
  6. # Traduzido por: Nietore
  7. # Acesse: Www.AldeiaRpgBr.Com
  8. #==============================================================================
  9. # * Instruções
  10. #
  11. # - Criando evento para mostrar nome
  12. # - Crie um comentário com:
  13. # [Nome= Nome Aqui]
  14. #------------------------------------------------------------------------------
  15. #==============================================================================
  16. #==============================================================================
  17. # ** Game_Character
  18. #==============================================================================
  19. class Game_Character
  20. #--------------------------------------------------------------------------
  21. # * Escolher as cores
  22. #--------------------------------------------------------------------------
  23. Event_Color = Color.new(0, 225, 255)
  24. Player_Color = Color.new(255, 255, 255)
  25. #--------------------------------------------------------------------------
  26. # * Escolha o que você quer mostrar no personagem
  27. # ~ 'Nome', 'Classe', 'Nivel', 'Hp', 'Mp'
  28. #--------------------------------------------------------------------------
  29. Player_Text = 'Nome'
  30. #--------------------------------------------------------------------------
  31. # * Vareavel de instancia publica
  32. #--------------------------------------------------------------------------
  33. attr_accessor :text_display
  34. end
  35. #==============================================================================
  36. # ** Game_Event
  37. #==============================================================================
  38.  
  39. class Game_Event < Game_Character
  40. #--------------------------------------------------------------------------
  41. # * Alias Listings
  42. #--------------------------------------------------------------------------
  43. alias seph_characterdisplay_gevent_refresh refresh
  44. #--------------------------------------------------------------------------
  45. # * Atualização
  46. #--------------------------------------------------------------------------
  47. def refresh
  48. # Methodo de Atualização Original
  49. seph_characterdisplay_gevent_refresh
  50. # Checa se o evento está com o comando no comentário
  51. unless @list.nil?
  52. if @list[i].code == 108
  53. @list[i].parameters[0].dup.gsub!(/\[[Nn][Oo][Mm][Ee][=](.+?)\]/) do
  54. @text_display = [$1, Event_Color]
  55. end
  56. end
  57. end
  58. end
  59. @text_display = nil if @erased
  60. end
  61. end
  62. #==============================================================================
  63. # ** Game_Player
  64. #==============================================================================
  65. class Game_Player < Game_Character
  66.  
  67. alias seph_characterdisplay_gplayer_refresh refresh
  68. #--------------------------------------------------------------------------
  69. # * Atualização
  70. #--------------------------------------------------------------------------
  71. def refresh
  72. # Methodo de Atualização Original
  73. seph_characterdisplay_gplayer_refresh
  74. # Pega o personagem principal
  75. actor = $game_party.members[0]
  76. # Determina o texto
  77. case Player_Text
  78. when 'Nome'
  79. txt = actor.name
  80. when 'Classe'
  81. txt = actor.class_name
  82. when 'Nivel'
  83. txt = "Nivel: #{actor.level}"
  84. when 'Hp'
  85. txt = "HP: #{actor.hp} / #{actor.maxhp}"
  86. when 'Mp'
  87. txt = "MP: #{actor.sp} / #{actor.maxsp}"
  88. else
  89. txt = ''
  90. end
  91. # Creates Text Display
  92. @text_display = [txt, Player_Color]
  93. end
  94. end
  95. #==============================================================================
  96. # ** Sprite_Character
  97. #==============================================================================
  98. class Sprite_Character
  99.  
  100. alias seph_characterdisplay_scharacter_update update
  101. #--------------------------------------------------------------------------
  102. # * Atualizar Frame
  103. #--------------------------------------------------------------------------
  104. def update
  105. # Methodo de Atualização Original
  106. seph_characterdisplay_scharacter_update
  107. # Methodo de atualização para mostrar o nome no evento
  108. update_display_text
  109. end
  110. #--------------------------------------------------------------------------
  111. # * Cria o Sprite para Mostrar
  112. #--------------------------------------------------------------------------
  113. def create_display_sprite(args)
  114. bitmap = Bitmap.new(160, 24)
  115.  
  116. # Tamanho da Font
  117. bitmap.font.size = 15
  118. # Texto com Sombra
  119. bitmap.font.draw_shadow = false if bitmap.font.respond_to?(:draw_shadow)
  120. bitmap.font.color = Color.new(0, 0, 0)
  121. bitmap.draw_text(1, 1, 160, 24, args[0], 1)
  122. # Cor da Font
  123. bitmap.font.color = args[1]
  124. # Texto
  125. bitmap.draw_text(0, 0, 160, 24, args[0], 1)
  126. # Desenha o texto
  127. @_text_display = Sprite.new(self.viewport)
  128. @_text_display.bitmap = bitmap
  129. @_text_display.ox = 80
  130. @_text_display.oy = 10
  131. @_text_display.x = self.x
  132. @_text_display.y = self.y - self.oy / 2 - 24
  133. @_text_display.z = 900
  134. @_text_display.visible = self.visible #true
  135. end
  136.  
  137. def dispose_display_text
  138. @_text_display.dispose unless @_text_display.nil?
  139. end
  140.  
  141. def update_display_text
  142. unless @character.text_display.nil?
  143. create_display_sprite(@character.text_display) if @_text_display.nil?
  144. @_text_display.x = self.x
  145. @_text_display.y = self.y - self.oy / 2 - 24
  146. else
  147. dispose_display_text unless @_text_display.nil?
  148. end
  149. end
  150. end
Advertisement
Add Comment
Please, Sign In to add comment