查看: 2345|回复: 1

[已经解决] 战斗时,帮助窗口要怎样显示特技的图标?

[复制链接]
梦石
0
星屑
615
在线时间
84 小时
注册时间
2012-8-12
回帖
127
发表于 2017-12-15 20:30:18 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
就是战斗时使用特技,帮助窗口显示的特技名字
在特技名字加上特技的图标,要怎样做
梦石
0
星屑
1397
在线时间
185 小时
注册时间
2007-2-28
回帖
139
发表于 2017-12-16 01:18:43 | 显示全部楼层
重写一个Window_Help类下的set_text方法,在Scene_Battle类下的make_skill_action_result中调用重写的方法就行了

  1. class Window_Help < Window_Base
  2.   def set_text_bitmap(bitmap,text, align = 0)
  3.     # 如果文本和对齐方式的至少一方与上次的不同
  4.     if text != @text or align != @align
  5.       # 再描绘文本
  6.       self.contents.clear
  7.       self.contents.font.color = normal_color
  8. #==========================================
  9.       x= (self.width-self.contents.text_size(text).width)/2-44
  10.       self.contents.blt(x, 4, bitmap, Rect.new(0, 0, 24, 24))
  11. #==========================================
  12.       self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  13.       @text = text
  14.       @align = align
  15.       @actor = nil
  16.     end
  17.     self.visible = true
  18.   end
  19.   end
  20.   
  21. class Scene_Battle
  22.     def make_skill_action_result
  23.     # 获取特技
  24.     @skill = $data_skills[@active_battler.current_action.skill_id]
  25.     # 如果不是强制行动
  26.     unless @active_battler.current_action.forcing
  27.       # 因为 SP 耗尽而无法使用的情况下
  28.       unless @active_battler.skill_can_use?(@skill.id)
  29.         # 清除强制行动对像的战斗者
  30.         $game_temp.forcing_battler = nil
  31.         # 移至步骤 1
  32.         @phase4_step = 1
  33.         return
  34.       end
  35.     end
  36.     # 消耗 SP
  37.     @active_battler.sp -= @skill.sp_cost
  38.     # 刷新状态窗口
  39.     @status_window.refresh
  40.     # 在帮助窗口显示特技名
  41. #=======================================
  42.     bitmap = RPG::Cache.icon(@skill.icon_name)
  43.     @help_window.set_text_bitmap(bitmap,@skill.name, 1)
  44. #=======================================
  45.     # 设置动画 ID
  46.     @animation1_id = @skill.animation1_id
  47.     @animation2_id = @skill.animation2_id
  48.     # 设置公共事件 ID
  49.     @common_event_id = @skill.common_event_id
  50.     # 设置对像侧战斗者
  51.     set_target_battlers(@skill.scope)
  52.     # 应用特技效果
  53.     for target in @target_battlers
  54.       target.skill_effect(@active_battler, @skill)
  55.     end
  56.   end
  57.   end
复制代码

评分

参与人数 3星屑 +50 赞 +3 收起 理由
RyanBern + 50 + 1 认可答案
火焰卷轴 + 1 认可答案
chd114 + 1 我很赞同

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部