赞 | 0 |
VIP | 1 |
好人卡 | 0 |
积分 | 1 |
经验 | 3179 |
最后登录 | 2013-10-25 |
在线时间 | 140 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 66
- 在线时间
- 140 小时
- 注册时间
- 2012-2-6
- 帖子
- 384
|
6楼
楼主 |
发表于 2012-3-5 18:54:30
|
只看该作者
本帖最后由 杂兵天下 于 2012-3-5 23:06 编辑
- $imported = {} if $imported.nil?
- if $imported["RuntimeDB"].nil?
- $imported["RuntimeDB"] = true
- module DataManager
- class <<self
- alias make_save_contents_runtimedb_zabing make_save_contents
- alias extract_save_contents_runtimedb_zabing extract_save_contents
- end
- def self.make_save_contents
- contents = make_save_contents_runtimedb_zabing
- contents[:dataactorszabing] = $data_actors
- contents[:dataclasseszabing] = $data_classes
- contents[:dataskillszabing] = $data_skills
- contents[:dataitemszabing] = $data_items
- contents[:dataweaponszabing] = $data_weapons
- contents[:dataarmorszabing] = $data_armors
- contents[:dataenemieszabing] = $data_enemies
- contents[:datatroopszabing] = $data_troops
- contents[:datastateszabing] = $data_states
- contents[:dataanimationszabing] = $data_animations
- contents[:datatilesetszabing] = $data_tilesets
- contents[:datacommoneventszabing] = $data_common_events
- contents[:datasystemzabing] = $data_system
- contents[:datamapinfoszabing] = $data_mapinfos
- contents
- end
- def self.extract_save_contents(contents)
- extract_save_contents_runtimedb_zabing(contents)
- $data_actors = contents[:dataactorszabing]
- $data_classes = contents[:dataclasseszabing]
- $data_skills = contents[:dataskillszabing]
- $data_items = contents[:dataitemszabing]
- $data_weapons = contents[:dataweaponszabing]
- $data_armors = contents[:dataarmorszabing]
- $data_enemies = contents[:dataenemieszabing]
- $data_troops = contents[:datatroopszabing]
- $data_states = contents[:datastateszabing]
- $data_animations = contents[:dataanimationszabing]
- $data_tilesets = contents[:datatilesetszabing]
- $data_common_events = contents[:datacommoneventszabing]
- $data_system = contents[:datasystemzabing]
- $data_mapinfos = contents[:datamapinfoszabing]
- end
- end
- else
- msgbox "请不要重复加载脚本。"
- end
- $imported = {} if $imported.nil?
- if $imported["RatiosClov"].nil?
- #--------------------------------------------------------------------------
- # 多项比率选一(Ratios) By.Clov
- # 使用 Ratios.Co({对象=>比率},分比数)
- #--------------------------------------------------------------------------
- $imported["RatiosClov"] = true
- module Ratios
- def self.Co(data = {}, b = 100)
- r = rand b;n = data.keys;f = data.values;arr = [];mii = []
- f.each {|v| if v >= r;arr.push v;else;arr.push nil;end}
- unless arr.compact.empty?
- arr.each {|a|
- if a;mii.push a - rand(a) - r
- else;mii.push b;end}
- x = mii.index mii.min
- else
- x = f.index f.max
- end
- return [n[x],f[x]]
- end
- end
- else
- msgbox "请不要重复加载脚本。"
- end
- class Game_Interpreter
- def createweapon
- thishash = {
- ["龙神","晋库走龙剑,吴室荡燕雏。"]=>100,
- ["照胆","武丁在位五十九年,以元年岁次午铸一剑,长三
- 尺,铭曰‘照胆’,古文篆书。"]=>500,
- ["青霜","紫电青霜,王将军之武库。"]=>800,
- ["龙泉","章帝赐尚书剑,韩棱渊深有谋,故得龙泉剑。"]=>1000,
- ["磐郢","吴王得越所献宝剑三枚。一曰鱼肠,二曰磐郢,
- 三曰湛泸。"]=>50,
- ["淳钧","山崩而落洛之水涸,欧治子而淳钧之剑成。"]=>10,
- ["卧槽","卧槽泥马勒戈壁,兰州芝麻大烧饼。"]=>1000,
- }
-
- thathash = {}
- temp = RPG::BaseItem::Feature.new
- temp.code = 31
- temp.data_id = 1
- temp.value = 0
- thathash[temp]=100#100几率物理武器专精
- temp = RPG::BaseItem::Feature.new
- temp.code = 22
- temp.data_id = 0
- temp.value = 0.5
- thathash[temp]=50#50几率精准专精
- temp = RPG::BaseItem::Feature.new
- temp.code = 33
- temp.data_id = 0
- temp.value = 500
- thathash[temp]=25#25几率超速专精
- c = Ratios.Co(thathash)
- a = RPG::Weapon.new
- a.icon_index = 147
- a.animation_id = 7
- a.features = [c[0]]
- a.params = [0,0,0,0,0,0,0,0]
- a.etype_id = 0
- a.wtype_id = 1
- a.params[0] = rand(1000)
- a.params[1] = rand(50)
- a.params[2] = rand(150)
- a.params[3] = rand(100)
- a.params[4] = rand(100)
- a.params[5] = rand(100)
- a.params[6] = rand(100)
- a.params[7] = rand(100)
- a.price = 0
- for i in 0..7
- case i
- when 0
- a.price += a.params[i] * 100
- when 1
- a.price += a.params[i] * 2000
- when 2
- a.price += a.params[i] * 2000
- else
- a.price += a.params[i] * 1000
- end
- end
- a.price = a.price.to_i
- c = Ratios.Co(thishash)
- a.name = "价值"+a.price.to_s+"的"+c[0][0]+"剑"
- if c[0][0]=="卧槽"
- temp = RPG::BaseItem::Feature.new
- temp.code = 43
- temp.data_id = 24
- temp.value = 0.0
- a.features.push(temp)
- end
- a.description = c[0][1]
- a.id = $data_weapons.size
- $data_weapons[$data_weapons.size] = a.clone
- a=nil
- $game_party.gain_item($data_weapons[$data_weapons.size-1], 1, false)
- end
- end
复制代码 这是新版代码。请注意此版中,价格总是50的倍数,并且随着属性而改变。
所有的卧槽剑都会附加一个冥想技能。
运用这样的思路,可以制作此系统:
class Game_Interpreter def makeweapon(a,b,c,d,e,f,g,h,i) a = RPG::Weapon.new a.icon_index = a a.animation_id = b a.features = c a.params = d a.etype_id = e a.wtype_id = f a.price = g a.name = h a.description = i a.id = $data_weapons.size $data_weapons[$data_weapons.size] = a.clone a=nil $game_party.gain_item($data_weapons[$data_weapons.size-1], 1, false) end def mergeweapon(a,b) if $game_party.has_item?(a) if $game_party.has_item?(b) $game_party.lose_item(a, 1, false) $game_party.lose_item(b, 1, false) makeweapon(a.icon_index,a.animation_id,b.features,a.params,a.etype_id,a.wtype_id,a.price,a.name+"+"+b.name,a.description) end end end end
class Game_Interpreter
def makeweapon(a,b,c,d,e,f,g,h,i)
a = RPG::Weapon.new
a.icon_index = a
a.animation_id = b
a.features = c
a.params = d
a.etype_id = e
a.wtype_id = f
a.price = g
a.name = h
a.description = i
a.id = $data_weapons.size
$data_weapons[$data_weapons.size] = a.clone
a=nil
$game_party.gain_item($data_weapons[$data_weapons.size-1], 1, false)
end
def mergeweapon(a,b)
if $game_party.has_item?(a)
if $game_party.has_item?(b)
$game_party.lose_item(a, 1, false)
$game_party.lose_item(b, 1, false)
makeweapon(a.icon_index,a.animation_id,b.features,a.params,a.etype_id,a.wtype_id,a.price,a.name+"+"+b.name,a.description)
end
end
end
end
用mergeweapon($data_weapons[1],$data_weapons[18])这样来融合剑1与剑18。比如说剑1是属性高的龙泉剑,剑2是属性低的卧槽剑,为了得到冥想效果与高属性,可以用mergeweapon来操作。mergeweapon(龙泉的ID,卧槽的ID)。
如果结合Fomar的武器选择窗口脚本,效果更好。 |
|