- 累计送礼:
- 0 个
- 累计收礼:
- 1 个
TA的每日心情 | 开心 2026-7-12 04:10 |
|---|
签到天数: 209 天 连续签到: 2 天 [LV.7]常住居民III

管理员
  
- VIP
- 7
- 卡币
- 58883
- OK点
- 16
- 推广点
- 0
- 同能卷
- 50
- 积分
- 68848


|
This script makes the messages in the battle log scroll upwards instead of the default show and pop.
It's plug and play with additional settings and free to use for both non-commercial and commercial games, but please give credit to me if you do
Spoiler: Script v1.4 Code: - #==============================================================================
- # Scrolling Battle Log v1.4
- # by R_Valkyrie
- #------------------------------------------------------------------------------
- # Plug-n-Play.
- # Free to use for non-commercial and commercial, just give credit to me.
- #==============================================================================
- #------------------------------------------------------------------------------
- # Settings
- #------------------------------------------------------------------------------
- module SCROLLING_BATTLE_LOG
- LOG_X = 0
-
- LOG_Y = 0
-
- LOG_WIDTH = 544
-
- LOG_HEIGHT = 6 #How many lines the log will show during battle
- #and also the fitting height for the window.
-
- LOG_OPACITY = 60 #Opacity for the backlines.
-
- LOG_SPEED = 60 #How long the log will wait between every message.
-
- SCROLL_SPEED = 3 #How fast the log will scroll. Set to 0 for instant scroll.
-
- TEXT_FONT = "" #Type the font name within the "" if you want to use
- #a different font for your log or leave it blank if not.
-
- TEXT_SIZE = 0 #Type the size of the font. Set to 0 for default font size.
-
- TEXT_ALIGNMENT = 0 #Alignment for the displayed text.
- # 0 = right, 1 = center, 2 = left.
-
- TEXT_BOLD = false #Set to true if you want a bold font.
-
- USE_WINDOW = false #Set to true if you want to show a window
- #instead of the lines.
- end
- #------------------------------------------------------------------------------
- # Don't edit anything below this line unless you know what you're doing.
- #------------------------------------------------------------------------------
- class Window_BattleLog < Window_Selectable
- include SCROLLING_BATTLE_LOG
- def initialize
- super(LOG_X, LOG_Y, LOG_WIDTH, window_height)
- self.z = 200
- self.opacity = 0
- self.arrows_visible = false
- self.contents.font.name = TEXT_FONT unless TEXT_FONT == ""
- self.contents.font.size = TEXT_SIZE unless TEXT_SIZE == 0
- self.contents.font.bold = TEXT_BOLD
- @lines = []
- @num_wait = 0
- create_back_bitmap
- create_back_sprite
- refresh
- end
- def max_line_number
- return 500
- end
- def line_height
- lh = (TEXT_SIZE == 0 ? Font.default_size : TEXT_SIZE) + 2
- return lh
- end
- def clear
- self.oy = 0
- @lines.clear
- refresh
- end
- def back_one
- #
- end
- def add_text(text)
- if @lines.size > (LOG_HEIGHT - 1)
- distance = line_height
- speed = SCROLL_SPEED == 0 ? line_height : SCROLL_SPEED
- until distance == 0 do
- self.oy += distance < speed ? distance : speed
- distance -= distance < speed ? distance : speed
- Graphics.update
- end
- end
- @lines.push(text)
- refresh
- end
- def refresh
- draw_background if @lines.size < (LOG_HEIGHT + 1)
- contents.clear
- @lines.size.times {|i| draw_line(i) }
- end
- def back_opacity
- USE_WINDOW ? 0 : LOG_OPACITY
- end
- def draw_line(line_number)
- rect = item_rect_for_text(line_number)
- contents.clear_rect(rect)
- text_width = LOG_WIDTH - (standard_padding * 2)
- ta = TEXT_ALIGNMENT
- wx = ta == 2 ? -2 : rect.x
- draw_text(wx, rect.y, text_width, line_height, @lines[line_number], ta)
- end
- def message_speed
- return LOG_SPEED
- end
- def wait_and_clear
- #
- end
- def display_current_state(subject)
- unless subject.most_important_state_text.empty?
- add_text(subject.name + subject.most_important_state_text)
- wait
- end
- end
- def display_action_results(target, item)
- if target.result.used
- display_critical(target, item)
- display_damage(target, item)
- display_affected_status(target, item)
- display_failure(target, item)
- end
- end
- def display_affected_status(target, item)
- if target.result.status_affected?
- display_changed_states(target)
- display_changed_buffs(target)
- end
- end
- def display_auto_affected_status(target)
- if target.result.status_affected?
- display_affected_status(target, nil)
- end
- end
- def display_added_states(target)
- target.result.added_state_objects.each do |state|
- state_msg = target.actor? ? state.message1 : state.message2
- target.perform_collapse_effect if state.id == target.death_state_id
- next if state_msg.empty?
- add_text(target.name + state_msg)
- wait
- wait_for_effect
- end
- end
- def display_removed_states(target)
- target.result.removed_state_objects.each do |state|
- next if state.message4.empty?
- add_text(target.name + state.message4)
- wait
- end
- end
- def display_buffs(target, buffs, fmt)
- buffs.each do |param_id|
- add_text(sprintf(fmt, target.name, Vocab::param(param_id)))
- wait
- end
- end
- end
- class Window_DummyLog < Window_BattleLog
- def max_line_number
- return LOG_HEIGHT
- end
- def add_text(text)
- #
- end
- end
- class Scene_Battle < Scene_Base
- include SCROLLING_BATTLE_LOG
- alias update_message_open_and_clear_log update_message_open
- def update_message_open
- if $game_message.busy?
- @log_window.clear
- @log_window.close
- @dummy_window.close
- end
- update_message_open_and_clear_log
- end
- alias create_all_windows_with_dummy create_all_windows
- def create_all_windows
- create_dummy_window
- create_all_windows_with_dummy
- end
- def create_dummy_window
- @dummy_window = Window_DummyLog.new
- @dummy_window.z = 199
- @dummy_window.openness = 0
- @dummy_window.opacity = 255
- end
- alias turn_start_with_dummy turn_start
- def turn_start
- @log_window.open
- @dummy_window.open if USE_WINDOW == true
- turn_start_with_dummy
- end
- def turn_end
- all_battle_members.each do |battler|
- battler.on_turn_end
- refresh_status
- @log_window.display_auto_affected_status(battler)
- end
- @log_window.clear
- @dummy_window.close
- BattleManager.turn_end
- process_event
- start_party_command_selection
- end
- def process_action
- return if scene_changing?
- if !@subject || !@subject.current_action
- @subject = BattleManager.next_subject
- end
- return turn_end unless @subject
- if @subject.current_action
- @subject.current_action.prepare
- if @subject.current_action.valid?
- @status_window.open
- @log_window.open
- @dummy_window.open if USE_WINDOW == true
- execute_action
- end
- @subject.remove_current_action
- end
- process_action_end unless @subject.current_action
- end
- end
复制代码
本贴来自国际rpgmaker官方论坛作者:R_Valkyrie处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址: https://forums.rpgmakerweb.com/threads/scrolling-battle-log.93999/ |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|