Project1
标题:
随即装备系统 我晕 高手来救命啊~~~~
[打印本页]
作者:
卓越大白痴
时间:
2008-8-23 05:03
标题:
随即装备系统 我晕 高手来救命啊~~~~
我这样做的在
#--------------
# 装备栏中卸下的武器不进行随机处理
#
if $scene.is_a?(Scene_Equip) #(报错在这里第11行)
get_armor(armor_id, n)
return
---------------------------------------------
看帖子修改后
or $data_weapons[weapon_id].element_set.include?(19)#(我添加了这里在if $scene.is_a?(Scene_Equip)后面结果武器可以防具就不行 了)
防具的话应该怎摸加呢?? 求解啊
# 重點:quality
class Game_Party
def gain_armor(armor_id, n)
setting = Radom_Creation.new
identified_control = setting.identified_control
if armor_id > 0
#--------------
# 装备栏中卸下的武器不进行随机处理
#
if $scene.is_a?(Scene_Equip)
get_armor(armor_id, n)
return
# -------------
# 或者「真の窗口風格·に·Step2」
#
elsif $scene.is_a?(Deatwo_Smith_Shop2)
get_armor(armor_id, n)
return
#--------------
# 商店购买 則原版複製
#
elsif $scene.is_a?(Scene_Shop)
gain_armor_f_shop(armor_id, n)
return
#--------------
# 此外 皆隨機生成
#
else
# 鑒定系統開啓
if identified_control == 1 and $data_armors[armor_id].identified == true and rand(50)<40
#-生成沒有鉴定的武器
unidentify_armor(armor_id, n)
elsif
for j in 1..n
# 取得設定
t = setting.t
l_t =setting.l_t
best_quality = setting.best_quality
level_set = setting.level_set
worst_level_set = setting.worst_level_set
#---------------
a = rand(1000)
b = 1000 - t - l_t # 上下分岐
b2 = 1000 - t # 上中分岐
if a > b # 成功
if a > b2 # 中品
s = 1
else # 上品
s = 2
end
else #下品
s = 0
end
b = (best_quality * 1/3).round
case s
when 0
vid = 0
new_holes = rand(2)+3
when 1
vid = (best_quality * 1/3).round
new_holes = rand(3)+2
when 2
vid = (best_quality * 2/3).round
new_holes = rand(5)
end
armor = $data_armors[armor_id]
new_name = armor.name.split(/(未鑑定)/)[0]
new_des = armor.description
new_price = armor.price
new_str = armor.str_plus
new_dex = armor.dex_plus
new_agi = armor.agi_plus
new_int = armor.int_plus
new_pdef = armor.pdef
new_mdef = armor.mdef
new_element = armor.guard_element_set
new_state = armor.guard_state_set
new_duration = armor.max_duration
# 取得quality總量
xio = rand(b)+vid
=begin
#--再折損值
if worst_level_set!=nil
if worst_level_set[1]!=nil
xio -= rand(worst_level_set[1])
end
end
=end
# 初始化quality
quality = 0
# 如果設定增加屬性以及狀態:
if setting.element_set.size > 0 and setting.state_set.size > 0
kind = rand(3)
# 否則
else
kind = rand(2)
end
for i in 1..10
if xio < 2
break
end
case kind
when 0
# 附加兩防
a_p = rand(xio/3).round
a_m = rand(xio/3).round
new_pdef += a_p * setting.f_pdef
new_mdef += a_m * setting.f_mdef
xio -= (a_p + a_m)
quality += (a_p + a_m)
# 附加四參數
when 1
a_s = rand(xio/4).round
a_d = rand(xio/4).round
a_g = rand(xio/4).round
a_i = rand(xio/4).round
new_str += a_s
new_dex += a_d
new_agi += a_g
new_int += a_i
xio -= (a_s + a_d + a_g +a_i)
quality +=(a_s + a_d + a_g +a_i)
# 附加屬性以及狀態
when 2
#錯誤報告-------
p "未曾設定element_set於隨機裝備·基本定義" if setting.element_set.size < 1
p "未曾設定state_set於隨機裝備·基本定義" if setting.state_set.size < 1
p "請修改「隨機裝備·核心」" unless setting.element_set.size > 0 and setting.state_set.size > 0
#---------------
dio = rand(xio/2).round
cost = setting.cost
if xio >= cost
sc_kind = rand(2)
case sc_kind
when 0
n_el = setting.element_set[rand(setting.element_set.size)]
new_element = new_element|[n_el]
quality += cost
xio -= cost
when 1
n_st = setting.state_set[rand(setting.state_set.size)]
new_state = new_state|[n_st]
quality += cost
xio -= cost
end
end
end
end
#
if new_element.include?(8)
new_name = "闇之"+ new_name
elsif new_element.include?(8)
new_name = "光之"+ new_name
end
q = best_quality
new_color = 0
if level_set !=nil
for i in level_set
if i[0] != nil
q -= i[0]
# p q
if quality > q
if i [1]!= nil
new_color = i[1]
end
if i[2]!=nil
new_name = i[2] + new_name
end
if i[3]!=nil
new_name = new_name + i[3]
end
break
end
end
end
end
if quality < 0
if worst_level_set!=nil
new_color = worst_level_set[0]
if worst_level_set[2]!=nil
new_name = new_name + worst_level_set[2]
end
if worst_level_set[3]!=nil
new_name = new_name + worst_level_set[3]
end
end
end
new_duration = quality*setting.f_duration
#------------------
if $data_armors[armor_id].identified == true
new_armor = $data_armors[armor_id].clone
need = 0
for need in 1...$data_armors.size
if $data_armors[need].needed == false
break
end
end
if need = 0
new_armor.id = $data_armors.size
else
new_armor.id = need
end
new_armor.name = new_name
new_armor.description = new_des
new_armor.price = new_price
new_armor.pdef = new_pdef
new_armor.mdef = new_mdef
new_armor.str_plus = new_str
new_armor.dex_plus = new_dex
new_armor.agi_plus = new_agi
new_armor.int_plus = new_int
new_armor.color = new_color
new_armor.quality = quality
new_armor.holes = new_holes
new_armor.guard_element_set = new_element
new_armor.guard_state_set = new_state
new_armor.max_duration = new_duration
new_armor.current_duration = new_duration
new_armor.needed = true
# 添加入數據库
$data_armors.push(new_armor)
# 职业可裝備武器數組更新
renew_armor_f_classes(armor_id, new_armor.id)
# 增加武器
get_armor(new_armor.id, 1)
else
armor.name = new_name
armor.description = new_des
armor.price = new_price
armor.pdef = new_pdef
armor.mdef = new_mdef
armor.str_plus = new_str
armor.dex_plus = new_dex
armor.agi_plus = new_agi
armor.int_plus = new_int
armor.color = new_color
armor.quality = quality
armor.holes = new_holes
armor.guard_element_set = new_element
armor.guard_state_set = new_state
armor.max_duration = new_duration
armor.current_duration = new_duration
armor.needed = true
# 取消未鑒定標志
armor.identified = true
# 增加武器
get_armor(armor.id, 1)
end
end
end
end
end
end
#--------------
# 生成沒有鉴定的裝備
#
def unidentify_armor(armor_id, n)
armor = $data_armors[armor_id].clone
for j in 1..n
armor.id = $data_armors.size
armor.name +="(未鑑定)"
armor.identified =false
armor.needed = true
$data_armors.push(armor)
# 职业可装备武器数组更新~
renew_armor_f_classes(armor_id, armor.id)
# 增加武器
get_armor(armor.id, 1)
end
end
#--------------
# 职业可装备武器组更新
#
def renew_armor_f_classes(armor_id, new_armor_id)
for i in 1...$data_classes.size
if $data_classes[i].armor_set.include?(armor_id)
$data_classes[i].armor_set.push(new_armor_id)
end
end
end
#--------------
# 增加武器
#
def get_armor(armor_id, n)
@armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
end
#--------------
# 失去裝備
#
def lose_armor(armor_id, n)
if armor_id > 0
@armors[armor_id] = [[armor_number(armor_id) - n, 0].max, 99].min
$data_armors[armor_id].needed == false
end
end
end
复制代码
[LINE]1,#dddddd[/LINE]
此贴于 2008-8-25 23:54:19 被版主darkten提醒,请楼主看到后对本贴做出回应。
作者:
卓越大白痴
时间:
2008-8-23 06:08
我用的是三合一
研究了一下改成这样$data_weapons[armor_id].element_set.include?(19)
结果前几个装备能禁止随即后面的就不行了 晕
第一个防具 不做随即 其他的都做随机处理
后来经过研究改成这样
if $scene.is_a?(Scene_Equip)or
$data_armors[armor_id].element_set.include?(19)
get_armor(armor_id, n)
return
还是不行. . .
可要是武器的话这样就可以 这句是什么weapons武器的意思吗?
if $scene.is_a?(Scene_Equip)or
$data_weapons[weapon_id].element_set.include?(19)
get_weapon(weapon_id, n)
return
#============================================================
随便说的什么好不好 不要让我失去希望
或者有创意的想法也可以 (给个方法吧)
大概的意思是说
我用随即装备脚本后在得到的装备都自动被随即掉了 这样的话套装系统什么的都
用不了了 急啊~~~~~~
试过用脚本获得物品ID然后得到该ID物品 也不行 虽然
$data_weapons[weapon_id].element_set.include?(19)这句有点用但只针对武器
防具方面不灵,
http://rpg.blue/viewthread.php?t ... D8%2D24+1%3A56%3A11
作者:
卓越大白痴
时间:
2008-8-24 10:00
.....................
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1