Project1
标题:
减少子弹的方法
[打印本页]
作者:
banbianzhang
时间:
2011-5-22 10:26
标题:
减少子弹的方法
就是在装备火枪之后攻击,会减少一发火枪子弹,没子弹就不能攻击,这个效果怎么做??
作者:
禾西
时间:
2011-5-22 10:30
参考一下
http://www.66rpg.com/htm/news215.htm
作者:
Wind2010
时间:
2011-5-22 10:42
首先是子弹攻击
Scene_Battle 3的"设置角色指令窗口"
插入一个没有子弹显示冷冻(?)的脚本
def phase3_setup_command_window
# 同伴指令窗口无效化
@party_command_window.active = false
@party_command_window.visible = false
# 角色指令窗口无效化
@actor_command_window.active = true
@actor_command_window.visible = true
# ↓增加
@actor_command_window.disable_item(0) if $game_party.item_number(item_id)==0 and $game_party.actors[@actor_index].weapon_id == 火枪数据库ID
# ↑增加
# 设置角色指令窗口的位置
@actor_command_window.x = @actor_index * 160
# 设置索引为 0
@actor_command_window.index = 0
end
复制代码
item_id为子弹的数据库ID
但是单显示冷冻还不行,还要在按下确定键的时候进行判断,于是在下面的"刷新画面 (角色命令回合 : 基本命令)"中:
def update_phase3_basic_command
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 转向前一个角色的指令输入
phase3_prior_actor
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 角色指令窗口光标位置分之
case @actor_command_window.index
when 0 # 攻击
# ↓增加
if $game_party.item_number(item_id)==0 and $game_party.actors[@actor_index].weapon_id == 火枪数据库ID
$game_system.se_play($data_system.buzzer_se)
return
end
# ↑增加
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
# 开始选择敌人
start_enemy_select
复制代码
于是乎普攻需要子弹的问题解决了,然后是普攻消耗子弹:
Game_Battler 3中的"应用通常攻击效果"
attacker : 攻击者 (battler)
好了,于是就是要判断攻击者是否装备火枪的角色,然后扣子弹
def attack_effect(attacker)
if attacker.is_a?(Game_Actor)
if attacker.weapon_id == 火枪ID
$game_party.gain_item(item_id,-1)
end
end
# 清除会心一击标志
self.critical = false
复制代码
以上未经试验
作者:
banbianzhang
时间:
2011-5-22 19:12
不行啊,没用。
作者:
a19981007a
时间:
2011-5-25 19:42
是arpg的吗?
作者:
zq7695zq
时间:
2011-5-29 11:39
变量加公共事件?··
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1