#============================================================================== # 图标显示状态 v1.1 # By 叶子 # 9-30-2007 v1.1 # 修正了描绘状态的一个致命BUG # 12-31-2005 v1.0 # 重定义类:Window_Base, Window_Help #============================================================================== # 脚本功能: # 实现战斗中和菜单中用图标显示状态,代替原来的文字显示。 # 默认最多同时显示5个状态 108行定义,已改为8 #------------------------------------------------------------------------------ # 设置方法: # 一个状态对应的图标文件名为“状态的动画ID” # 例如某状态的动画ID为50,那么它的图标就是“Icons\50.png”或“Icons\50.jpg” # 如果找不到对应的文件,会报错 ◎_◎ #============================================================================== # 注意,在ICON_STATE_IDS中写上需要带图标的状态ID # ICON_STATE_IDS是一个数组,数组的方法请参考帮助文件 # 例如: # 只要1,5,8号状态带图标,就这样:ICON_STATE_IDS = [1,5,8] # 要20到50号状态带图标:ICON_STATE_IDS = 20..50 ICON_STATE_IDS = 1..400 #============================================================================== # ■ Window_Base #------------------------------------------------------------------------------ # 游戏中全部窗口的超级类。 #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ● 描绘状态 # actor : 角色 # x : 描画目标 X 坐标 # y : 描画目标 Y 坐标 # width : 描画目标的宽 #-------------------------------------------------------------------------- def draw_actor_state(actor, x, y, width = 120) #玄 text = make_battler_state_text(actor, width, true) text.gsub!(/\[/) { "" } text.gsub!(/\]/) { "" } s = text.split("/") sp = 0 s.each do |i| bitmap = RPG::Cache.icon("#{i}") cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x + sp, y, bitmap, src_rect) sp += cw + 10 end end end class Window_Base < Window #-------------------------------------------------------------------------- # ● 描绘状态 # actor : 角色 # x : 描画目标 X 坐标 # y : 描画目标 Y 坐标 # width : 描画目标的宽 #-------------------------------------------------------------------------- def draw_actor_state(actor, x, y, width = 240) state_size = 0 # buff_idx = 0 #debuff_idx = 0 for state in actor.states # 图标数量超出宽度就中断循环 if state_size >= 24 break end # 此状态不带图标就跳过 if !ICON_STATE_IDS.include?(state) next end bitmap = RPG::Cache.icon($data_states[state].animation_id.to_s) if actor.states_turn[state] >= $data_states[state].hold_turn/2 opacity = 255 else opacity = 100 end # 这里的图标大小默认是24x24,要改就改下面那个Rect.new(0, 0, 24, 24) # if $data_states[state].name.include?"☆" # if debuff_idx <= 5 # self.contents.blt(x + 24 * debuff_idx, y + 56, bitmap, Rect.new(0, 0, 24, 24), opacity) # else # self.contents.blt(x + 24 * (debuff_idx-5), y +88, bitmap, Rect.new(0, 0, 24, 24), opacity) #end #debuff_idx += 1 #else # if buff_idx <= 5 # self.contents.blt(x + 24 * buff_idx, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) #else #self.contents.blt(x + 24 * (buff_idx-5), y + 30, bitmap, Rect.new(0, 0, 24, 24), opacity) #end #buff_idx += 1 #end if state_size <= 5 self.contents.blt(x+24 * state_size, y+4, bitmap, Rect.new(0, 0, 24, 24), opacity) else self.contents.blt(x+24 * (state_size-5), y+4+30, bitmap, Rect.new(0, 0, 24, 24), opacity) end state_size += 1 end end end #============================================================================== # ■ Window_Help #------------------------------------------------------------------------------ # 特技及物品的说明、角色的状态显示的窗口。 #============================================================================== class Window_Help < Window_Base #-------------------------------------------------------------------------- # ● 设置敌人 # enemy : 要显示名字和状态的敌人 #-------------------------------------------------------------------------- def set_enemy(enemy) @text = "" # 描绘敌人名字 set_text(enemy.name, 1) # 描绘状态图标 state_size = 0 for state in enemy.states # 图标数量超出宽度就中断循环 if state_size >= 10 break end #此状态不带图标就跳过 # if !ICON_STATE_IDS.include?(state) # next #end #bitmap = RPG::Cache.icon($data_states[state].animation_id.to_s) #if enemy.states_turn[state] >= $data_states[state].hold_turn/2 # opacity = 255 #else # opacity = 100 #end #self.contents.blt(108+24 * state_size,0, bitmap, Rect.new(0, 0, 24, 24), opacity) #state_size += 1 #====================玄:显示优化融合=================================== @text +=" " @text += $data_states[state].name.to_s if $data_states[state].id < 400 #玄:无极状态不显示 @text +=" " end # of for set_text(@text, 0) #======================================================================== end end class Game_Battler attr_reader :states_turn # 声明状态剩余回合 end #============================================================================== # 本脚本来自www.66RPG.com,使用和转载请保留此信息 # 欢迎访问www.66RPG.com # 梦想世界,在你手中 #==============================================================================
QQ图片20200113150934.png (345.02 KB, 下载次数: 20)
紫英晓狼1130 发表于 2020-1-13 18:59
为什么我感觉原脚本就没在战斗图脚下显示状态的功能?重定义了Window_Base和Window_Help和战斗图有什么关系 ...
紫英晓狼1130 发表于 2020-1-13 18:59
为什么我感觉原脚本就没在战斗图脚下显示状态的功能?重定义了Window_Base和Window_Help和战斗图有什么关系 ...
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |