Project1
标题: 显示多个状态图标 [打印本页]
作者: fjm 时间: 2017-4-1 14:56
标题: 显示多个状态图标
本帖最后由 fjm 于 2017-4-1 18:55 编辑
默认的是两个,如何多显示几个,比如4个
class Scene_Battle < Scene_Base
def start
super
create_spriteset
create_all_windows
BattleManager.method_wait_for_message = method(:wait_for_message)
@icon_rotate = 0
end
def update_basic
super
$game_timer.update
$game_troop.update
@spriteset.update
update_info_viewport
update_message_open
@icon_rotate += 1
if @icon_rotate > 120
$game_party.alive_members.each{|i| i.sort_states}
@status_window.refresh
@icon_rotate = 0
end
end
def update_info_viewport
move_info_viewport(0) if @party_command_window.active
move_info_viewport(0) if @actor_command_window.active
move_info_viewport(0) if BattleManager.in_turn?
end
def create_party_command_window
@party_command_window = Window_PartyCommand.new
@party_command_window.y = @info_viewport.rect.y - @party_command_window.height
@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_status_window
@status_window = Window_BattleStatus.new
end
def create_actor_command_window
@actor_command_window = Window_ActorCommand.new
@actor_command_window.y = @info_viewport.rect.y - @actor_command_window.height
#@actor_command_window.x = Graphics.width - @actor_command_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
end
class Window_BattleEnemy < Window_Selectable
def initialize(info_viewport)
super(0, info_viewport.rect.y, window_width, fitting_height(6))
refresh
self.visible = false
@info_viewport = info_viewport
end
def window_width
Graphics.width
end
end
class Window_PartyCommand < Window_Command
def window_width
return 100
end
def visible_line_number
return 3
end
def alignment
return 1
end
end
class Window_BattleStatus < Window_Selectable
def window_width
Graphics.width
end
def col_max
return 2
end
def draw_actor_icons(actor, x, y, width = 96)
icons = (actor.state_icons + actor.buff_icons)[0, width / 24]
icons.each_with_index {|n, i| draw_icon(n, x + 24 * i, y) }
end
def draw_basic_area(rect, actor)
draw_actor_name(actor, rect.x - 7, rect.y, 100)
draw_actor_icons(actor, rect.x + 59 , rect.y, 24)
end
def spacing
return 4
end
def draw_actor_hp(actor, x, y, width = 124)
draw_gauge(x+60, y, width-15, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
change_color(system_color)
draw_text(x+55, y, 30, line_height, Vocab::hp_a)
draw_current_and_max_values(x+45, y, width, actor.hp, actor.mhp,
hp_color(actor), normal_color)
end
def draw_actor_mp(actor, x, y, width = 124)
draw_gauge(x+42, y, width-15, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
change_color(system_color)
draw_text(x+38, y, 30, line_height, Vocab::mp_a)
draw_current_and_max_values(x+25, y, width, actor.mp, actor.mmp,
mp_color(actor), normal_color)
end
def draw_actor_tp(actor, x, y, width = 124)
draw_gauge(x+25, y, width-20, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
change_color(system_color)
draw_text(x+20, y, 30, line_height, Vocab::tp_a)
change_color(tp_color(actor))
draw_text(x + width - 37, y, 42, line_height, actor.tp.to_i, 2)
end
end
class Scene_Battle < Scene_Base
def start
super
create_spriteset
create_all_windows
BattleManager.method_wait_for_message = method(:wait_for_message)
@icon_rotate = 0
end
def update_basic
super
$game_timer.update
$game_troop.update
@spriteset.update
update_info_viewport
update_message_open
@icon_rotate += 1
if @icon_rotate > 120
$game_party.alive_members.each{|i| i.sort_states}
@status_window.refresh
@icon_rotate = 0
end
end
def update_info_viewport
move_info_viewport(0) if @party_command_window.active
move_info_viewport(0) if @actor_command_window.active
move_info_viewport(0) if BattleManager.in_turn?
end
def create_party_command_window
@party_command_window = Window_PartyCommand.new
@party_command_window.y = @info_viewport.rect.y - @party_command_window.height
@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_status_window
@status_window = Window_BattleStatus.new
end
def create_actor_command_window
@actor_command_window = Window_ActorCommand.new
@actor_command_window.y = @info_viewport.rect.y - @actor_command_window.height
#@actor_command_window.x = Graphics.width - @actor_command_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
end
class Window_BattleEnemy < Window_Selectable
def initialize(info_viewport)
super(0, info_viewport.rect.y, window_width, fitting_height(6))
refresh
self.visible = false
@info_viewport = info_viewport
end
def window_width
Graphics.width
end
end
class Window_PartyCommand < Window_Command
def window_width
return 100
end
def visible_line_number
return 3
end
def alignment
return 1
end
end
class Window_BattleStatus < Window_Selectable
def window_width
Graphics.width
end
def col_max
return 2
end
def draw_actor_icons(actor, x, y, width = 96)
icons = (actor.state_icons + actor.buff_icons)[0, width / 24]
icons.each_with_index {|n, i| draw_icon(n, x + 24 * i, y) }
end
def draw_basic_area(rect, actor)
draw_actor_name(actor, rect.x - 7, rect.y, 100)
draw_actor_icons(actor, rect.x + 59 , rect.y, 24)
end
def spacing
return 4
end
def draw_actor_hp(actor, x, y, width = 124)
draw_gauge(x+60, y, width-15, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
change_color(system_color)
draw_text(x+55, y, 30, line_height, Vocab::hp_a)
draw_current_and_max_values(x+45, y, width, actor.hp, actor.mhp,
hp_color(actor), normal_color)
end
def draw_actor_mp(actor, x, y, width = 124)
draw_gauge(x+42, y, width-15, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
change_color(system_color)
draw_text(x+38, y, 30, line_height, Vocab::mp_a)
draw_current_and_max_values(x+25, y, width, actor.mp, actor.mmp,
mp_color(actor), normal_color)
end
def draw_actor_tp(actor, x, y, width = 124)
draw_gauge(x+25, y, width-20, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
change_color(system_color)
draw_text(x+20, y, 30, line_height, Vocab::tp_a)
change_color(tp_color(actor))
draw_text(x + width - 37, y, 42, line_height, actor.tp.to_i, 2)
end
end
-
9999.jpg
(41.96 KB, 下载次数: 26)
作者: 魔法丶小肉包 时间: 2017-4-1 19:21
本帖最后由 魔法丶小肉包 于 2017-4-1 19:26 编辑
由于楼主给的脚本不是默认系统,给的截图却是默认系统的,所以都改了
根据默认系统脚本修改
class Window_BattleStatus < Window_Selectable
def draw_basic_area(rect, actor)
draw_actor_name(actor, rect.x + 0, rect.y, 100)
draw_actor_icons(actor, rect.x + 70, rect.y, rect.width)
end
end
class Window_BattleStatus < Window_Selectable
def draw_basic_area(rect, actor)
draw_actor_name(actor, rect.x + 0, rect.y, 100)
draw_actor_icons(actor, rect.x + 70, rect.y, rect.width)
end
end
使用了楼主给的脚本之后修改
class Window_BattleStatus < Window_Selectable
def draw_basic_area(rect, actor)
draw_actor_name(actor, rect.x - 7, rect.y, 100)
draw_actor_icons(actor, rect.x + 59 , rect.y, 24*4)
end
end
class Window_BattleStatus < Window_Selectable
def draw_basic_area(rect, actor)
draw_actor_name(actor, rect.x - 7, rect.y, 100)
draw_actor_icons(actor, rect.x + 59 , rect.y, 24*4)
end
end
作者: fjm 时间: 2017-4-1 20:22
太感谢了,非常好用
作者: vodgabongd 时间: 2021-2-25 12:31
正在找类似的功能,MV有办法在战斗时显示多个状态吗?
欢迎光临 Project1 (https://rpg.blue/) |
Powered by Discuz! X3.1 |