加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 996848271 于 2014-7-12 21:34 编辑
属性ID参考说明增强脚本 增加了9号属性“极品出现率” ID为8,影响前缀的好坏 1 - 100,我在脚本中加入
[8,"三国归一",[[0,3000],[1,30],[2,30],[3,30],[4,30],[5,30],[6,30],[7,30],[8,1]]],
结果运行在paramsplus.select{|a| a[2].select{|a| a.size == 2}.each{|a| newparams[a[0]] += a[1]}} #更新属性报错,
报错如下,请大神帮忙看看,谢谢,还有就是怎么降低装备前缀出现几率(现在是100个装备68个左右是有前缀的),以及感觉设置权重对某种前缀的出现几率不是很有用(如三国归一前缀,权重已设置的很低了,出现率还是很高),谢谢
脚本如下:(如红色标记部分)
module Equipplus
#得到随机属性装备方法:gainequip(装备ID,属性数)
#~ 前缀结构:
#~ ①权重(1-100) 越大越重要
#~ ②名称(多个名称用","分开,会随机取其中一个添加到武器名前)
#~ ③属性数组 提供两种方式:
#~ 1.[属性ID,增加值] 属性ID参考说明增强脚本 增加了9号属性“极品出现率” ID为8,影响前缀的好坏 1 - 100
#~ 2.与装备特性相同[code,data_id,value] code,data_id参考说明增强脚本
@maxparamplus = 3 #最大前缀数
@moneyrate = 10 #物品价格计算公式为:原价格 + 前缀权重 * @moneyrate
@transpose = [*1..100].reverse #用于把1变成100,100变成1
@paramsplus = [ #暂时只写了三个前缀,可以自己添加,参照前缀结构\
[71,"绝情",[[2,-30],[4,-30],[14,6,1],[14,7,1],[14,8,1]]],
[72,"伤势",[[3,-20],[5,-20],[32,64,0.1]]],
[73,"峻刑",[[2,-100],[3,-50],[4,-100],[5,-50],[6,-50],[7,-50],[32,66,0.2],[32,59,0.2]]],
[74,"苦肉",[[0,-3000],[21,2,1.2]]],
[75,"挥泪",[[23,6,1.2],[23,7,1.2]]],
[61,"安恤",[[0,1000],[22,7,0.1]]],
[62,"恃勇",[[2,5],[21,2,1.05]]],
[63,"智愚",[[1,20],[4,5],[21,4,1.05]]],
[64,"自守",[[3,10],[5,10],[13,2,0.5],[13,3,0.5],[13,4,0.5],[13,5,0.5]]],
[65,"旋风",[[6,5],[21,6,1.05]]],
[66,"英姿",[[7,10],[21,7,1.05]]],
[30,"铁骑",[[2,5],[22,2,0.3],[32,57,0.1]]],# 必杀几率+30%
[31,"青囊",[[22,7,0.2]]],# 体力恢复速度+20%
[32,"奸雄",[[23,9,1.2]]],# 经验获得+20%
[33,"烈弓",[[22,0,1.1],[22,2,0.2]]],
[35,"追忆",[[64,4,1.3],[64,5,1.3]]], #金钱 装备掉落 1.3倍
[21,"仁德",[[21,0,1.2]]],
[22,"武圣,武魂",[[2,30],[0,1000],[4,-50]]],
[23,"集智,鬼才",[[1,100],[4,30],[2,-50]]],
[24,"毅重,克已",[[3,30],[5,30],[23,7,0.9]]],
[25,"神速",[[6,30]]],
[26,"英魂",[[7,30]]],
[27,"雷击",[[32,23,1]]],
[28,"火计",[[32,21,1]]],
[29,"御策",[[11,3,0.3],[11,4,0.3],[11,5,0.3],[11,6,0.3]]],
[11,"龙胆",[[61,0,1]]],
[12,"咆哮",[[34,0,1]]],
[13,"空城",[[23,0,0.5]]],
[14,"酒诗",[[22,2,1]]],
[15,"无言",[[22,4,0.3]]],
[16,"八阵",[[22,3,1]]],
[17,"节命",[[23,5,1.3]]],
[18,"潜袭",[[22,6,0.2],[32,47,0.1]]],
[19,"不屈",[[23,6,0.9]]],
[10,"无双",[[2,30],[3,30],[4,30],[5,30]]],
[9,"蛊惑",[[32,2,0.1],[32,3,0.1],[32,7,0.1],[32,8,0.1]]],
[8,"三国归一",[[0,3000],[1,30],[2,30],[3,30],[4,30],[5,30],[6,30],[7,30],[8,1]]],
[7,"神愤",[[22,9,0.2]]],
[1,"超越时空",[[21,0,1.1],[21,1,1.1],[21,2,1.1],[21,3,1.1],[21,4,1.1],[21,5,1.1],[21,6,1.1],[21,7,1.1]]]
#[1,"创世天下",[[0,9999],[1,9999],[2,9999],[3,9999],[4,9999],[5,9999],[6,9999],[7,9999],[22,0,9.99],[22,1,9.99],[22,2,9.99],[22,3,9.99],[22,4,9.99],[22,5,9.99],[22,6,9.99],[22,7,9.99],[22,8,9.99],[22,9,9.99],[23,0,9.99],[23,1,9.99],[23,2,9.99],[23,3,9.99],[23,4,9.99],[23,5,9.99],[23,6,9.99],[23,7,9.99],[23,8,9.99],[23,9,9.99],[64,0,2],[64,1,2],[64,2,2],[64,3,2],[64,4,2],[61,0,9],[33,1,9.99],[14,2,1],[14,3,1],[14,4,1],[14,5,1],[14,6,1],[14,7,1],[14,8,1],[14,9,1],[14,10,1],[14,11,1],[14,12,1],[32,1,0.1],[32,2,0.2],[32,3,0.3],[32,4,0.4],[32,5,0.5],[32,6,0.6],[32,7,0.2],[32,8,0.3],[32,9,0.4],[32,10,0.5],[32,11,0.6],[32,12,0.6],[32,13,0.6],[32,14,0.6]]]
]
$商店随机 = true #商店买装备时出随机属性false
$战斗随机 = true #战斗后获得随机属性装备
def self.getname(paramsplus)
name = ""
paramsplus.is_a?(Array) ? paramsplus.each{|a| @temp = []; a[1].scan(/^[\u4e00-\u9fa5|\w]*|,[\u4e00-\u9fa5|\w]*/){|b| @temp.push b.gsub(","){}}; name += @temp[rand(@temp.size)]} : paramsplus[1].scan(/^[\u4e00-\u9fa5|\w]*|,[\u4e00-\u9fa5|\w]*/){|b| @temp = [] if @temp == nil ;@temp.push b.gsub(","){}}
name += @temp[rand(@temp.size)] if paramsplus.is_a?(Array) != true
name += "的"
end
def self.getluck #获得极品出现率
luck = 0
$game_party.all_members.each{|a| a.weapons.each{|a| luck += a.params[8] if a.params.size == 9};a.armors.each{|a| luck += a.params[8] if a.params.size == 9}}
luck
end
def self.getnewequip(xequip,params = nil) #提供两个参数 装备(RPG::Equip类下的)和附加前缀数,不填则为随机
return unless xequip.is_a?(RPG::EquipItem)
#xparamplus为前缀数
xequip.paramsplus = [] if xequip.paramsplus == nil
return if xequip.paramsplus.size >= @maxparamplus
params != nil ? xparamplus = params : xparamplus = rand(@maxparamplus * 105) / 100
xparamplus = xparamplus.to_int
return xequip if xparamplus == 0
equip = xequip.dup
paramsplus = equip.paramsplus.dup #无奈的方法,不这样改一个装备所有同父装备的装备都会变
newparams = equip.params.dup
newfeatures = equip.features.dup
aparamsplus = @paramsplus.collect{|a| [a[0] = @transpose[a[0]-1],a[1],a[2]]}.sort_by{|a| a[0]}
while paramsplus.size < xparamplus
temp = rand(aparamsplus[-1][0])
temp = [temp - getluck,0].max
x = []
for i in aparamsplus
x.push i if i[0] >= temp && paramsplus.include?(i) != true
end
if x != []
a = [(x.size-1)*100 - getluck,0].max
a = (rand(a)/100).to_int
paramsplus.push x[a]
end
end
equip.name = getname(paramsplus) + equip.name #更新名称
paramsplus.each{|a| equip.price += @transpose[a[0] - 1] * @moneyrate} #更新价格
paramsplus.select{|a| a[2].select{|a| a.size == 2}.each{|a| newparams[a[0]] += a[1]}} #更新属性
#以下为更新特性
features = []
paramsplus.each{|a| a[2].each{|a| features.push a if a.size == 3}}
|