MOG MPW Icon v1.0

8 de janeiro de 2015

MOG MPW Icon é um script desenvolvido para ser usado em um projeto do RPG Maker XP pelo Moghunter que apresenta o HP e SP em forma de ícones na tela.

O MOG MPW Icon parece ter sido substituído por um script mais moderno. Alternativamente, você pode usar o MOG – I Hud 1.0, que é semelhante e já vem com as demos e imagens prontinhas para serem usadas, segundo o Mitsujii, que colaborou com esta publicação.

2 1

Utilização

O script vai calcular cada ícone pela porcentagem de HP ou SP. Ou seja, não é porque você toma um ponto de dano que você vai perder um ícone de HP (a não ser que o HP final máximo seja igual a quantidade final maxima de ícones).

Infelizmente não conseguimos achar a demo deste script, que já tinha todas as imagens e o script. Mas você pode criar o seu próprio medidor de ícones e usar no seu projeto. Se alguém tiver aqui, ou quiser fazer e mandar para nós, entre em contato comentando neste post ou no nosso fórum.

O código, como o de costume, basta ser adicionado acima do “Main”:

#_______________________________________________________________________________
# MOG_MPW ICON V1.0           
#_______________________________________________________________________________
# By Moghunter
# http://www.atelier-rgss.com
#_______________________________________________________________________________
# HUD que apresenta o HP e SP em forma de ícones.
#
# É preciso ter as imagens:
# HP_Icon
# HP_Icon_Back
# SP_Icon
# SP_Icon_Back
# Nome_do_Heroi_Face (Opcional)
# Dentro da pasta Graphics/Pictures.
#
# NOTA - O script vai calcular cada ícone pela porcentagem de
# HP ou SP, ou seja, não é porque você toma um ponto de dano
# que você vai perder um ícone de HP (a não ser que seu HP final
# seja igual a quantidade final de ícones.
#
#-------------------------------------------------------------------------------
module MOG
#Posição do HUD.
STMAPX = 0   # X Pos
STMAPY = 0   # Y Pos
#Switch que desativa o HUD.  
STMAPVIS = 5
#Quantidade maxima final de ícones para o HP.
MAX_ICON_HP = 20
#Quantidade maxima final de ícones para o SP.
MAX_ICON_SP = 20
#Espaço entre os ícones de HP na horizontal.
HP_ICON_SPACE_X = 20
#Espaço entre os ícones de SP na horizontal.
SP_ICON_SPACE_X = 10
#Espaço entre a primeira linha de ícones com a segunda linha.
#(Somente se a DIV_HP_LINE estiver como true)
HP_ICON_SPACE_Y = 48
#Espaço entre a primeira linha de ícones com a segunda linha.
#(Somente se a DIV_SP_LINE estiver como true)
SP_ICON_SPACE_Y = 64
#Deixar os ìcones de HP em 2 linhas quando o HP 
#passar da metade do valor maximo final.
DIV_HP_LINE = true
#Deixar os ìcones de SP em 2 linhas quando o SP 
#passar da metade do valor maximo final.
DIV_SP_LINE = false
#Mostrar a condição do personagem.
SHOW_STATES = true
end
$mogscript = {} if $mogscript == nil
$mogscript["mpstelen"] = true
##############
# Game_Actor #
##############
class Game_Actor < Game_Battler
attr_reader   :final_maxhp   
attr_reader   :final_maxsp   
def final_maxhp
return $data_actors[@actor_id].parameters[0,$data_actors[@actor_id].final_level]
end
def final_maxsp
return $data_actors[@actor_id].parameters[1,$data_actors[@actor_id].final_level]
end
end
###############
# Window_Base #
###############
class Window_Base < Window   
def draw_maphp2(actor, x, y)
one_icon_hp_max = actor.final_maxhp * MOG::MAX_ICON_HP / actor.final_maxhp
valor = 100 * actor.final_maxhp / 100
valor2 = 100 * actor.hp / 100
valor3 = one_icon_hp_max * valor2 / valor
valor4 = 100 * actor.maxhp / 100
valor5 = one_icon_hp_max * valor4 / valor 
valor6 = one_icon_hp_max * valor / valor
now_hp = RPG::Cache.icon("HP_Icon")    
now_cw = now_hp.width  
now_ch = now_hp.height 
now_hp_src_rect = Rect.new(0, 0, now_cw, now_ch)
max_hp = RPG::Cache.icon("HP_Icon_Back")    
max_cw = max_hp.width  
max_ch = max_hp.height 
max_hp_src_rect = Rect.new(0, 0, max_cw, max_ch)
if valor5 < 1
valor5 = 1  
end
if valor3 < 1 and actor.hp > 0
valor3 = 1  
elsif valor3 <= 0
valor3 = 0  
end  
if MOG::DIV_HP_LINE == true
div = valor6 / 2
if valor5 < div
for r in 0...valor5
x = r * MOG::HP_ICON_SPACE_X
self.contents.blt(x + 80, y - max_ch + 30, max_hp, max_hp_src_rect)
end
else
for r in 0...div
x = r * MOG::HP_ICON_SPACE_X
self.contents.blt(x + 80, y - max_ch + 30, max_hp, max_hp_src_rect)
end
for r in div...valor5
x = r * MOG::HP_ICON_SPACE_X
self.contents.blt(x + 80 - MOG::HP_ICON_SPACE_X * div, y - max_ch + MOG::HP_ICON_SPACE_Y, max_hp, max_hp_src_rect)
end
end
else
for r in 0...valor5
x = r * MOG::HP_ICON_SPACE_X
self.contents.blt(x + 80, y - max_ch + 30, max_hp, max_hp_src_rect)
end
end
if MOG::DIV_HP_LINE == true
div2 = valor6 / 2
if valor3 < div2
for i in 0...valor3
x = i * MOG::HP_ICON_SPACE_X
self.contents.blt(x + 80, y - now_ch + 30, now_hp, now_hp_src_rect)
end
else
for i in 0...div2
x = i * MOG::HP_ICON_SPACE_X
self.contents.blt(x + 80, y - now_ch + 30, now_hp, now_hp_src_rect)
end
for i in div2...valor3
x = i * MOG::HP_ICON_SPACE_X
self.contents.blt(x + 80 - MOG::HP_ICON_SPACE_X * div2, y - now_ch + MOG::HP_ICON_SPACE_Y, now_hp, now_hp_src_rect)
end
end
else
for i in 0...valor3
x = i * MOG::HP_ICON_SPACE
self.contents.blt(x + 80, y - now_ch + 30, now_hp, now_hp_src_rect)
end  
end
end  
def draw_mapsp2(actor, x, y)
one_icon_sp_max = actor.final_maxsp * MOG::MAX_ICON_SP / actor.final_maxsp
valor = 100 * actor.final_maxsp / 100
valor2 = 100 * actor.sp / 100
valor3 = one_icon_sp_max * valor2 / valor
valor4 = 100 * actor.maxsp / 100
valor5 = one_icon_sp_max * valor4 / valor  
valor6 = one_icon_sp_max * valor / valor
now_sp = RPG::Cache.icon("SP_Icon")    
now_cw = now_sp.width  
now_ch = now_sp.height 
now_sp_src_rect = Rect.new(0, 0, now_cw, now_ch)
max_sp = RPG::Cache.icon("SP_Icon_Back")    
max_cw = max_sp.width  
max_ch = max_sp.height 
max_sp_src_rect = Rect.new(0, 0, max_cw, max_ch)
if valor5 < 1
valor5 = 1  
end
if valor3 < 1 and actor.sp > 0
valor3 = 1  
elsif valor3 <= 0
valor3 = 0  
end
if MOG::DIV_SP_LINE == true
div = valor6 / 2
if valor5 < div
for r in 0...valor5
x = r * MOG::SP_ICON_SPACE_X
self.contents.blt(x + 80, y - max_ch + 30, max_sp, max_sp_src_rect)
end
else
for r in 0...div
x = r * MOG::SP_ICON_SPACE_X
self.contents.blt(x + 80, y - max_ch + 30, max_sp, max_sp_src_rect)
end
for r in div...valor5
x = r * MOG::SP_ICON_SPACE_X
self.contents.blt(x + 80 - MOG::SP_ICON_SPACE_X * div, y - max_ch + MOG::SP_ICON_SPACE_Y, max_sp, max_sp_src_rect)
end
end
else
for r in 0...valor5
x = r * MOG::SP_ICON_SPACE_X
self.contents.blt(x + 80, y - max_ch + 30, max_sp, max_sp_src_rect)
end
end
if MOG::DIV_SP_LINE == true
div = valor6 / 2
if valor5 < div
for r in 0...valor3
x = r * MOG::SP_ICON_SPACE_X
self.contents.blt(x + 80, y - now_ch + 30, now_sp, now_sp_src_rect)
end
else
for r in 0...div
x = r * MOG::SP_ICON_SPACE_X
self.contents.blt(x + 80, y - now_ch + 30, now_sp, now_sp_src_rect)
end
for r in div...valor3
x = r * MOG::SP_ICON_SPACE_X
self.contents.blt(x + 80 - MOG::SP_ICON_SPACE_X * div, y - now_ch + MOG::SP_ICON_SPACE_Y, now_sp, now_sp_src_rect)
end
end
else
for i in 0...valor3
x = i * MOG::SP_ICON_SPACE_X
self.contents.blt(x + 80, y - now_ch + 30, now_sp, now_sp_src_rect)
end  
end
end
def nada
face = RPG::Cache.picture("")
end  
def draw_heroface(actor,x,y) 
face = RPG::Cache.picture(actor.name + "_face") rescue nada
cw = face.width 
ch = face.height 
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, face, src_rect)    
end  
def draw_actor_statemap(actor, x, y)
self.contents.font.size = 16
self.contents.font.name = "Georgia"  
text = make_battler_state_text(actor, width, true)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 1, y + 1, 120, 32, text,1)
self.contents.font.color = Color.new(250,255,255,255)
self.contents.draw_text(x, y, 120, 32, text,1)
end
end
#####################
# Window_Status_Map #
#####################
class Window_Sthero < Window_Base
def initialize
super(0, 0, 640, 160)
self.contents = Bitmap.new(width - 32, height - 32)
self.windowskin = RPG::Cache.windowskin("")    
self.contents.font.bold = true
self.contents.font.size = 20
self.contents.font.name = "Georgia"
self.opacity = 0
refresh
end  
def refresh
self.contents.clear
actor = $game_party.actors[0]
draw_maphp2(actor,0, 0)
draw_mapsp2(actor, - 50, 50)
draw_heroface(actor, 0, 80)
draw_actor_statemap(actor, 0, 75) if MOG::SHOW_STATES == true
end
end
###############
# Game_Player #
###############
class Game_Player < Game_Character
attr_accessor :wref
end
#############
# Scene_Map #
#############
class Scene_Map
alias mog11_main main
def main
@sthero = Window_Sthero.new
@sthero.x = MOG::STMAPX
@sthero.y = MOG::STMAPY
if $game_switches[MOG::STMAPVIS] == false
@sthero.visible = true  
else
@sthero.visible = false  
end    
mog11_main
@sthero.dispose
end
alias mog11_update update
def update
if $game_switches[MOG::STMAPVIS] == false
@sthero.visible = true  
else
@sthero.visible = false  
end      
if $game_player.wref == true
@sthero.refresh
$game_player.wref = false
end
mog11_update
end  
end  
##############
# Game_Party #
###############
class Game_Party
alias mog11_check_map_slip_damage check_map_slip_damage  
def check_map_slip_damage
for actor in @actors
if actor.hp > 0 and actor.slip_damage?
$game_player.wref = true
end
end
mog11_check_map_slip_damage  
end
end
###############
# Interpreter #
###############
class Interpreter
alias mog11_command_311 command_311
def command_311
mog11_command_311
$game_player.wref = true    
end    
alias mog11_command_312 command_312
def command_312
mog11_command_312
$game_player.wref = true    
end    
alias mog11_command_313 command_313
def command_313
mog11_command_313
$game_player.wref = true    
end    
alias mog11_command_314 command_314
def command_314
mog11_command_314
$game_player.wref = true    
end    
alias mog11_command_315 command_315
def command_315
mog11_command_315
$game_player.wref = true    
end    
end    
################
# Game_Battler #
################
class Game_Battler
alias mog11_attack_effect attack_effect
def attack_effect(attacker)
mog11_attack_effect(attacker)  
$game_player.wref = true 
end
alias mog11_skill_effect skill_effect
def skill_effect(user, skill)
mog11_skill_effect(user, skill)
$game_player.wref = true  
end  
alias mog11_item_effect item_effect
def item_effect(item)
mog11_item_effect(item)
$game_player.wref = true  
end
alias mog11_add_state add_state
def add_state(state_id, force = false)
mog11_add_state(state_id, force = false)
$game_player.wref = true  
end
end

Observação: se você gostou deste post ou ele lhe foi útil de alguma forma, por favor considere apoiar financeiramente a Gaming Room. Fico feliz só de ajudar, mas a contribuição do visitante é muito importante para que este site continua existindo e para que eu possa continuar provendo este tipo de conteúdo e melhorar cada vez mais. Clique aqui e saiba como. Obrigado!

Deixe um comentário

Inscreva-se na nossa newsletter!