# ╔══════════════════════════════════════════════════════╤═══════╤════════════╗
# ║ Final Fantasy Style Battle Log │ v2.05 │ (3/2/20) ║
# ╠══════════════════════════════════════════════════════╧═══════╧════════════╣
# ║ Author : Coolie ║
# ║ Thanks : KilloZapIt (Kayzee), Swish, Keith Brewer ║
# ║ E-Mail : cooliebk18@yahoo.com ║
# ║ Website : http://twitch.tv/CoolieBK18 ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ ABOUT ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ This script changes the behavior of the battle log window to act as the ║
# ║ Battle Log window in a Final Fantasy game would. ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ TERMS OF USE ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ ► Do not edit the script's header or comments. ║
# ║ ► Free to use in commercial projects as long as proper credit is given to ║
# ║ ALL the names individually in the above header. ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ FEATURES ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ ► Removes the black background behind the default Battle Log window. ║
# ║ ► Custom opacity for the Battle Log window. ║
# ║ ► Text alignment settings for the Battle Log window. ║
# ║ ► Automatically hide the Battle Log window when a skill has no message ║
# ║ text ║
# ║ ► Width and alignment settings for the Battle Log window. ║
# ║ ► Automatically adjust alignment when skill has no icon (icon ID 0) ║
# ║ ► Option to use different windowskin suffixes for skills used by actors ║
# ║ or enemies, respectively. ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ KNOWN ISSUES ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ ► This script is intended to be used alongside a Damage Popup script, ║
# ║ such as the ones made by Yanfly or Victor Sant. Using it by itself will ║
# ║ only take effect on skill and item names and messages, and all other ║
# ║ messages will not appear in the default way that VXA processes them. ║
# ║ ║
# ║ I wrote this script out of a personal need for it. It overwrites most ║
# ║ methods set in Window_BattleLog. If you have other scripts that also do ║
# ║ this, there will be incompatability between them. Alternately, if you ║
# ║ are using other scripts which alias Window_BattleLog methods, you may ║
# ║ want to place this script ABOVE those and hope for the best, lol. ║
# ║ ║
# ║ Enjoy! ║
# ║ ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ CHANGE LOG ║
# ╠═════════════════════════════════════════════════════════════════╤═════════╣
# ║ ■ March 2, 2020 : Cleaned up redundant code, fixed bug │ (v2.05) ║
# ║ where Battle Log still showed a blank │ ║
# ║ icon (icon ID 0) │ ║
# ╟─────────────────────────────────────────────────────────────────┼─────────╢
# ║ ■ May 3, 2015 : Suffixes for Windowskin settings │ (v2.04) ║
# ╟─────────────────────────────────────────────────────────────────┼─────────╢
# ║ ■ December 12, 2014 : Bugfixes (battle sounds playing again) │ (v2.03) ║
# ╟─────────────────────────────────────────────────────────────────┼─────────╢
# ║ ■ December 11, 2014 : Bugfixes (y offset text positioning) │ (v2.02) ║
# ╟─────────────────────────────────────────────────────────────────┼─────────╢
# ║ ■ December 11, 2014 : Bugfixes (blank window fix) │ (v2.01) ║
# ╟─────────────────────────────────────────────────────────────────┼─────────╢
# ║ ■ December 10, 2014 : Almost a full rewrite. Needless features │ (v2.00) ║
# ║ removed. Some new ones added. Skill and │ ║
# ║ Item icons displaying now. │ ║
# ╟─────────────────────────────────────────────────────────────────┼─────────╢
# ║ ■ October 31, 2014 : New option to use different windowskins │ (v1.04) ║
# ║ for actor and enemy attacks │ ║
# ╟─────────────────────────────────────────────────────────────────┼─────────╢
# ║ ■ August 15, 2013 : Bugfixes. │ (v1.03) ║
# ╟─────────────────────────────────────────────────────────────────┼─────────╢
# ║ ■ December 12, 2012 : Font options added. (then removed lul) │ (v1.02) ║
# ╟─────────────────────────────────────────────────────────────────┼─────────╢
# ║ ■ December 06, 2012 : Width and Window alignment options added. │ (v1.01) ║
# ║ Show Name option added. │ ║
# ╟─────────────────────────────────────────────────────────────────┼─────────╢
# ║ ■ December 05, 2012 : Initial release. │ (v1.00) ║
# ╠═════════════════════════════════════════════════════════════════╧═════════╣
# ║ NEXT VERSION ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ ■ TBA ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ OVERWRITTEN METHODS ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ This script overwrites several methods in Window_BattleLog. ║
# ╟───────────────────────────────────────────────────────────────────────────╢
# ║ ■ class Window_BattleLog < Window_Selectable ║
# ║ ► def initialize ║
# ║ ► def window_width ║
# ║ ► def max_line_number ║
# ║ ► def create_back_bitmap ║
# ║ ► def create_back_sprite ║
# ║ ► def dispose_back_bitmap ║
# ║ ► def dispose_back_sprite ║
# ║ ► def last_text ║
# ║ ► def draw_background ║
# ║ ► def back_color ║
# ║ ► def clear ║
# ║ ► def display_affected_status ║
# ║ ► def display_critical ║
# ║ ► def display_miss ║
# ║ ► def display_failure ║
# ║ ► def display_counterattack ║
# ║ ► def display_reflection ║
# ║ ► def display_substitute ║
# ║ ► def display_hp_damage ║
# ║ ► def display_mp_damage ║
# ║ ► def display_tp_damage ║
# ║► def display_use_item ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ NEW METHODS ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ There are several new methods added to Window_BattleLog. ║
# ╟───────────────────────────────────────────────────────────────────────────╢
# ║ ■ class Window_BattleLog < Window_Selectable ║
# ║ ► def window_left_position ║
# ║ ► def window_center_position ║
# ║ ► def window_right_position ║
# ║ ► def y_offset ║
# ║ ► def item_name_width(item) ║
# ║ ► def skill_name_width(item) ║
# ║ ► def draw_skill_name(item, x, y, enabled, width) ║
# ║ ► def draw_items_name(item, x, y, enabled, width) ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ INSTRUCTIONS ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ Simply paste this script anywhere above the Main Process script and below ║
# ║ the "Materials" section. ║
# ║ ║
# ║ NOTE: When setting the "use" message in the database for a skill, it is ║
# ║ important to remember that the Actor name or Enemy name is OMITTED. ║
# ║ It's usually a good idea just to input the skill's name in the ║
# ║ "use" message dialogue box. The skill/item icon is shown with the ║
# ║ skill/item name. This is what will determine the text displayed ║
# ║ You can name the skill in the database whatever you want, and the ║
# ║ script will display the icon and whatever is in the message box. ║
# ║ ║
# ║ Example: Just input "Fire" instead of "casts Fire!" ║
# ║ ║
# ║ NOTE: You can also show a custom message, by using the second message box ║
# ║ in the database for skills. Simply write whatever you want in that ║
# ║ box, and the skill/item icon will not be shown. Your new custom ║
# ║ message will display instead. ║
# ║ ║
# ║ Example: "Precious light, be our armor to protect us! Protect!" ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ IMPORT SETTING ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
$imported = {} if $imported.nil? # Do not edit
$imported["WC-FFStyleBattleLog_2.00"] = true # Do not edit
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ CUSTOMIZATION MODULE ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
module COOLIE
module LOG
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Set window width (in pixels) ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
WINDOW_WIDTH = 640
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Set window Y offset (in pixels; can be negative) ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
WINDOW_Y_OFFSET = 0
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Set window alignment (0 = Left, 1 = Center, 2 = Right) ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
WINDOW_ALIGN = 1
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Set name usage (true/false = show/do not show actor names) ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
USE_NAME = true
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Set windowskin opacity (0-255) ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
WSKIN_OPACITY = 255
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Set windowskin back opacity (0-255) ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
WSKIN_BACK_OPACITY = 255
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Set windowskin suffix used for actor skills/items ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
WSKIN_ACTOR = "" # Leave as "" to use default skin
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Set windowskin suffix used for enemy skills/items ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
WSKIN_ENEMY = "_Enemy" # Leave as "" to use default skin
end # module LOG
end # module COOLIE
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ WINDOW_BASE ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
class Window_Base
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Object Initialization ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
alias wc_battlelog_initialize initialize
def initialize(*args, &block)
wc_battlelog_initialize(*args, &block)
self.windowskin = Cache.system($game_system.windowskin)
@wskin = $game_system.windowskin
end
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ WINDOW_BATTLELOG ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
class Window_BattleLog < Window_Selectable
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Object Initialization ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def initialize
case COOLIE::LOG::WINDOW_ALIGN
when 0 # Left Aligned
super(window_left_position, y_offset, window_width, window_height)
when 1 # Center Aligned
super(window_center_position, y_offset, window_width, window_height)
when 2 # Right Aligned
super(window_right_position, y_offset, window_width, window_height)
end
self.z -= 10
self.opacity = 0
@lines = []
@num_wait = 0
create_back_bitmap
create_back_sprite
refresh
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Get Window Width ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def window_width
COOLIE::LOG::WINDOW_WIDTH
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Get Window Y Offset ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def y_offset
return COOLIE::LOG::WINDOW_Y_OFFSET
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Get Maximum Number of Lines ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def max_line_number
return 1
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Create Background Bitmap ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def create_back_bitmap
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Create Background Sprite ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def create_back_sprite
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Free Background Bitmap ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def dispose_back_bitmap
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Free Background Sprite ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def dispose_back_sprite
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Last Text ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def last_text
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Draw_Background ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def draw_background
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Get Background Color ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def back_color
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Clear ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def clear
@num_wait = 0
@lines.clear
self.opacity = 0
self.back_opacity = 0
refresh
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Affected Status ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_affected_status(target, item)
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Counterattack ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_counter(target, item)
Sound.play_evasion
clear
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Reflection ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_reflection(target, item)
Sound.play_reflection
clear
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Substitute ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_substitute(substitute, target)
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Action Results ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_action_results(target, item)
if target.result.used
display_damage(target, item)
end
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Failure ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_failure(target, item)
if target.result.hit? && !target.result.success
end
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Critical Hit ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_critical(target, item)
if target.result.critical
end
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Miss ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_miss(target, item)
if !item || item.physical?
Sound.play_miss
end
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Evasion ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_evasion(target, item)
if !item || item.physical?
Sound.play_evasion
else
Sound.play_magic_evasion
end
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display HP Damage ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_hp_damage(target, item)
return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
if target.result.hp_damage > 0 && target.result.hp_drain == 0
target.perform_damage_effect
end
Sound.play_recovery if target.result.hp_damage < 0
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display MP Damage ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_mp_damage(target, item)
return if target.dead? || target.result.mp_damage == 0
Sound.play_recovery if target.result.mp_damage < 0
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display TP Damage ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_tp_damage(target, item)
return if target.dead? || target.result.tp_damage == 0
Sound.play_recovery if target.result.tp_damage < 0
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Get Window Left Position [NEW METHOD] ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def window_left_position
return 0
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Get Window Center Position [NEW METHOD] ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def window_center_position
return Graphics.width / 2 - window_width / 2
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Get Window Right Position [NEW METHOD] ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def window_right_position
return Graphics.width - window_width
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Draw Skill Name [NEW METHOD] ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def draw_skill_name(item, x, y, enabled = true, width = 172)
return unless item
change_color(normal_color, enabled)
if item.icon_index == 0
draw_text(x, 0, width, line_height, item.message1)
else
draw_icon(item.icon_index, x, 0, enabled)
draw_text(x + 24, 0, width, line_height, item.message1)
end
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Draw Item Name [NEW METHOD] ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def draw_items_name(item, x, y, enabled = true, width = 172)
return unless item
change_color(normal_color, enabled)
if item.icon_index == 0
draw_text(x, 0, width, line_height, item.name)
else
draw_icon(item.icon_index, x, 0, enabled)
draw_text(x + 24, 0, width, line_height, item.name)
end
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Skill Name Width [NEW METHOD] ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def skill_name_width(item)
size = text_size(item.message1).width
size += 24 if item.icon_index <= 0
return size
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Item Name Width [NEW METHOD] ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def item_name_width(item)
size = text_size(item.name).width
size += 24 if item.icon_index <= 0
return size
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Skill/Item Use ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_use_item(subject, item)
# Do not show message if skill message1 has no text
if item.is_a?(RPG::Skill) && item.message1.empty?
return
end # if item.is_a?
# Set windowskin based on user (actor or enemy)
if subject.is_a?(Game_Enemy)
self.windowskin = Cache.system($game_system.windowskin + COOLIE::LOG::WSKIN_ENEMY.to_s)
else
self.windowskin = Cache.system($game_system.windowskin + COOLIE::LOG::WSKIN_ACTOR.to_s)
end
self.opacity = COOLIE::LOG::WSKIN_OPACITY
self.back_opacity = COOLIE::LOG::WSKIN_BACK_OPACITY
# Handle display of Window, Opacity, Icons and Text
if item.is_a?(RPG::Skill) && !item.message1.empty? # For Skills
ix = (window_width / 2) - (skill_name_width(item) / 2)
if item.icon_index > 0
ix -= 36
else
ix = ix
end
draw_skill_name(item, ix, y, enabled = true)
elsif item.is_a?(RPG::Item) # For items
ix = (window_width / 2) - (item_name_width(item) / 2)
if item.icon_index > 0
ix -= 36
else
ix = ix
end
draw_items_name(item, ix, y, enabled = true)
else # Failsafe
draw_text(0, 0, window_width - 24, line_height, item.name, 1)
wait
end
reset_font_settings
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ End of Script ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
end