Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #============================================================================
- #VTS-HorzFace BattleHud
- #By Ventwig
- #Version 1 - May 24 2013
- #For RPGMaker VX Ace
- #============================================================================
- # So, here's my second script, which also happens to be a face HUD.
- #=============================================================================
- # Description:
- # This code here takes the bland lines and bars of the normal battle HUD
- # and spices it up by showing faces (centered in the window and suppouring
- # up to four party members) and full-length bars, too :)
- # The party command and actor commands are also turned into cool horizontal
- # selectable windows, as well as a few other resizings
- #==============================================================================
- # Compatability:
- # Don't expect much with anything that involves the basic commands window >.>
- # Works with Neo Gauge Ultimate Ace
- #===============================================================================
- # Instructions: Put in materials, above main. Almost Plug and Play
- # Put above Neo Gauge Ultimate Ace if used
- #==============================================================================
- # Credit is not required to use my scripts, but you are not allowed to
- # re-post them and/or claim them as your own.
- # If you would like to make an edit, please contact me first.
- #===============================================================================
- # NOTES:
- # Recommended with Jet's Simple Sideview.
- # The overall effect together is simple and amazing in my opinion.
- # These are my recommended settings:
- #
- # FIELD_POS = [400, 180]
- # FIELD_SPACING = [25, 20]
- #
- # FIELD_POS = [400, 200]
- # FIELD_SPACING = [30, 15]
- #############################################################################
- #Customization - There's really none...let me know if you need something!
- #############################################################################
- class Window_BattleStatus < Window_Selectable
- ###################################################################
- #Sets up what appears in the HUD
- #Questions names and HUD, then displays them
- #################################################################
- #Set up the window's start-up
- def initialize
- #Draws window
- super(0,0,545,120)
- self.z = 0
- @x, @y = 5, 50
- @party_size = $game_party.all_members.size
- battle_hud
- end
- def battle_hud
- if $game_party.all_members.size == 1
- @actor = $game_party.members[0]
- @actor_hp = @actor.hp
- @actor_mp = @actor.mp
- @actor_tp = @actor.tp
- draw_actor_face(@actor, @x+189, @y-50, enabled = true)
- draw_actor_hp(@actor, @x-5+189, @y-50)
- draw_actor_mp(@actor, @x-5+189, @y-50+75-17)
- draw_actor_tp(@actor, @x-5+189, @y-50+75)
- draw_actor_icons(@actor, @x-5+190, @y-10)
- elsif $game_party.all_members.size == 2
- @actor = $game_party.members[0]
- @actor2 = $game_party.members[1]
- @actor_hp = @actor.hp
- @actor_mp = @actor.mp
- @actor2_hp = @actor2.hp
- @actor2_mp = @actor2.mp
- @actor_tp = @actor.tp
- @actor2_tp = @actor2.tp
- draw_actor_face(@actor, @x+126, @y-50, enabled = true)
- draw_actor_face(@actor2, @x+252, @y-50, enabled = true)
- draw_actor_hp(@actor, @x-5+126, @y-50)
- draw_actor_hp(@actor2, @x-5+252, @y-50)
- draw_actor_mp(@actor, @x-5+126, @y-50+75-17)
- draw_actor_mp(@actor2, @x-5+252, @y-50+75-17)
- draw_actor_tp(@actor, @x-5+126, @y-50+75)
- draw_actor_tp(@actor2, @x-5+252, @y-50+75)
- draw_actor_icons(@actor, @x-5+126, @y-10)
- draw_actor_icons(@actor2, @x-5+252, @y-10)
- elsif $game_party.all_members.size == 3
- @actor = $game_party.members[0]
- @actor2 = $game_party.members[1]
- @actor3 = $game_party.members[2]
- @actor_hp = @actor.hp
- @actor_mp = @actor.mp
- @actor2_hp = @actor2.hp
- @actor2_mp = @actor2.mp
- @actor3_hp = @actor3.hp
- @actor3_mp = @actor3.mp
- @actor_tp = @actor.tp
- @actor2_tp = @actor2.tp
- @actor3_tp = @actor3.tp
- draw_actor_face(@actor, @x+63, @y-50, enabled = true)
- draw_actor_face(@actor2, @x+189, @y-50, enabled = true)
- draw_actor_face(@actor3, @x+315, @y-50, enabled = true)
- draw_actor_hp(@actor, @x-5+63, @y-50)
- draw_actor_hp(@actor2, @x-5+189, @y-50)
- draw_actor_hp(@actor3, @x-5+315, @y-50)
- draw_actor_mp(@actor, @x-5+63, @y-50+75-17)
- draw_actor_mp(@actor2, @x-5+189, @y-50+75-17)
- draw_actor_mp(@actor3, @x-5+315, @y-50+75-17)
- draw_actor_tp(@actor, @x-5+63, @y-50+75)
- draw_actor_tp(@actor2, @x-5+189, @y-50+75)
- draw_actor_tp(@actor3, @x-5+315, @y-50+75)
- draw_actor_icons(@actor, @x-5+63, @y-10)
- draw_actor_icons(@actor2, @x-5+189, @y-10)
- draw_actor_icons(@actor3, @x-5+315, @y-10)
- elsif $game_party.all_members.size > 3
- @actor = $game_party.members[0]
- @actor2 = $game_party.members[1]
- @actor3 = $game_party.members[2]
- @actor4 = $game_party.members[3]
- @actor_hp = @actor.hp
- @actor_mp = @actor.mp
- @actor2_hp = @actor2.hp
- @actor2_mp = @actor2.mp
- @actor3_hp = @actor3.hp
- @actor3_mp = @actor3.mp
- @actor4_hp = @actor4.hp
- @actor4_mp = @actor4.mp
- @actor_tp = @actor.tp
- @actor2_tp = @actor2.tp
- @actor3_tp = @actor3.tp
- @actor4_tp = @actor4.tp
- @actor_draw = @x
- draw_actor_face(@actor, @x, @y-50, enabled = true)
- draw_actor_face(@actor2, @x+126, @y-50, enabled = true)
- draw_actor_face(@actor3, @x+252, @y-50, enabled = true)
- draw_actor_face(@actor4, @x+378, @y-50, enabled = true)
- draw_actor_hp(@actor, @x-5, @y-50)
- draw_actor_hp(@actor2, @x-5+126, @y-50)
- draw_actor_hp(@actor3, @x-5+252, @y-50)
- draw_actor_hp(@actor4, @x-5+378, @y-50)
- draw_actor_mp(@actor, @x-5, @y-50+75-17)
- draw_actor_mp(@actor2, @x-5+126, @y-50+75-17)
- draw_actor_mp(@actor3, @x-5+252, @y-50+75-17)
- draw_actor_mp(@actor4, @x-5+378, @y-50+75-17)
- draw_actor_tp(@actor, @x-5, @y-50+75)
- draw_actor_tp(@actor2, @x-5+126, @y-50+75)
- draw_actor_tp(@actor3, @x-5+252, @y-50+75)
- draw_actor_tp(@actor4, @x-5+378, @y-50+75)
- draw_actor_icons(@actor, @x-5, @y-10)
- draw_actor_icons(@actor2, @x-5+126, @y-10)
- draw_actor_icons(@actor3, @x-5+252, @y-10)
- draw_actor_icons(@actor4, @x-5+378, @y-10)
- end
- end
- def item_rect(index)
- if $game_party.all_members.size == 1
- rect = Rect.new
- rect.width = 126
- rect.height = 126
- rect.x = 189 + index / col_max * 126
- rect.y = 0
- rect
- elsif $game_party.all_members.size == 2
- rect = Rect.new
- rect.width = 126
- rect.height = 126
- rect.x = 126 + index / col_max * 126
- rect.y = 0
- rect
- elsif $game_party.all_members.size == 3
- rect = Rect.new
- rect.width = 126
- rect.height = 126
- rect.x = 63 + index / col_max * 126
- rect.y = 0
- rect
- elsif $game_party.all_members.size > 3
- rect = Rect.new
- rect.width = 126
- rect.height = 126
- rect.x = 0 + index / col_max * 126
- rect.y = 0
- rect
- end
- end
- ###################################################################
- #Refresh the window to show all changes to the HUD
- #It just copies the intizalize code.
- #Also choos when to updat
- #################################################################
- def refresh
- contents.clear
- battle_hud
- @party_size = $game_party.all_members.size
- end
- def update
- # Chooses when to update the code.
- # Checks the party size, then if any member's HP or MP was damaged.
- # If any of the features are changed, it replays the intialize
- super
- if @party_size != $game_party.all_members.size
- refresh
- end
- if @party_size > 0
- if $game_party.members[0].hp != @actor_hp or $game_party.members[0].mp != @actor_mp or $game_party.members[0].tp != @actor_tp
- refresh
- end
- end
- if @party_size > 1
- if $game_party.members[1].hp != @actor2_hp or $game_party.members[1].mp != @actor2_mp or $game_party.members[1].tp != @actor2_tp
- refresh
- end
- end
- if @party_size > 2
- if $game_party.members[2].hp != @actor3_hp or $game_party.members[2].mp != @actor3_mp or $game_party.members[2].tp != @actor3_tp
- refresh
- end
- end
- if @party_size > 3
- if $game_party.members[3].hp != @actor4_hp or $game_party.members[3].mp != @actor4_mp or $game_party.members[3].tp != @actor4_tp
- refresh
- end
- end
- end
- end
- #====================================================================
- class Window_PartyHorzCommand < Window_HorzCommand
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(window_width)
- @window_width = window_width
- super(0, 0)
- end
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- @window_width
- end
- #--------------------------------------------------------------------------
- # * Get Digit Count
- #--------------------------------------------------------------------------
- def col_max
- return 2
- end
- #--------------------------------------------------------------------------
- # * Create Command List
- #--------------------------------------------------------------------------
- def make_command_list
- add_command(Vocab::fight, :fight)
- add_command(Vocab::escape, :escape, BattleManager.can_escape?)
- end
- #--------------------------------------------------------------------------
- # * Setup
- #--------------------------------------------------------------------------
- def setup
- clear_command_list
- make_command_list
- refresh
- select(0)
- activate
- open
- end
- end
- #====================================================================
- #====================================================================
- class Window_ActorHorzCommand < Window_HorzCommand
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(window_width)
- @window_width = window_width
- super(0, 0)
- end
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- @window_width
- end
- #--------------------------------------------------------------------------
- # * Get Digit Count
- #--------------------------------------------------------------------------
- def col_max
- return 4
- end
- #--------------------------------------------------------------------------
- # * Create Command List
- #--------------------------------------------------------------------------
- def make_command_list
- return unless @actor
- add_attack_command
- add_skill_commands
- add_guard_command
- add_item_command
- end
- #--------------------------------------------------------------------------
- # * Add Attack Command to List
- #--------------------------------------------------------------------------
- def add_attack_command
- add_command(Vocab::attack, :attack, @actor.attack_usable?)
- end
- #--------------------------------------------------------------------------
- # * Add Skill Command to List
- #--------------------------------------------------------------------------
- def add_skill_commands
- @actor.added_skill_types.sort.each do |stype_id|
- name = $data_system.skill_types[stype_id]
- add_command(name, :skill, true, stype_id)
- end
- end
- #--------------------------------------------------------------------------
- # * Add Guard Command to List
- #--------------------------------------------------------------------------
- def add_guard_command
- add_command(Vocab::guard, :guard, @actor.guard_usable?)
- end
- #--------------------------------------------------------------------------
- # * Add Item Command to List
- #--------------------------------------------------------------------------
- def add_item_command
- add_command(Vocab::item, :item)
- end
- #--------------------------------------------------------------------------
- # * Setup
- #--------------------------------------------------------------------------
- def setup(actor)
- @actor = actor
- clear_command_list
- make_command_list
- refresh
- select(0)
- activate
- open
- end
- end
- #====================================================================
- #====================================================================
- #====================================================================
- class Scene_Battle < Scene_Base
- alias face_status_create_status_window create_status_window
- def create_status_window
- face_status_create_status_window
- @status_window = Window_BattleStatus.new
- @status_window.x = 128
- end
- def create_info_viewport
- @info_viewport = Viewport.new
- @info_viewport.rect.y = Graphics.height - @status_window.height - 48
- @info_viewport.rect.height = @status_window.height + 48
- @info_viewport.z = 100
- @info_viewport.ox = 0
- @status_window.viewport = @info_viewport
- end
- def move_battle_window(y)
- current_y = @status_window.y
- @status_window.y = [y, current_y + 16].min if current_y < y
- @status_window.y = [y, current_y - 16].max if current_y > y
- end
- alias face_status_window_viewport update_info_viewport
- def update_info_viewport
- move_info_viewport(128) if @party_command_window.active
- move_battle_window(0) if @party_command_window.active
- move_battle_window(50) if BattleManager.in_turn?
- end
- def create_party_command_window
- @party_command_window = Window_PartyHorzCommand.new(Graphics.width)
- @party_command_window.x = 0
- @party_command_window.height = 48
- @party_command_window.y = Graphics.height - 48
- @party_command_window.width = @status_window.width
- @party_command_window.set_handler(:fight, method(:command_fight))
- @party_command_window.set_handler(:escape, method(:command_escape))
- @party_command_window.unselect
- end
- def create_actor_command_window
- @actor_command_window = Window_ActorHorzCommand.new(Graphics.width)
- @actor_command_window.x = 0
- @actor_command_window.height = 48
- @actor_command_window.y = Graphics.height - 48
- @actor_command_window.width = @status_window.width
- @actor_command_window.set_handler(:attack, method(:command_attack))
- @actor_command_window.set_handler(:skill, method(:command_skill))
- @actor_command_window.set_handler(:guard, method(:command_guard))
- @actor_command_window.set_handler(:item, method(:command_item))
- @actor_command_window.set_handler(:cancel, method(:prior_command))
- end
- alias face_status_create_enemy_window create_enemy_window
- def create_enemy_window
- face_status_create_enemy_window
- @enemy_window.x = 0
- @enemy_window.width = Graphics.width
- end
- end
- #########################################################################
- #End Of Script #
- #########################################################################
Advertisement
Add Comment
Please, Sign In to add comment