设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1725|回复: 7
打印 上一主题 下一主题

[已经解决] RMXP求助 纵版战斗 能否在主角 受到攻击时 替换战斗角色图象

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
79
在线时间
127 小时
注册时间
2008-5-12
帖子
144
跳转到指定楼层
1
发表于 2011-7-26 20:51:56 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
比如 我现在的战斗角色是正常的主角A 站姿 拿着武器 当这个角色受到攻击的时候 就替换这个角色的battler图象 变成一个受伤的姿势的图象 然后隔个1-2秒(这个最好也可以自定义) 就回到之前的默认图象

拜谢!

Lv1.梦旅人

虱子

梦石
0
星屑
121
在线时间
1782 小时
注册时间
2010-6-19
帖子
3597
2
发表于 2011-7-26 20:53:44 | 只看该作者
设置被攻击动画不行么

http://rpg.blue/thread-175056-1-2.html
PVZ型塔防物一个
http://rpg.blue/thread-155199-1-2.html
RMXP技术讨论区手动认可帖,得到答案请认可
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
79
在线时间
127 小时
注册时间
2008-5-12
帖子
144
3
 楼主| 发表于 2011-7-26 20:58:36 | 只看该作者
受击动画怎么做呢?我是默认的纵版战斗
回复

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9058
在线时间
1860 小时
注册时间
2010-7-18
帖子
974
4
发表于 2011-7-26 23:33:51 | 只看该作者

全动画战斗

or

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

使用道具 举报

Lv1.梦旅人

虱子

梦石
0
星屑
121
在线时间
1782 小时
注册时间
2010-6-19
帖子
3597
5
发表于 2011-7-26 23:46:50 | 只看该作者
本帖最后由 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
复制代码
不确定成功

点评

忘记加内嵌符了哦……那个常量。  发表于 2011-7-27 00:52

http://rpg.blue/thread-175056-1-2.html
PVZ型塔防物一个
http://rpg.blue/thread-155199-1-2.html
RMXP技术讨论区手动认可帖,得到答案请认可
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
79
在线时间
127 小时
注册时间
2008-5-12
帖子
144
6
 楼主| 发表于 2011-7-27 10:03:20 | 只看该作者
Wind2010 很感谢 但这段脚本貌似不行呢 进入战斗就报错了..


ace69于2011-7-27 10:27补充以下内容:
还是有问题 第9行 无法定义本地变量或方法"target"....

点评

已修改,再试试  发表于 2011-7-27 10:16
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
257 小时
注册时间
2007-6-6
帖子
219
7
发表于 2011-7-30 00:25:51 | 只看该作者
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”的文件,就是挨打后变换的战斗图。

点评

打错了,是“阿尔西斯_h”。。  发表于 2011-7-30 00:28
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
79
在线时间
127 小时
注册时间
2008-5-12
帖子
144
8
 楼主| 发表于 2011-7-31 21:07:30 | 只看该作者
xiezhen6805 发表于 2011-7-30 00:25
scene_battle4的对象方动画那里的target.animation_hit = (target.damage != "Miss")下面插入:
        ta ...

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

点评

显示伤害那里插入了target.battler_name = target.battler_name.split(/_/)[0]吗?这个是变回正常战斗图的关键。。  发表于 2011-7-31 23:45
回复

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-7-21 04:12

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表