赞 | 35 |
VIP | 0 |
好人卡 | 72 |
积分 | 62 |
经验 | 38967 |
最后登录 | 2025-5-24 |
在线时间 | 1450 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 6175
- 在线时间
- 1450 小时
- 注册时间
- 2015-7-25
- 帖子
- 616
 
|
首先呢,如图
得知了可以在数据库里设置攻击的时候显示的信息,但是呢因为要获取使用者的武器名所以打算去脚本里改
于是,要先找到在脚本中哪块地方调用了显示此信息的方法,首先想到去查找一下RPG::Skill
打开F1帮助文档并找到RPG::Skill,如图
于是呢,就在脚本编辑器里搜索一下message1,并且发现了在Window_BattleLog类里调用了
然后呢,就来修改一下display_use_item这个方法来达到需要的效果
试着加入个判断if item.id == 1 and subject.is_a?(Game_Actor)
来判断id是不是1(默认攻击在数据库中是1号ID)并且是不是我方角色使用的攻击(默认系统中敌人没有装备)
当然,还要判断是使用了物品还是技能,不过呢,这里已经有了判断if item.is_a?(RPG::Skill)
所以呢,在此判断下进行判断就好了
然后,还要获取武器数据,所以呢就是subject.equips[0].name,这样呢,使用者装备的武器名就获得了
于是呢,最后大概就是这样的....
- class Window_BattleLog
- def display_use_item(subject, item)
- if item.is_a?(RPG::Skill)
- if item.id == 1 and subject.is_a?(Game_Actor)
- add_text(subject.name + "使用#{subject.equips[0].name}攻击")
- else
- add_text(subject.name + item.message1)
- end
- unless item.message2.empty?
- wait
- add_text(item.message2)
- end
- else
- add_text(sprintf(Vocab::UseItem, subject.name, item.name))
- end
- end
- end
复制代码
|
评分
-
查看全部评分
|