查看: 981|回复: 2

如何用腳本判定角色血量來變更戰鬥圖?

  [复制链接]
头像被屏蔽
梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-9-5
回帖
200
发表于 2009-5-16 15:53:37 | 显示全部楼层 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
梦石
0
星屑
61
在线时间
24 小时
注册时间
2008-8-5
回帖
1912
发表于 2009-5-16 16:24:46 | 显示全部楼层
在顯示傷害刷新的地方判斷 hp 吧,如果角色 hp 小于 50%,就把戰斗圖改為文件名為
“<原來戰斗圖>” +“_2”的戰斗圖,比如阿爾西斯的戰斗圖是 001-Battler01.png,那么 hp 小于 50% 后就改為 001-Battler01_2.png,然后大于 50% 就改回來~
這個應用于所有我方戰斗者:
class Scene_Battle
  def update_phase4_step5
    # 隐藏帮助窗口
    @help_window.visible = false
    # 刷新状态窗口
    @status_window.refresh
    # 显示伤害
    for target in @target_battlers
      if target.damage != nil
        target.damage_pop = true
      end
    end
    for target in $game_party.actors
      if !(/_2/ =~ target.battler_name) && target.hp < target.maxhp >> 1
        target.set_graphic(target.character_name, target.character_hue,
        target.battler_name + "_2", target.battler_hue)
      elsif /_2/ =~ target.battler_name && target.hp >= target.maxhp >> 1
        target.set_graphic(target.character_name, target.character_hue,
        target.battler_name.split(/_2/)[0], target.battler_hue)
      end
    end

    # 移至步骤 6
    @phase4_step = 6
  end
end

系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
回复

使用道具 举报

头像被屏蔽
梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-9-5
回帖
200
 楼主| 发表于 2009-5-16 16:45:43 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部