MOG Window Active Battler V1.0

18 de março de 2014

MOG Window Active Battler é um script para o RPG Maker XP, desenvolvido pelo Moghunter, que apresenta uma imagem em movimento de indicação do battler ativo.

O código foi desenvolvido baseado no script “Nome do Inimigo” por Xiderowg.

Instalação

Para instalar o script, primeiramente adicione a imagem abaixo dentro da pasta Graphics\Windowskin com o nome de Arrow_Active:

Depois adicione o código abaixo acima do Main:

#_________________________________________________
# MOG Window Active Battler V1.0            
#_________________________________________________
# By Moghunter     
# http://www.atelier-rgss.com
#_________________________________________________
# Apresenta a imagem de indicação do battler ativo.
# É necessário ter a imagem ARROW_ACTIVE.PNG dentro
# da pasta Graphics\Windowskin.
#_________________________________________________
$mogscript = {} if $mogscript == nil
$mogscript["Window_Active_Battler"] = true
###############
# Window Base #
###############
class Window_Base < Window
def nd_arrow_active
help_pic = RPG::Cache.picture("")     
end  
def draw_arrow_active(x,y)
arrow_pic = RPG::Cache.windowskin("Arrow_Active") rescue nd_arrow_active 
cw = arrow_pic.width  
ch = arrow_pic.height 
$window_active_wifth = ch
$window_active_height = cw
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, arrow_pic, src_rect)
end
end
######################
# Window_Active_Help #
######################
class Window_Active < Window_Base
def initialize
super(0, 0, 132, 80)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
self.z = 1000
refresh
end
def refresh
self.contents.clear
draw_arrow_active(5,40)  
end
end
##############
# Game_Actor #
##############
class Game_Actor < Game_Battler
def battler_rect
bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
return Rect.new(self.screen_x, self.screen_y, bitmap.width, bitmap.height)
end
end
##############
# Game_Enemy #
##############
class Game_Enemy < Game_Battler
def battler_rect
bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
return Rect.new(self.screen_x, self.screen_y, bitmap.width, bitmap.height)
end
end
################
# Scene_Battle #
################
class Scene_Battle
alias mog52_main main
def main
@active_window = Window_Active.new
@active_window.visible = false
@active_window.contents_opacity = 255
@win_time_help = 0
mog52_main
@active_window.dispose
end
alias mog52_update update 
def update
mog52_update
if @active_battler.is_a?(Game_Actor) and not @active_battler.dead?
actor = @active_battler
rect = actor.battler_rect     
if  @active_window.x > [rect.x - 64].max 
@active_window.x -= 5
elsif@active_window.x <= [rect.x - 64].max 
@active_window.x = [rect.x - 64].max          
end 
elsif @active_battler.is_a?(Game_Enemy) and not @active_battler.dead?
enemy = @active_battler
rect = enemy.battler_rect
if  @active_window.x > [rect.x - 64].max 
@active_window.x -= 5
elsif@active_window.x <= [rect.x - 64].max 
@active_window.x = [rect.x - 64].max          
end 
end  
if @active_window.contents_opacity > 0
@active_window.contents_opacity -= 2
elsif @active_window.contents_opacity <= 0
@active_window.visible = false
end
end
alias mog52_update_phase4_step2 update_phase4_step2
def update_phase4_step2
mog52_update_phase4_step2
if @active_battler.is_a?(Game_Actor) and not @active_battler.dead?
@active_window.visible = true
@active_window.contents_opacity = 255 
actor = @active_battler
rect = actor.battler_rect     
@active_window.x = 64 + [rect.x - 64].max 
@active_window.y = [rect.y - 64].max      
elsif @active_battler.is_a?(Game_Enemy) and not @active_battler.dead?
@active_window.visible = true
@active_window.contents_opacity = 255 
@active_window.visible = true
@active_window.contents_opacity = 255      
enemy = @active_battler
rect = enemy.battler_rect
@active_window.x = 64 + [rect.x - 64].max 
@active_window.y = [rect.y - 64].max 
end  
end
alias mog52_start_phase5 start_phase5  
def start_phase5
mog52_start_phase5  
@active_window.visible = false    
end 
alias mog52_update_phase2 update_phase2
def update_phase2
mog52_update_phase2
@active_window.visible = false
end 
alias mog52_update_phase3 update_phase3
def update_phase3
mog52_update_phase3
@active_window.visible = false
end 
alias mog52_update_phase4_step6 update_phase4_step6
def update_phase4_step6
mog52_update_phase4_step6
@active_window.visible = false
end
end

Informações adicionais

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. Acesse aqui e saiba como. Obrigado!

Deixe um comentário

Inscreva-se na nossa newsletter!