Project1
标题:
求助!帮忙看看这个脚本如何使用(点进来有脚本)
[打印本页]
作者:
贝贝Susan
时间:
2015-11-8 09:29
标题:
求助!帮忙看看这个脚本如何使用(点进来有脚本)
#==============================================================================
# 随机学技能的物品 by 沉影不器
#------------------------------------------------------------------------------
# 功能: 指定某些一次性物品附带技能,使用后随机学会物品附带的技能之一
# 说明: 第10行设定格式如下
# 带技能的物品id => [该物品所带技能id, 该物品所带技能id, ...]
# 例: SKILL_FROM_ITEM = {22=>[77,78,79]}
# 22号物品带77,78,79号三种技能
#==============================================================================
SKILL_FROM_ITEM = {22=>[77,78,79], 23=>[80,81,82]}
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 应用物品效果
# user : 物品使用者
# item : 物品
#--------------------------------------------------------------------------
def item_effect(user, item)
clear_action_results
unless item_effective?(user, item)
@skipped = true
return
end
skill_from_item(user, item) # 随机学技能
if rand(100) >= calc_hit(user, item) # 判断命中
@missed = true
return
end
if rand(100) < calc_eva(user, item) # 判断回避
@evaded = true
return
end
hp_recovery = calc_hp_recovery(user, item) # 计算回复量
mp_recovery = calc_mp_recovery(user, item)
make_obj_damage_value(user, item) # 计算伤害
@hp_damage -= hp_recovery
@mp_damage -= mp_recovery
make_obj_absorb_effect(user, item) # 计算吸收效果
execute_damage(user) # 反映伤害
item_growth_effect(user, item) # 应用成长效果
if item.physical_attack and @hp_damage == 0 # 判断物理攻击无效
return
end
apply_state_changes(item) # 状态变化
end
#--------------------------------------------------------------------------
# ● 随机学技能
# user : 物品使用者
# item : 物品
#--------------------------------------------------------------------------
def skill_from_item(user, item)
# 物品对敌人无效 角色死亡无效
if user.is_a?(Game_Actor) and !user.dead? and
# 包含指定技能 id 的物品
SKILL_FROM_ITEM.keys.include?(item.id)
temp_skills = SKILL_FROM_ITEM[item.id]
# 随机
user.learn_skill temp_skills[rand(temp_skills.size-1)]
end
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 设定物品描述
#--------------------------------------------------------------------------
def set_item_description(item_id)
text = ""
temp_skills = SKILL_FROM_ITEM[item_id]
for i in 0...temp_skills.size
skill_id = temp_skills[i]
skill = $data_skills[skill_id]
if i == temp_skills.size - 2
text += skill.name.to_s
elsif i == temp_skills.size - 1
text += "和" + skill.name.to_s
else
text += skill.name.to_s + "、"
end
end
return "随机学会" + text + "的物品"
end
end
#==============================================================================
# ■ Window_Item
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# ● 更新帮助文本
#--------------------------------------------------------------------------
def update_help
if item == nil
text = ""
elsif SKILL_FROM_ITEM.keys.include?(item.id)
text = set_item_description(item.id)
else
text = item.description
end
@help_window.set_text(text)
end
end
#==============================================================================
# ■ Window_ShopBuy
#==============================================================================
class Window_ShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# ● 更新帮助文本
#--------------------------------------------------------------------------
def update_help
if item == nil
text = ""
elsif SKILL_FROM_ITEM.keys.include?(item.id)
text = set_item_description(item.id)
else
text = item.description
end
@help_window.set_text(text)
end
end
作者:
贝贝Susan
时间:
2015-11-8 09:34
这是使用物品学技能的脚本,我不知道物品备注栏写什么!急~
@沉影不器
作者:
正太君
时间:
2015-11-8 10:10
SKILL_FROM_ITEM = {22=>[77,78,79], 23=>[80,81,82]}
自己看说明改这行咿咿咿...
作者:
正太君
时间:
2015-11-8 10:20
user.learn_skill temp_skills[rand(temp_skills.size-1)]
目测这行作者写错了,应该是
user.learn_skill temp_skills[rand(temp_skills.size)]
作者:
duchen5779
时间:
2015-11-9 10:24
谁跟你说是写物品备注了?
SKILL_FROM_ITEM = {22=>[77,78,79], 23=>[80,81,82]}
这行不是脚本里面的吗啊?22号物品学哪几个,23号物品学哪几个,在后面再加啊。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1