Project1
标题:
武器爆发特技的脚本
[打印本页]
作者:
巧克力猫咪
时间:
2010-9-22 01:08
标题:
武器爆发特技的脚本
本帖最后由 小幽的马甲 于 2010-9-22 11:39 编辑
#==============================================================================
# ** 武器爆发特技
#------------------------------------------------------------------------------
# 作者:Dargor
# 更新:2008.04.03
# 版本:1.2
# 汉化:DeathKing
#------------------------------------------------------------------------------
# 说明:
# - 修改模块内容,实现特效
# 更新历史:
# - 1.0 (2008.02.03), 发布初始版本
# - 1.1 (2008.04.03), 添加了对二刀流的支持
# - 1.2 (2008.04.03), 兼容“战斗狂暴”脚本
# P.S.
# - two_swords 原来是指“二刀流”,如此啊……
#==============================================================================
#==============================================================================
# ** Weapon Unleash 构造
#==============================================================================
module Weapon_Unleash
# 可以爆发特技的武器编号
Weapons = [1,2,3]
# 武器编号与爆发特技的对应关系
# 语法: 武器id => 技能id
Skill = {
1 => 59,
2 => 82
}
# 默认爆发技能
Skill.default = 1
# 爆发特技的百分数
# 语法: 武器id => 百分比
Rate = {
1 => 100,
2 => 100
}
# 默认爆发几率
Rate.default = 25
end
# 武器爆发特技时的文本
Vocab::WeaponUnleash = "%s的%s爆发出%s!"
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# 这个类处理角色相关信息。
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * 获取普通攻击动画id
#--------------------------------------------------------------------------
def atk_animation_id
if two_swords_style
return weapons[0].animation_id if weapons[0] != nil
return weapons[1] == nil ? 1 : 1
else
return weapons[0] == nil ? 1 : weapons[0].animation_id
end
end
#--------------------------------------------------------------------------
# * 获取普通攻击动画id2(二刀流?)
#--------------------------------------------------------------------------
def atk_animation_id2
if two_swords_style
return weapons[1] == nil ? 1 : weapons[1].animation_id
else
return 1
end
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# 这个类用于处理场景
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * 为函数定义别名
#--------------------------------------------------------------------------
alias dargor_execute_action_attack execute_action_attack
#--------------------------------------------------------------------------
# * 执行战斗
#--------------------------------------------------------------------------
def execute_action_attack
# 执行武器爆发检查
if @active_battler.is_a?(Game_Actor)
weapon = @active_battler.weapons[0]
if weapon_can_unleash?(weapon)
# 执行武器1爆发检查
execute_action_weapon_unleash(weapon)
else
# 执行武器1的普通攻击
execute_specific_action_attack(1)
end
# 如果是二刀流
if @active_battler.two_swords_style
weapon = @active_battler.weapons[1]
if weapon_can_unleash?(weapon)
# 执行武器2的爆发检查
execute_action_weapon_unleash(weapon)
else
# 执行武器2的普通攻击
execute_specific_action_attack(2)
end
end
# 执行普通攻击
else
dargor_execute_action_attack
end
end
#--------------------------------------------------------------------------
# * 执行具体攻击动作
# weapon : 角色武器 (1 或 2)
#--------------------------------------------------------------------------
def execute_specific_action_attack(weapon)
if weapon == 1
animation = @active_battler.atk_animation_id
end
if weapon == 2
animation = @active_battler.atk_animation_id2
end
text = sprintf(Vocab::DoAttack, @active_battler.name)
@message_window.add_instant_text(text)
targets = @active_battler.action.make_targets
display_normal_animation(targets, animation)
wait(30)
for target in targets
target.attack_effect(@active_battler)
display_action_effects(target)
end
end
#--------------------------------------------------------------------------
# * 执行武器爆发特技
#--------------------------------------------------------------------------
def execute_action_weapon_unleash(weapon)
skill = $data_skills[Weapon_Unleash::Skill[weapon.id]]
skill = $data_skills[Weapon_Unleash::Skill.default] if skill.nil?
weapon_name = weapon.name
text = sprintf(Vocab::WeaponUnleash, @active_battler.name, weapon_name, skill.name)
@message_window.add_instant_text(text)
targets = @active_battler.action.make_targets
display_animation(targets, skill.animation_id)
for target in targets
target.skill_effect(@active_battler, skill)
display_action_effects(target, skill)
@message_window.back_to(0)
end
end
#--------------------------------------------------------------------------
# * 判断是否可爆发
#--------------------------------------------------------------------------
def weapon_can_unleash?(weapon)
return false if @active_battler.is_a?(Game_Enemy)
return false unless Weapon_Unleash::Weapons.include?(weapon.id)
rate = Weapon_Unleash::Rate[weapon.id]
rate = Weapon_Unleash::Rate.default if rate.nil?
random = rand(100)
return random <= rate
end
end
复制代码
我发现这和Sideview的脚本有冲哭,我像问下是改哪里才行?没人回答就当分享吧
作者:
429259591
时间:
2010-9-22 09:55
First,脚本最好用代码发出来
Second,我也不懂脚本
作者:
wsmyzc
时间:
2010-9-22 11:38
我记得KGC有个,那个兼容性比较好
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1