# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Show Box On Actor ║ Version: 1.01 ║
# ║ Author: Roninator2 ║ ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function: ║ Date Created ║
# ║ ╠════════════════════╣
# ║ Show box on actor command selection ║ 15 Aug 2022 ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Image must be in Graphics\System folder. ║
# ╚══════════════════════════════════════════════════════════╝
# ╔═════════════════════════════════════╗
# ║ Terms of use: ║
# ║ Free for all uses in RPG Maker ║
# ╚═════════════════════════════════════╝
module R2_Window_Select_Box
IMAGE = "Status_Select"
SHOW_FACE = false
HUD_HIDE = true
end
class Window_Custom_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
if $game_party.members.size < 4
super(100, 0, 110 * $game_party.members.size,120)
else
super(100, 0, 110 * 4,120)
end
create_contents
@actor1 = $game_party.members[0]
@actor2 = $game_party.members[1]
@actor3 = $game_party.members[2]
@actor4 = $game_party.members[3]
refresh
self.openness = 0
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
actor = $game_party.battle_members[index]
end
#--------------------------------------------------------------------------
# * Get Number of Lines to Show
#--------------------------------------------------------------------------
def visible_line_number
return 4
end
#--------------------------------------------------------------------------
# * Get Digit Count
#--------------------------------------------------------------------------
def col_max
return 4
end
#----------------------------------------------------
# * Refresh
#----------------------------------------------------
def refresh
contents.clear
draw_window_content
#~ draw_horz_line(line_height * 1)
end
#----------------------------------------------------
# * Draw Window Contents
#----------------------------------------------------
def draw_window_content
# Face
if R2_Window_Select_Box::SHOW_FACE == true
draw_face(@actor1.face_name, @actor1.face_index, 0, 0, enabled = false)
if $game_party.members.size > 1
draw_face(@actor2.face_name, @actor2.face_index, 110, 0, enable = false)
end # > 1
if $game_party.members.size > 2
draw_face(@actor3.face_name, @actor3.face_index, 220, 0, enable = false)
end # > 2
if $game_party.members.size > 3
draw_face(@actor4.face_name, @actor4.face_index, 330, 0, enable = false)
end # > 3
end # if face
# Actor Name
draw_actor_name(@actor1, 0, 0)
if $game_party.members.size > 1
draw_actor_name(@actor2, 110, 0)
end # > 1
if $game_party.members.size > 2
draw_actor_name(@actor3, 220, 0)
end # > 2
if $game_party.members.size > 3
draw_actor_name(@actor4, 330, 0)
end # > 3
# Actor HP
draw_actor_hp(@actor1, 0, 24, 80)
if $game_party.members.size > 1
draw_actor_hp(@actor2, 110, 24, 80)
end # > 1
if $game_party.members.size > 2
draw_actor_hp(@actor3, 220, 24, 80)
end # > 2
if $game_party.members.size > 3
draw_actor_hp(@actor4, 330, 24, 80)
end # > 3
# Actor MP
draw_actor_mp(@actor1, 0, 44, 80)
if $game_party.members.size > 1
draw_actor_mp(@actor2, 110, 44, 80)
end # > 1
if $game_party.members.size > 2
draw_actor_mp(@actor3, 220, 44, 80)
end # > 2
if $game_party.members.size > 3
draw_actor_mp(@actor4, 330, 44, 80)
end # > 3
# Actor LV
draw_actor_level(@actor1, 0, 64)
if $game_party.members.size > 1
draw_actor_level(@actor2, 110, 64)
end # > 1
if $game_party.members.size > 2
draw_actor_level(@actor3, 220, 64)
end # > 2
if $game_party.members.size > 3
draw_actor_level(@actor4, 330, 64)
end # > 3
# Actor Icons
draw_actor_icons(@actor1, 60, 0)
if $game_party.members.size > 1
draw_actor_icons(@actor2, 170, 0)
end # > 1
if $game_party.members.size > 2
draw_actor_icons(@actor3, 280, 0)
end # > 2
if $game_party.members.size > 3
draw_actor_icons(@actor4, 400, 0)
end # > 3
end #end draw_window_content
#----------------------------------------------------
# * Draw Actor Info
#----------------------------------------------------
def draw_actor_info(actor, x, y, width)
draw_face(actor.face_name, actor.face_index, x, y, false) if R2_Window_Select_Box::SHOW_FACE
draw_actor_names(actor, x, y) # modified
draw_actor_hp(actor, x, y+24, width)
draw_actor_mp(actor, x, y+44, width)
draw_actor_level(actor, x, y+64)
draw_actor_icons(actor, x+60, y)
end
#----------------------------------------------------
# * Draw Actor Name
#----------------------------------------------------
# roninator addon
def draw_actor_names(actor, x, y, width = 112)
change_color(hp_color(actor))
text = actor.name
text = text[0..((width / 13) - 1)]
draw_text(x, y, width, line_height, text)
end
#----------------------------------------------------
# * Draw Active Actor
#----------------------------------------------------
def draw_active_box(index)
clear_select if @box
@box = Sprite.new
@box.bitmap = Cache.system(R2_Window_Select_Box::IMAGE)
width =
@box.z = self.z + 120
@box.x = index * 107 + 5
@box.y = Graphics.height - self.height + 5
@box_shown = true
end
#----------------------------------------------------
# * Remove Select Box
#----------------------------------------------------
def clear_select
return if @box.nil?
@box.bitmap.dispose
@box.dispose
@box_shown = false
end
#----------------------------------------------------
# * Update
#----------------------------------------------------
alias r2_box_anim_update update
def update
r2_box_anim_update
if @box_shown
if @box.opacity < 20
@boxanim = false
elsif @box.opacity > 250
@boxanim = true
end
if @boxanim == true
@box.opacity -= 5
else
@box.opacity += 5
end
end
end
end
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * Create Custom Status Window
#--------------------------------------------------------------------------
def create_status_window
@status_window = Window_Custom_BattleStatus.new
@status_window.x = 128
end
#--------------------------------------------------------------------------
# * Start Party Command Selection
#--------------------------------------------------------------------------
def start_party_command_selection
unless scene_changing?
if R2_Window_Select_Box::HUD_HIDE == true
@info_viewport.rect.height = 120
end #if HUDE_HIDE
refresh_status
@status_window.open
if BattleManager.input_start
@actor_command_window.close
@party_command_window.setup
else
@party_command_window.deactivate
turn_start
end
end
end
#--------------------------------------------------------------------------
# * Start Actor Command Selection
#--------------------------------------------------------------------------
def start_actor_command_selection
@party_command_window.close
@actor_command_window.setup(BattleManager.actor)
b = BattleManager.actor
index = -1
$game_party.members.each_with_index do |a, i|
index = i if a.id == b.id
end
@status_window.draw_active_box(index)
end
#--------------------------------------------------------------------------
# * To Previous Command Input
#--------------------------------------------------------------------------
def prior_command
if BattleManager.prior_command
start_actor_command_selection
else
@status_window.clear_select
start_party_command_selection
end
end
#--------------------------------------------------------------------------
# * Start Turn
#--------------------------------------------------------------------------
def turn_start
@status_window.clear_select
@party_command_window.close
@actor_command_window.close
@subject = nil
BattleManager.turn_start
if R2_Window_Select_Box::HUD_HIDE == true
@info_viewport.rect.height = 60
end #if HUDE_HIDE
@log_window.clear
end
end