Project1
标题:
悬赏个防具带技能脚本
[打印本页]
作者:
v2sam
时间:
2009-11-18 16:10
标题:
悬赏个防具带技能脚本
就是给沉影的武器带技能加上防具也带技能,要求定义方式一样,且不冲突。
至于多少奖励的话应征者说吧,能力范围内可以满足的一定给。
#==============================================================================
# 武器带技能 by 沉影不器
#------------------------------------------------------------------------------
# 武器备注栏写 skill=技能号 表示武器带该技能.
# 允许同时带多技能 skill=技能号,技能号,技能号...
# 写法比较偷懒,bug未知
#==============================================================================
#==============================================================================
# ■ RPG::Weapon
#==============================================================================
module RPG
class Weapon < BaseItem
def skill_ids
return read_note('skill').split(/,/)
end
end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# 技能绑定
#--------------------------------------------------------------------------
def skill_plus
@skills.clear
for i in self.class.learnings
learn_skill(i.skill_id) if i.level <= @level
end
unless @weapon_id == 0
ids = equips[0].skill_ids
for s in ids
learn_skill(s.to_i)
end
end
return unless two_swords_style
unless @armor1_id == 0
ids = equips[1].skill_ids
for s in ids
learn_skill(s.to_i)
end
end
end
#--------------------------------------------------------------------------
# ● 设置
#--------------------------------------------------------------------------
alias old_setup setup
def setup(actor_id)
old_setup(actor_id)
skill_plus
end
#--------------------------------------------------------------------------
# ● 更改装备
#--------------------------------------------------------------------------
def change_equip(equip_type, item, test = false)
last_item = equips[equip_type]
unless test
return if $game_party.item_number(item) == 0 if item != nil
$game_party.gain_item(last_item, 1)
$game_party.lose_item(item, 1)
end
item_id = item == nil ? 0 : item.id
case equip_type
when 0 # 武器
@weapon_id = item_id
unless two_hands_legal? # 违反双手拿取的情况下
change_equip(1, nil, test) # 解除反手的装备
end
when 1 # 盾
@armor1_id = item_id
unless two_hands_legal? # 违反双手拿取的情况下
change_equip(0, nil, test) # 解除反手的装备
end
when 2 # 头
@armor2_id = item_id
when 3 # 身体
@armor3_id = item_id
when 4 # 装饰品
@armor4_id = item_id
end
skill_plus
end
#--------------------------------------------------------------------------
# ● 废弃装备
#--------------------------------------------------------------------------
def discard_equip(item)
if item.is_a?(RPG::Weapon)
if @weapon_id == item.id
@weapon_id = 0
elsif two_swords_style and @armor1_id == item.id
@armor1_id = 0
end
elsif item.is_a?(RPG::Armor)
if not two_swords_style and @armor1_id == item.id
@armor1_id = 0
elsif @armor2_id == item.id
@armor2_id = 0
elsif @armor3_id == item.id
@armor3_id = 0
elsif @armor4_id == item.id
@armor4_id = 0
end
end
skill_plus
end
end
复制代码
作者:
夏季冰川
时间:
2009-11-18 16:24
企鹅用过这个没?
http://rpg.blue/viewthread.php?tid=76347&extra=&page=1
作者:
v2sam
时间:
2009-11-18 17:19
有看过,不过太复杂,想要简洁点的
作者:
妮贝雅
时间:
2009-11-18 18:52
KGC的脚本不错啊……
虽然长了些,但是要手动修改的东西都列在前面了
作者:
小幽的马甲
时间:
2009-11-18 18:52
#==============================================================================
# 武器带技能 by 沉影不器
#------------------------------------------------------------------------------
# 武器备注栏写 skill=技能号 表示武器带该技能.
# 允许同时带多技能 skill=技能号,技能号,技能号...
# 写法比较偷懒,bug未知
#==============================================================================
#==============================================================================
# ■ RPG::Weapon
#==============================================================================
module RPG
class Weapon < BaseItem
def skill_ids
return read_note('skill').split(/,/)
end
end
class Armor < BaseItem
def skill_ids
return read_note('skill').split(/,/)
end
end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# 技能绑定
#--------------------------------------------------------------------------
def skill_plus
@skills.clear
for i in self.class.learnings
learn_skill(i.skill_id) if i.level <= @level
end
unless @armor3_id == 0
ids = equips[3].skill_ids
for s in ids
learn_skill(s.to_i)
end
end
unless @armor4_id == 0
ids = equips[4].skill_ids
for s in ids
learn_skill(s.to_i)
end
end
unless @weapon_id == 0
ids = equips[0].skill_ids
for s in ids
learn_skill(s.to_i)
end
end
unless @armor1_id == 0
ids = equips[1].skill_ids
for s in ids
learn_skill(s.to_i)
end
end
unless @armor2_id == 0
ids = equips[2].skill_ids
for s in ids
learn_skill(s.to_i)
end
end
end
#--------------------------------------------------------------------------
# ● 设置
#--------------------------------------------------------------------------
alias old_setup setup
def setup(actor_id)
old_setup(actor_id)
skill_plus
end
#--------------------------------------------------------------------------
# ● 更改装备
#--------------------------------------------------------------------------
def change_equip(equip_type, item, test = false)
last_item = equips[equip_type]
unless test
return if $game_party.item_number(item) == 0 if item != nil
$game_party.gain_item(last_item, 1)
$game_party.lose_item(item, 1)
end
item_id = item == nil ? 0 : item.id
case equip_type
when 0 # 武器
@weapon_id = item_id
unless two_hands_legal? # 违反双手拿取的情况下
change_equip(1, nil, test) # 解除反手的装备
end
when 1 # 盾
@armor1_id = item_id
unless two_hands_legal? # 违反双手拿取的情况下
change_equip(0, nil, test) # 解除反手的装备
end
when 2 # 头
@armor2_id = item_id
when 3 # 身体
@armor3_id = item_id
when 4 # 装饰品
@armor4_id = item_id
end
skill_plus
end
#--------------------------------------------------------------------------
# ● 废弃装备
#--------------------------------------------------------------------------
def discard_equip(item)
if item.is_a?(RPG::Weapon)
if @weapon_id == item.id
@weapon_id = 0
elsif two_swords_style and @armor1_id == item.id
@armor1_id = 0
end
elsif item.is_a?(RPG::Armor)
if not two_swords_style and @armor1_id == item.id
@armor1_id = 0
elsif @armor2_id == item.id
@armor2_id = 0
elsif @armor3_id == item.id
@armor3_id = 0
elsif @armor4_id == item.id
@armor4_id = 0
end
end
skill_plus
end
end
复制代码
没怎么认真测试过,同样bug未知= =
作者:
v2sam
时间:
2009-11-19 09:22
小幽你还在啊,猫感冒住院了,要不你来帮我忙吧XDDDD
作者:
小幽的马甲
时间:
2009-11-19 09:59
啥?猫住院了?该不是甲流吧…这星期有个天杀的NOIP决赛,过了这星期应该就能来帮忙了,有什么用得着的地方尽管吩咐XD
作者:
v2sam
时间:
2009-11-19 10:55
谢谢小幽!抱~~到时QQ或者论坛联系吧XDDDDD
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1