Project1

标题: RMXP求助 纵版战斗 能否在主角 受到攻击时 替换战斗角色图象 [打印本页]

作者: ace69    时间: 2011-7-26 20:51
标题: RMXP求助 纵版战斗 能否在主角 受到攻击时 替换战斗角色图象
比如 我现在的战斗角色是正常的主角A 站姿 拿着武器 当这个角色受到攻击的时候 就替换这个角色的battler图象 变成一个受伤的姿势的图象 然后隔个1-2秒(这个最好也可以自定义) 就回到之前的默认图象

拜谢!dsu_plus_rewardpost_czw
作者: Wind2010    时间: 2011-7-26 20:53
设置被攻击动画不行么
作者: ace69    时间: 2011-7-26 20:58
受击动画怎么做呢?我是默认的纵版战斗
作者: ms0688987    时间: 2011-7-26 23:33

全动画战斗

or

柳柳之前做的一个范例( Battlers定义挨打+死亡+衰弱. . . )

作者: Wind2010    时间: 2011-7-26 23:46
本帖最后由 Wind2010 于 2011-7-27 10:16 编辑
  1. module L_B_H_C
  2.   C_HZ = "_伤害"  # 被打后的战斗图像变为原图片名+_伤害
  3.                   # 例:
  4.                   # 原角色名:  图片
  5.                   # 击打:      图片_伤害
  6. end               
  7. class Scene_Battle
  8.   def update_phase4_step4
  9.     if target.is_a?(Game_Actor)
  10.       if FileTest.exist?("Graphics/Battlers/target.battler_name"+L_B_H_C::C_HZ)
  11.         target.set_graphic(target.character_name,target.character_hue,target.battler_name+L_B_H_C::C_HZ,target.battler_hue)
  12.       end
  13.     end
  14.     for target in @target_battlers
  15.       target.animation_id = @animation2_id
  16.       target.animation_hit = (target.damage != "Miss")
  17.     end
  18.     @wait_count = 8
  19.     @phase4_step = 5
  20.     loop do
  21.       Graphics.update
  22.       @wait_count -= 1
  23.       @spriteset.update
  24.       break if @wait_count==0 and not @spriteset.effect?
  25.     end
  26.     if target.is_a?(Game_Actor)
  27.       target.set_graphic(target.character_name,target.character_hue,target.battler_name.gsub(L_B_H_C::C_HZ){},target.battler_hue)
  28.     end
  29.   end
  30. end
复制代码
不确定成功
作者: ace69    时间: 2011-7-27 10:03
Wind2010 很感谢 但这段脚本貌似不行呢 进入战斗就报错了..


ace69于2011-7-27 10:27补充以下内容:
还是有问题 第9行 无法定义本地变量或方法"target"....
作者: xiezhen6805    时间: 2011-7-30 00:25
scene_battle4的对象方动画那里的target.animation_hit = (target.damage != "Miss")下面插入:
        target.battler_name = target.battler_name.split(/_/)[0]
        if target.damage > 0        
        target.battler_name = target.battler_name + "_h"  
        end
然后显示伤害的if target.damage != nil
                       target.damage_pop = true
                       end下面插入一句:
      target.battler_name = target.battler_name.split(/_/)[0]
然后game_battler 1的attr_reader   :battler_name中的reader改成accessor,最后battler文件夹中每个战斗图都要带一个战斗图名_h的战斗图,比如battler文件夹中战斗图名是“阿尔西斯”,就得有个“阿尔西斯_d”的文件,就是挨打后变换的战斗图。
作者: ace69    时间: 2011-7-31 21:07
xiezhen6805 发表于 2011-7-30 00:25
scene_battle4的对象方动画那里的target.animation_hit = (target.damage != "Miss")下面插入:
        ta ...

这个脚本生效 能够更改战斗图了 但是...受击后没有变回默认的战斗图...




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1