Script de Hud de Digimon
(http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png) (http://creativecommons.org/licenses/by-nc-sa/3.0/)
www.mundorpgmaker.com
This work is licensed under a Creative Commons Atribuição-Uso não-comercial-Compartilhamento pela mesma licença 3.0 Unported License (http://creativecommons.org/licenses/by-nc-sa/3.0/).
[info float=left border=#6587E4]
Informações:
--------------------------------------------------.• Autor: thiago_d_d• Versão: 1.2• Incompatibilidade: Desprezível• Lag gerado: Desprezível• Customizável: Sim• Requer Recursos Extras: Sim[/info][box class=catbg2]
Resumo
[/box][box class=catbg4]Uma Hud de digimon. Possui funcionalidade com ou mouse. Quando o jogador posicionar o mouse nas barras da Hud, o atributo correspondente será mostrado.[/box]
[box class=catbg2]
Instalação e configuração
[/box]
Para instalar o script, primeiramente coloque essas imagens na pasta Pictures do seu projeto, com o nome de HUD, HUD2, HUD3 e HUD4, respectivamente:(http://img202.imageshack.us/img202/2652/hud1.png)
(http://img413.imageshack.us/img413/6397/hud2.png)
(http://img220.imageshack.us/img220/4833/hud3.png)
(http://img28.imageshack.us/img28/9274/hud4.png)
Depois, cole o script acima de Main. Não esqueça de ler as instruções:#==============================================================
# * MRM - Comunidade RPG Maker!
# www.mundorpgmaker.com
# * GRM - Comunidade RPG Maker!
# www.galaxiarpgmaker.com.br
#
# [TSDA] HUD de Digimon
# --> Versão 1.2
# Última atualização: 11/12/2010
# ----Créditos
# thiago_d_d - por fazer o script
# Blizzard - por fazer o sistema de Mouse que a HUD usa
#
#--------------------------------------------------------------
# * Características
#--------------------------------------------------------------
# + Adiciona uma HUD interessante,que mostra valores de HP,
# MP,etc quando o Mouse é posicionado sobre ela.
#
#--------------------------------------------------------------
# * Instalação
#--------------------------------------------------------------
# Cole esse script acima de Main.
# Além disso é necessário ter essas imagens na pasta
# Pictures do seu projeto:
# HUD1
# HUD2
# HUD3
# HUD4
# Essas imagens devem ser disponibilizadas junto com a DEMO
# ou onde o script foi disponibilizado.
#
#--------------------------------------------------------------
# * Configuração
#--------------------------------------------------------------
# Para mudar as cores essenciais,modifique a linha nas quais
# está escrito COR_R,COR_G,COR_B,que são,respectivamente,
# o vermelho,o verde e o azul dessa cor.
#==============================================================
module TSDA
COR_R=0
COR_G=0
COR_B=0
end
#--------------------------------------------------------------
class Scene_Map
alias old_main main
alias old_update update
def main
@window_digimon = Window_Digimon_Hud.new
@window_text = Window_MouseOver.new
old_main
@window_digimon.dispose
@window_text.dispose
end
#------------------------------------------------------------
def update
@window_digimon.update
@window_text.update
old_update
@window_digimon.refresh
x = $mouse.x
y = $mouse.y
if x >= 328 && x <= 629 && y >= 465 && y <= 476
actor = $game_party.actors[0]
st = "#{actor.exp_now}/#{actor.exp_next}"
@window_text.refresh(st)
@window_text.visible = true
elsif x >= 532 && x <= 630
if y >= 429 && y <= 440
actor = $game_party.actors[0]
st = "#{actor.hp}/#{actor.maxhp}"
@window_text.refresh(st)
@window_text.visible = true
elsif y >= 448 && y <= 459
actor = $game_party.actors[0]
st = "#{actor.sp}/#{actor.maxsp}"
@window_text.refresh(st)
@window_text.visible = true
end
else
@window_text.visible = false
end
end
end
#----------------------------------------------
class Game_Actor
def exp_now
return @exp_list[@level+1] > 0 ? self.exp_next -
(@exp_list[@level+1] - @exp) : 0
end
#------------------------------------------------------------
def exp_next
@exp_list[@level+1] > 0 ? @exp_list[@level+1] -
@exp_list[@level] : 0
end
end
#--------------------------------------------------------------
class Window_Digimon_Hud < Window_Base
def initialize
super(262,383,394,113)
self.contents = Bitmap.new(width - 32,height - 32)
self.contents.font.size = 16
self.opacity = 0
self.back_opacity = 0
self.contents_opacity = 210
refresh
end
#------------------------------------------------------------
def refresh
self.contents.clear
actor = $game_party.actors[0]
self.contents.font.color = Color.new(TSDA::COR_R,
TSDA::COR_G,TSDA::COR_B)
bitmap = RPG::Cache.picture("HUD1")
bitmap2 = RPG::Cache.picture("HUD2")
bitmap3 = RPG::Cache.picture("HUD3")
bitmap4 = RPG::Cache.picture("HUD4")
src_rect = Rect.new(0, 0, 362, 81)
src_rect2 = Rect.new(0, 0,
actor.exp_now * 302 / actor.exp_next, 12)
src_rect3 = Rect.new(0, 0, actor.hp * 99 / actor.maxhp, 12)
src_rect4 = Rect.new(0, 0, actor.sp * 99 / actor.maxsp, 12)
self.contents.blt(0, 0, bitmap, src_rect)
self.contents.blt(50, 66, bitmap2, src_rect2)
self.contents.blt(254, 30, bitmap3, src_rect3)
self.contents.blt(254, 49, bitmap4, src_rect4)
self.contents.draw_text(231,8,39,16,actor.level.to_s)
end
end
#--------------------------------------------------------------
class Window_MouseOver < Window_Base
def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32,height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.opacity = 210
self.back_opacity = 210
self.z = 9999
self.visible = false
end
#------------------------------------------------------------
def refresh(text)
self.width = self.contents.text_size(text).width + 32
self.contents.dispose
self.contents = Bitmap.new(width - 32,height - 32)
self.contents.font.color = Color.new(TSDA::COR_R,
TSDA::COR_G,TSDA::COR_B)
self.x = $mouse.x - 64
self.y = $mouse.y - 64
self.contents.draw_text(0,0,128,32,text)
end
end
#--------------------------------------------------------------
class Mouse
MOUSE_ICON = 'cursor'
AUTO_CONFIGURE = true
SCREEN_TO_CLIENT = Win32API.new('user32',
'ScreenToClient', %w(l p), 'i')
CLIENT_RECT = Win32API.new('user32',
'GetClientRect', %w(l p), 'i')
READ_INI = Win32API.new('kernel32',
'GetPrivateProfileStringA', %w(p p p p l p), 'l')
FIND_WINDOW = Win32API.new('user32',
'FindWindowA', %w(p p), 'l')
CURSOR_POSITION = Win32API.new('user32',
'GetCursorPos', 'p', 'i')
#------------------------------------------------------------
def initialize
@cursor = Sprite.new
@cursor.z = 1000000
update
end
#------------------------------------------------------------
def update
@cursor.x, @cursor.y = self.position
end
#------------------------------------------------------------
def x
return @cursor.x
end
#------------------------------------------------------------
def y
return @cursor.y
end
#------------------------------------------------------------
def global_position
pos = [0, 0].pack('ll')
return (CURSOR_POSITION.call(pos) != 0 ?
pos.unpack('ll') : nil)
end
#------------------------------------------------------------
def position
width, height = self.client_size
x, y = self.screen_to_client(*self.global_position)
return x, y
end
#------------------------------------------------------------
def screen_to_client(x, y)
return nil if x == nil || y == nil
pos = [x, y].pack('ll')
return (SCREEN_TO_CLIENT.call(WINDOW, pos) != 0 ?
pos.unpack('ll') : nil)
end
#------------------------------------------------------------
def client_size
rect = [0, 0, 0, 0].pack('l4')
CLIENT_RECT.call(WINDOW, rect)
right, bottom = rect.unpack('l4')[2, 2]
return right, bottom
end
#------------------------------------------------------------
def self.find_window
game_name = "\0" * 256
READ_INI.call('Game', 'Title', '', game_name, 255,
'.\\Game.ini')
game_name.delete!("\0")
return FIND_WINDOW.call('RGSS Player', game_name)
end
#------------------------------------------------------------
WINDOW = self.find_window
end
$mouse = Mouse.new
#--------------------------------------------------------------
module Input
class << Input
alias update_mousecontroller_later update
end
#------------------------------------------------------------
def self.update
$mouse.update
update_mousecontroller_later
end
#------------------------------------------------------------
if Mouse::AUTO_CONFIGURE
if $BlizzABS
C.push(Input::Key['Mouse Left']) if
!C.include?(Input::Key['Mouse Left'])
if !Attack.include?(Input::Key['Mouse Right'])
Attack.push(Input::Key['Mouse Right'])
end
elsif $tons_version != nil && $tons_version >= 6.4 &&
TONS_OF_ADDONS::CUSTOM_CONTROLS || defined?(RMXOS)
C.push(Input::Key['Mouse Left']) if !C.include?(
Input::Key['Mouse Left'])
end
end
end
#--------------------------------------------------------------
class Rect
def covers?(x, y)
return !(x < self.x || x >= self.x + self.width ||
y < self.y || y >= self.y + self.height)
end
end
[box class=catbg2]
[/box]
Não há necessidade de Demo. Screens:(http://img33.imageshack.us/img33/3001/digihudscreen.png)
[box class=catbg2]
[/box]
- thiago_d_d por fazer o script
- Blizzard por fazer o sistema de mouse utilizado
Olá, vc tem as imagens da HUD? EU tentei fazer as minhas e ficaram tortas... Eu queria as originais pra usar como base.
Olá [user]phychan[/user]. Esse sistema é de 2012, o autor já não aparece há um bom tempo. Eu sugiro que você peça por uma nova abrindo um tópico aqui (http://centrorpg.com/index.php?board=21.0). Caso faça isso, inclua um link para este sistema e uma imagem da HUD durante o jogo. :ok: