Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # Yanfly Engine RD - Display Party Data 2.0
- # Last Date Updated: 2009.05.30
- # Level: Easy
- #
- # This pretty much changes the party information window in battles to show the
- # party member names horizontally than vertically. When structured as such,
- # you'll be able to see the party members' faces and/or sprites. With the new
- # arrangement, the player can also see up to four status effects on each actor
- # as opposed to the original two. A big difference.
- #
- # Version 2.0 gives options to change font size, show extra gauges (for rage and
- # morale) and no longer hides the actor sprite behind the states.
- #
- #===============================================================================
- # Instructions
- #===============================================================================
- #
- # Just put this script under Materials and that's it. If you'd like to change
- # other settings such as showing the face graphic or changing its opacity, just
- # scroll down a bit and make adjustments as necessary.
- #
- #===============================================================================
- # Updates:
- # ----------------------------------------------------------------------------
- # o 2009.05.30 - Fixed max states shown bug.
- # - Greatly improved drawing efficiency.
- # o 2009.05.16 - Started and finished version 2.0.
- # o 2009.02.23 - Started script and finished.
- #===============================================================================
- #
- # Compatibility
- # - Alias: Window_BattleStatus, initialize
- # - Overwrites: Window_BattleStatus, draw_item
- #
- #===============================================================================
- $imported = {} if $imported == nil
- $imported["DisplayPartyData"] = true
- module YE
- module BATTLE
- module DISPLAY
- # This changes what will and will not be shown. If you choose to shown
- # the actor's face graphic, you can choose its opacity. 255 means it's
- # fully visible while 0 means it's completely transparent. For the
- # number of states shown, do not exceed 4 unless you want the states to
- # overlap into the next actor's data window.
- SHOW_ALLY_FACE = true
- ALLY_FACE_OPACITY = 255
- SHOW_ALLY_SPRITE = false
- MAX_STATES_SHOWN = 2
- # This governs the sizes used for each of the items in the display.
- NAME_FONT_SIZE = 16
- STAT_FONT_SIZE = 16
- # This governs how HP and MP are shown. Here is a type listing for each
- # individual one.
- # Type 1 = Current Type 4 = Current & Percentage
- # Type 2 = Current/Maximum Type 5 = Current/Max & Percent
- # Type 3 = Percentage
- SHOWN_HP_TYPE = 1
- SHOWN_MP_TYPE = 1
- # For those using Custom Skill Effects and would like to show Rage for
- # your bar, input the ID's of the classes you would Rage to appear for.
- # The reason this is dependent on class rather than character is because
- # if the character switches classes to one that no longer uses rage, the
- # rage meter will be useless there.
- RAGE_CLASSES = [1, 2]
- # This governs the type of display used for Rage. Here's a list of the
- # various types of way you can choose to display Rage. If you don't want
- # rage to be displayed at all, set it to 0.
- # Type 1 - Rage icon and number value appears in lower left corner. MP
- # bar is moved over to give room for Rage bar.
- # Type 2 - Rage icon and number value appears in lower right corner. MP
- # bar is on the left side instead.
- RAGE_DISPLAY = 1
- # This governs the text shown for rage and the gauge colours used.
- RAGE_TEXT = "RG"
- RAGE_GAUGE1 = 2
- RAGE_GAUGE2 = 10
- # For those who are using Battler Stat Morale, this script can place a
- # morale gauge under your MP bar (after pushing it upward).
- GAUGE_MORALE = true
- MORALE_TEXT = "Morale"
- MORALE_GAUGE1 = 28 # This is for positive morale.
- MORALE_GAUGE2 = 29 # This is for positive morale.
- MORALE_GAUGE3 = 30 # This is for positive morale.
- MORALE_GAUGE4 = 31 # This is for positive morale.
- # For those who don't want an extra gauge but would still like to show
- # morale, there's an icon you can display for it instead. Morale icon
- # will not appear if morale is equal to zero.
- ICON_MORALE = true
- ICON_MORALE_HIGH = 242 # Appears when morale is positive.
- ICON_MORALE_LOW = 241 # Appears when morale is negative.
- MORALE_DIVISOR = 100 # How much morale shown is divided by.
- MORALE_FONT_SIZE = 16 # This is the font size used for morale icon.
- MORALE_COL_HIGH = 0 # This is the text colour used for high morale.
- MORALE_COL_LOW = 8 # This is the text colour used for low morale.
- end # end module DISPLAY
- end # end module BATTLE
- end # end module YE
- #===============================================================================
- # Don't touch anything past here or else your computer will explode and you will
- # be a very sad person.
- #===============================================================================
- #==============================================================================
- # Window_BattleStatus
- #==============================================================================
- class Window_BattleStatus < Window_Selectable
- #--------------------------------------------------------------------------
- # Alias Object Initialization
- #--------------------------------------------------------------------------
- alias displaypartydata_initialize initialize unless $@
- def initialize
- displaypartydata_initialize
- @column_max = $game_party.members.size
- @spacing = 0
- end
- #--------------------------------------------------------------------------
- # Draw Item
- #--------------------------------------------------------------------------
- def draw_item(index)
- rect = Rect.new(0, 0, 0, 0)
- rect.width = 96
- rect.height = 96
- rect.x = index * 96
- rect.y = 0
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- @actor = $game_party.members[index]
- draw_party_face(index)
- draw_party_state(index)
- draw_party_name(index)
- draw_party_graphic(index)
- draw_party_hp(index)
- draw_party_mp(index)
- draw_party_morale(index)
- end
- #--------------------------------------------------------------------------
- # Update Cursor
- #--------------------------------------------------------------------------
- def update_cursor
- if @index < 0
- self.cursor_rect.empty
- else
- self.cursor_rect.set(@index * 96, 0, 96, 96)
- end
- end
- #--------------------------------------------------------------------------
- # Draw Party Face
- #--------------------------------------------------------------------------
- def draw_party_face(index)
- return unless YE::BATTLE::DISPLAY::SHOW_ALLY_FACE
- opacity = YE::BATTLE::DISPLAY::ALLY_FACE_OPACITY
- @actor = $game_party.members[index]
- face_name = @actor.face_name
- face_index = @actor.face_index
- bitmap = Cache.face(face_name)
- rect = Rect.new(0, 0, 0, 0)
- rect.x = face_index % 4 * 96 + 4 / 2
- rect.y = face_index / 4 * 96 + 4 / 2
- rect.width = 92
- rect.height = 92
- self.contents.blt(index * 96 + 2, 2, bitmap, rect, opacity)
- bitmap.dispose
- end
- #--------------------------------------------------------------------------
- # Draw Party State
- #--------------------------------------------------------------------------
- def draw_party_state(index)
- return unless YE::BATTLE::DISPLAY::MAX_STATES_SHOWN > 0
- dx = index * 96
- dy = WLH * 1
- dw = YE::BATTLE::DISPLAY::MAX_STATES_SHOWN * 24
- draw_actor_state(@actor, dx, dy, dw)
- end
- #--------------------------------------------------------------------------
- # Draw Party Graphic
- #--------------------------------------------------------------------------
- def draw_party_graphic(index)
- return unless YE::BATTLE::DISPLAY::SHOW_ALLY_SPRITE
- @actor = $game_party.members[index]
- dx = index * 96 + 48
- dy = WLH * 3 - YE::BATTLE::DISPLAY::STAT_FONT_SIZE + 16 + 2
- if $imported["BattlerStatMorale"] and YE::BATTLE::DISPLAY::GAUGE_MORALE
- dy -= YE::BATTLE::DISPLAY::STAT_FONT_SIZE
- end
- draw_character(@actor.character_name, @actor.character_index, dx, dy)
- end
- #--------------------------------------------------------------------------
- # Draw Party Name
- #--------------------------------------------------------------------------
- def draw_party_name(index)
- self.contents.font.color = hp_color(@actor)
- self.contents.font.size = YE::BATTLE::DISPLAY::NAME_FONT_SIZE
- dx = 96 * index + 4
- dy = 0
- dw = 94
- if $imported["BattlerStatMorale"] and YE::BATTLE::DISPLAY::ICON_MORALE
- dw -= 24
- end
- self.contents.draw_text(dx, dy, dw, WLH, @actor.name)
- end
- #--------------------------------------------------------------------------
- # Draw Party HP
- #--------------------------------------------------------------------------
- def draw_party_hp(index)
- dx = index * 96 + 2
- dy = WLH * 3 - YE::BATTLE::DISPLAY::STAT_FONT_SIZE + 2
- if $imported["BattlerStatMorale"] and YE::BATTLE::DISPLAY::GAUGE_MORALE
- dy -= YE::BATTLE::DISPLAY::STAT_FONT_SIZE
- end
- dw = 92
- draw_actor_hp_gauge(@actor, dx, dy, dw)
- self.contents.font.size = YE::BATTLE::DISPLAY::STAT_FONT_SIZE
- self.contents.font.color = system_color
- self.contents.draw_text(dx + 2, dy + 4, 28, WLH, Vocab::hp_a, 0)
- self.contents.font.color = hp_color(@actor)
- text = sprintf("%d/%d", @actor.hp, @actor.maxhp)
- percent = @actor.hp * 100.0 / @actor.maxhp
- case YE::BATTLE::DISPLAY::SHOWN_HP_TYPE
- when 1; text = @actor.hp
- when 2; text = sprintf("%d/%d", @actor.hp, @actor.maxhp)
- when 3; text = sprintf("%d%%", percent)
- when 4; text = sprintf("%d %d%%", @actor.hp, percent)
- when 5; text = sprintf("%d/%d %d%%", @actor.hp, @actor.maxhp, percent)
- end
- self.contents.draw_text(dx + 30, dy + 4, dw - 32, WLH, text, 2)
- end
- #--------------------------------------------------------------------------
- # Draw Party HP
- #--------------------------------------------------------------------------
- def draw_party_mp(index)
- dx = index * 96 + 2
- dy = WLH * 3
- if $imported["BattlerStatMorale"] and YE::BATTLE::DISPLAY::GAUGE_MORALE
- dy -= YE::BATTLE::DISPLAY::STAT_FONT_SIZE
- end
- dw = 92
- #---
- move_mp_bar = false
- if $imported["CustomSkillEffects"]
- if YE::BATTLE::DISPLAY::RAGE_CLASSES.include?(@actor.class.id)
- move_mp_bar = true
- end
- if $imported["SubclassSelectionSystem"] and @actor.subclass != nil
- if YE::BATTLE::DISPLAY::RAGE_CLASSES.include?(@actor.subclass.id)
- move_mp_bar = true
- end
- end
- end
- if move_mp_bar and YE::BATTLE::DISPLAY::RAGE_DISPLAY == 1
- dw /= 2
- dx += dw
- draw_party_rage(index)
- elsif move_mp_bar and YE::BATTLE::DISPLAY::RAGE_DISPLAY == 1
- dw /= 2
- draw_party_rage(index)
- end
- #---
- draw_actor_mp_gauge(@actor, dx, dy, dw)
- self.contents.font.size = YE::BATTLE::DISPLAY::STAT_FONT_SIZE
- self.contents.font.color = system_color
- self.contents.draw_text(dx + 2, dy + 4, 28, WLH, Vocab::mp_a, 0)
- self.contents.font.color = mp_color(@actor)
- text = sprintf("%d/%d", @actor.mp, @actor.maxmp)
- unless @actor.maxmp == 0
- percent = @actor.mp * 100.0 / @actor.maxmp
- else
- percent = 0
- end
- case YE::BATTLE::DISPLAY::SHOWN_MP_TYPE
- when 1; text = @actor.mp
- when 2; text = sprintf("%d/%d", @actor.mp, @actor.maxmp)
- when 3; text = sprintf("%d%%", percent)
- when 4; text = sprintf("%d %d%%", @actor.mp, percent)
- when 5; text = sprintf("%d/%d %d%%", @actor.mp, @actor.maxmp, percent)
- end
- self.contents.draw_text(dx + 30, dy + 4, dw - 32, WLH, text, 2)
- end
- #--------------------------------------------------------------------------
- # Draw Party Rage
- #--------------------------------------------------------------------------
- def draw_party_rage(index)
- return unless $imported["CustomSkillEffects"]
- dx = 0
- dy = WLH * 3
- if $imported["BattlerStatMorale"] and YE::BATTLE::DISPLAY::GAUGE_MORALE
- dy -= YE::BATTLE::DISPLAY::STAT_FONT_SIZE
- end
- dw = 92 / 2
- if YE::BATTLE::DISPLAY::RAGE_DISPLAY == 1
- dx = index * 96 + 2
- elsif YE::BATTLE::DISPLAY::RAGE_DISPLAY == 2
- dx = index * 96 + 2 + dw
- end
- draw_rage_gauge(@actor, dx, dy, dw)
- self.contents.font.size = YE::BATTLE::DISPLAY::STAT_FONT_SIZE
- self.contents.font.color = system_color
- text = YE::BATTLE::DISPLAY::RAGE_TEXT
- self.contents.draw_text(dx + 2, dy + 4, 28, WLH, text, 0)
- self.contents.font.color = mp_color(@actor)
- text = @actor.rage
- self.contents.draw_text(dx + 30, dy + 4, dw - 32, WLH, text, 2)
- end
- #--------------------------------------------------------------------------
- # Draw Rage Gauge
- #--------------------------------------------------------------------------
- def draw_rage_gauge(actor, x, y, width = 120)
- return unless $imported["CustomSkillEffects"]
- gc0 = gauge_back_color
- gc1 = text_color(YE::BATTLE::DISPLAY::RAGE_GAUGE1)
- gc2 = text_color(YE::BATTLE::DISPLAY::RAGE_GAUGE2)
- gh = 6
- gy = y + WLH - 8 - (gh - 6)
- gb = width
- self.contents.fill_rect(x, gy, gb, gh, gc0)
- if actor.rage <= 0
- gw = 0
- else
- gw = gb * actor.rage / YE::BATTLE::MAX_RAGE
- end
- self.contents.gradient_fill_rect(x, gy, gw, gh, gc1, gc2)
- end
- #--------------------------------------------------------------------------
- # Draw Party Morale
- #--------------------------------------------------------------------------
- def draw_party_morale(index)
- return unless $imported["BattlerStatMorale"]
- draw_morale_icon(index)
- return unless YE::BATTLE::DISPLAY::GAUGE_MORALE
- dx = index * 96 + 2
- dy = WLH * 3
- dw = 92
- draw_morale_gauge(@actor, dx, dy, dw)
- self.contents.font.size = YE::BATTLE::DISPLAY::STAT_FONT_SIZE
- self.contents.font.color = system_color
- text = YE::BATTLE::DISPLAY::MORALE_TEXT
- self.contents.draw_text(dx + 2, dy + 4, 44, WLH, text, 0)
- self.contents.font.color = normal_color
- text = sprintf("%+d", @actor.morale)
- self.contents.draw_text(dx + 46, dy + 4, 44, WLH, text, 2)
- end
- #--------------------------------------------------------------------------
- # Draw Morale Gauge
- #--------------------------------------------------------------------------
- def draw_morale_gauge(actor, x, y, width = 120)
- return unless $imported["BattlerStatMorale"]
- gc0 = gauge_back_color
- gc1 = text_color(YE::BATTLE::DISPLAY::MORALE_GAUGE1)
- gc2 = text_color(YE::BATTLE::DISPLAY::MORALE_GAUGE2)
- gc3 = text_color(YE::BATTLE::DISPLAY::MORALE_GAUGE3)
- gc4 = text_color(YE::BATTLE::DISPLAY::MORALE_GAUGE4)
- gh = 6
- gy = y + WLH - 8 - (gh - 6)
- gb = width
- self.contents.fill_rect(x, gy, gb, gh, gc0)
- if actor.morale == 0
- gw = 0
- elsif actor.morale > 0
- gw = gb * actor.morale / actor.max_morale
- self.contents.gradient_fill_rect(x, gy, gw, gh, gc1, gc2)
- else
- gw = gb * actor.morale / actor.min_morale
- x += gb - gw
- self.contents.gradient_fill_rect(x, gy, gw, gh, gc3, gc4)
- end
- end
- #--------------------------------------------------------------------------
- # Draw Morale Icon
- #--------------------------------------------------------------------------
- def draw_morale_icon(index)
- return unless YE::BATTLE::DISPLAY::ICON_MORALE
- morale = @actor.morale / YE::BATTLE::DISPLAY::MORALE_DIVISOR
- return if morale == 0
- dx = index * 96 + 72
- dy = 0
- if morale > 0
- icon = YE::BATTLE::DISPLAY::ICON_MORALE_HIGH
- colour = YE::BATTLE::DISPLAY::MORALE_COL_HIGH
- else
- icon = YE::BATTLE::DISPLAY::ICON_MORALE_LOW
- colour = YE::BATTLE::DISPLAY::MORALE_COL_LOW
- end
- draw_icon(icon, dx, dy)
- self.contents.font.size = YE::BATTLE::DISPLAY::MORALE_FONT_SIZE
- self.contents.font.color = text_color(colour)
- text = sprintf("%+d%%", morale)
- self.contents.draw_text(dx + 2, dy + 2, 20, 20, text, 1)
- end
- end # end Window_BattleStatus
- #===============================================================================
- #
- # END OF FILE
- #
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement