Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # // Face Frames - YEA Ace Battle Engine Addon
- # Author: Rikifive
- # Engine: RPG Maker VX Ace
- # Version: 1.0 (2020-10-03)
- #
- # /!\ Required Scripts (2)
- # Yanfly | Yanfly Engine Ace - Ace Battle Engine v1.22
- # Rikifive | Face Frames v1.1
- #
- #===============================================================================
- # DESCRIPTION
- #===============================================================================
- # This is an ADDON to YEA Ace Battle Engine.
- # Adds Face Frames to Actor Statuses in the Battle Screen.
- # + Allows some additional customization in Actor Statuses there.
- #
- #===============================================================================
- # INSTRUCTIONS
- #===============================================================================
- # ► SCRIPT DIFFICULTY: ★☆☆☆☆
- # This script is basically Plug & Play, but some minor configuration might
- # be required.
- #
- # -=> Place script(s) below ▼ Materials; above ▼ Main Process
- #
- # Customize offsets and display in the configuration.
- #
- # i) Due to the nature of varying status widths, only frames drawn from
- # windowskin are supported. "frame" images are not supported.
- #
- #===============================================================================
- # TERMS OF USE
- #===============================================================================
- # > You ARE allowed to use this script in non-commercial projects.
- # > You ARE allowed to use this script in commercial projects.
- # It's just a little script, so let's not paniK lmao
- # If you'd like to support my works nevertheless, donating any amount
- # would be greatly appreciated. Thank you. c:
- # ( https://paypal.me/rikifive )
- # > You ARE allowed to edit this script to your needs.
- # > You ARE NOT allowed to repost or post modified versions of this script
- # without my permission.
- # > You ARE DEFINITELY NOT allowed to claim this script as your own lmao
- #
- # How to credit me: Just include my name "Rikifive" somewhere in the credits.
- #
- # Good luck!
- #
- #===============================================================================
- # VERSION HISTORY
- #===============================================================================
- # YYYY-MM-DD | Ver
- #------------------
- # 03-10-2020 | 1.0 - Initial Release
- #
- #===============================================================================
- # COMPATIBILITY INFORMATION
- #===============================================================================
- # Overwritten Methods (2)
- # Window_BattleStatus - item_rect
- # Window_BattleStatus - draw_face
- #
- # Aliased Methods (5)
- # Window_BattleStatus - draw_actor_name
- # Window_BattleStatus - draw_actor_action
- # Window_BattleStatus - draw_actor_hp
- # Window_BattleStatus - draw_actor_mp
- # Window_BattleStatus - draw_actor_tp
- #
- #===============================================================================
- #===============================================================================
- # CONFIGURATION
- #===============================================================================
- module RK5_FRAMES
- # PIXELS to cut out from each side of the face, so that it doesn't leak
- # through the frame
- # Preferably put the window frame's thickness. (default windowskin has 6 px)
- YEA_BATTLE_FACE_OFFSET = 6 # pixels from each side
- # Normally actor status (hp bar etc.) are drawn across the whole face,
- # but since you intend to draw a frame around the face, you may want
- # to set the offset, so that the bars aren't drawn on the frame.
- # Preferably use the same amount as in the setting above
- YEA_BATTLE_OFFSET = 6 # pixels from each side
- # Same as above, but a separate offset for [Action Icon] and [Character Name]
- YEA_BATTLE_OFFSET_TOP = 0
- # By default, [Action Icon] and [Character Name] are drawn on top of the face,
- # if you'd wish to display these ABOVE the face, put "true".
- # Keep in mind it will lower the height of the face.
- #-------------------------------------.
- # false: true: |
- #-------------------------------------.
- # .----------. [O]Name |
- # |[O]Name | .----------. |
- # | | | | |
- # |HP_____100| |HP_____100| |
- # |MP__ 14| |MP__ 14| |
- # '----------' '----------' |
- #-------------------------------------'
- YEA_BATTLE_TOP_OUTSIDE = false
- # By default, actor statuses' width depend on the maximum amount of battle
- # members (Game_Party\max_battle_members).
- # For example, if up to 4 battle members can battle, each actor's status'
- # width, regardless of current party size, will equal to:
- # [ BATTLE STATUS'S WIDTH / 4 ], to reserve space for the other actors.
- # However, if only 1 member is allowed to battle at one time, his status
- # will be drawn across the whole window, resulting in insanely long
- # hp/mp/tp bars with a funny looking face in the center.
- # If you'll find yourself in such situation, you may want to CAP the width
- # of each actor's status, so that they don't go beyond the specified value.
- # For example, to CAP the status width, so that the face always covers
- # the whole face frame (status not bigger than face), follow this calculation:
- # + 96 pixels for face
- # + 4 pixels for cursor (the outline of the active actor)
- # + window frame's thickness in pixels (like with YEA_BATTLE_FACE_OFFSET)
- YEA_BATTLE_WIDTH_CAP = 106
- end
- #===============================================================================
- # END OF CONFIGURATION
- #===============================================================================
- class Window_BattleStatus < Window_Selectable
- #--------------------------------------------------------------------------
- # ::: OVERWRITE METHOD
- #--------------------------------------------------------------------------
- def item_rect(index)
- rect = Rect.new
- rect.width = [contents.width / $game_party.max_battle_members,RK5_FRAMES::YEA_BATTLE_WIDTH_CAP].min
- rect.height = contents.height
- rect.x = index * rect.width
- if YEA::BATTLE::BATTLESTATUS_CENTER_FACES
- rect.x += (contents.width - $game_party.members.size * rect.width) / 2
- end
- rect.y = 0
- return rect
- end
- #--------------------------------------------------------------------------
- # ::: OVERWRITE METHOD
- #--------------------------------------------------------------------------
- def draw_face(face_name, face_index, dx, dy, enabled = true)
- fo = RK5_FRAMES::YEA_BATTLE_FACE_OFFSET
- to = RK5_FRAMES::YEA_BATTLE_TOP_OUTSIDE ? 20 : 0
- iw = item_rect(0).width - 4
- ih = item_rect(0).height - 4
- fx = (face_index % 4 * 96) + ([96-iw+fo*2,0].max / 2)
- fy = (face_index / 4 * 96) + ([96-ih+fo*2,0].max / 2)
- fw = 96 - [96-iw+fo*2,0].max
- fh = 96 - [96-ih+fo*2,0].max
- bitmap = Cache.face(face_name)
- rect = Rect.new(fx, fy+to, fw, fh-to)
- contents.blt(dx+fo+[(iw/2-48-fo).floor,0].max, dy+fo+[(ih/2-48.floor),0].max+to, bitmap, rect, enabled ? 255 : translucent_alpha)
- bitmap.dispose
- draw_window_frame(dx, dy+to, iw, ih-to)
- end
- #--------------------------------------------------------------------------
- # *** ALIAS METHOD
- #--------------------------------------------------------------------------
- alias :draw_actor_name_w :draw_actor_name
- def draw_actor_name(actor, dx, dy, dw = 112)
- o = RK5_FRAMES::YEA_BATTLE_OFFSET_TOP
- draw_actor_name_w(actor, dx+o, dy+o, [dw-o*2,RK5_FRAMES::YEA_BATTLE_WIDTH_CAP].min)
- end
- #--------------------------------------------------------------------------
- # *** ALIAS METHOD
- #--------------------------------------------------------------------------
- alias :draw_actor_action_w :draw_actor_action
- def draw_actor_action(actor, dx, dy)
- o = RK5_FRAMES::YEA_BATTLE_OFFSET_TOP
- draw_actor_action_w(actor, dx+o, dy+o)
- end
- #--------------------------------------------------------------------------
- # *** ALIAS METHOD
- #--------------------------------------------------------------------------
- alias :draw_actor_hp_w :draw_actor_hp
- def draw_actor_hp(actor, dx, dy, width = 124)
- o = RK5_FRAMES::YEA_BATTLE_OFFSET
- draw_actor_hp_w(actor, dx+o, dy-o, width-o*2)
- end
- #--------------------------------------------------------------------------
- # *** ALIAS METHOD
- #--------------------------------------------------------------------------
- alias :draw_actor_mp_w :draw_actor_mp
- def draw_actor_mp(actor, dx, dy, width = 124)
- o = RK5_FRAMES::YEA_BATTLE_OFFSET
- draw_actor_mp_w(actor, dx+o, dy-o, width-o*2)
- end
- #--------------------------------------------------------------------------
- # *** ALIAS METHOD
- #--------------------------------------------------------------------------
- alias :draw_actor_tp_w :draw_actor_tp
- def draw_actor_tp(actor, dx, dy, width = 124)
- o = RK5_FRAMES::YEA_BATTLE_OFFSET
- draw_actor_tp_w(actor, dx+o, dy-o, width-o*2)
- end
- end
Add Comment
Please, Sign In to add comment