查看: 2289|回复: 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中调用重写的方法就行了

[pre lang="ruby" line="1"]class Window_Help < Window_Base
  def set_text_bitmap(bitmap,text, align = 0)
    # 如果文本和对齐方式的至少一方与上次的不同
    if text != @text or align != @align
      # 再描绘文本
      self.contents.clear
      self.contents.font.color = normal_color
#==========================================
      x= (self.width-self.contents.text_size(text).width)/2-44
      self.contents.blt(x, 4, bitmap, Rect.new(0, 0, 24, 24))
#==========================================
      self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
      @text = text
      @align = align
      @actor = nil
    end
    self.visible = true
  end
  end
  
class Scene_Battle
    def make_skill_action_result
    # 获取特技
    @skill = $data_skills[@active_battler.current_action.skill_id]
    # 如果不是强制行动
    unless @active_battler.current_action.forcing
      # 因为 SP 耗尽而无法使用的情况下
      unless @active_battler.skill_can_use?(@skill.id)
        # 清除强制行动对像的战斗者
        $game_temp.forcing_battler = nil
        # 移至步骤 1
        @phase4_step = 1
        return
      end
    end
    # 消耗 SP
    @active_battler.sp -= @skill.sp_cost
    # 刷新状态窗口
    @status_window.refresh
    # 在帮助窗口显示特技名
#=======================================
    bitmap = RPG::Cache.icon(@skill.icon_name)
    @help_window.set_text_bitmap(bitmap,@skill.name, 1)
#=======================================
    # 设置动画 ID
    @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    # 设置公共事件 ID
    @common_event_id = @skill.common_event_id
    # 设置对像侧战斗者
    set_target_battlers(@skill.scope)
    # 应用特技效果
    for target in @target_battlers
      target.skill_effect(@active_battler, @skill)
    end
  end
  end[/pre]

评分

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

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部