设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 13321|回复: 13
打印 上一主题 下一主题

[RMVA发布] 【VA】铸剑系统

[复制链接]

Lv1.梦旅人

梦石
0
星屑
66
在线时间
140 小时
注册时间
2012-2-6
帖子
384
跳转到指定楼层
1
发表于 2012-3-5 11:36:52 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 feizhaodan 于 2012-12-1 09:42 编辑

使用的随机系统是从http://rpg.blue/thread-224387-1-1.html里拿到的
其实我做此系统本身就是因为看到上面的帖子,想起很久之前看到的柳柳XP版随机铸剑系统做的。
不过柳柳那个系统有很大的错误,用xp的朋友也不要去翻找了,反正有极大的BUG你也用不了。
代码在6楼。
会从三个特性中选一个,七种古剑中选一个。
其他属性均为随机生成。事件脚本createweapon调用。调用后自动获得生成的古剑。


更新:
  1. $imported = {} if $imported.nil?
  2. if $imported["RuntimeDB"].nil?
  3.   $imported["RuntimeDB"] = true
  4.   module DataManager
  5.     class <<self
  6.       alias make_save_contents_runtimedb_zabing make_save_contents
  7.       alias extract_save_contents_runtimedb_zabing extract_save_contents
  8.     end
  9.     def self.make_save_contents
  10.       contents = make_save_contents_runtimedb_zabing
  11.       contents[:dataactorszabing] = $data_actors
  12.       contents[:dataclasseszabing] = $data_classes
  13.       contents[:dataskillszabing] = $data_skills
  14.       contents[:dataitemszabing] = $data_items
  15.       contents[:dataweaponszabing] = $data_weapons
  16.       contents[:dataarmorszabing] = $data_armors
  17.       contents[:dataenemieszabing] = $data_enemies
  18.       contents[:datatroopszabing] = $data_troops
  19.       contents[:datastateszabing] = $data_states
  20.       contents[:dataanimationszabing] = $data_animations
  21.       contents[:datatilesetszabing] = $data_tilesets
  22.       contents[:datacommoneventszabing] = $data_common_events
  23.       contents[:datasystemzabing] = $data_system
  24.       contents[:datamapinfoszabing] = $data_mapinfos
  25.       contents
  26.     end
  27.     def self.extract_save_contents(contents)
  28.       extract_save_contents_runtimedb_zabing(contents)
  29.       $data_actors = contents[:dataactorszabing]
  30.       $data_classes = contents[:dataclasseszabing]
  31.       $data_skills = contents[:dataskillszabing]
  32.       $data_items = contents[:dataitemszabing]
  33.       $data_weapons = contents[:dataweaponszabing]
  34.       $data_armors = contents[:dataarmorszabing]
  35.       $data_enemies = contents[:dataenemieszabing]
  36.       $data_troops = contents[:datatroopszabing]
  37.       $data_states = contents[:datastateszabing]
  38.       $data_animations = contents[:dataanimationszabing]
  39.       $data_tilesets = contents[:datatilesetszabing]
  40.       $data_common_events = contents[:datacommoneventszabing]
  41.       $data_system = contents[:datasystemzabing]
  42.       $data_mapinfos = contents[:datamapinfoszabing]
  43.     end
  44.   end
  45. else
  46.   msgbox "请不要重复加载脚本。"
  47. end
  48. $imported = {} if $imported.nil?
  49. if $imported["RatiosClov"].nil?
  50. #--------------------------------------------------------------------------
  51. # 多项比率选一(Ratios) By.Clov
  52. # 使用 Ratios.Co({对象=>比率},分比数)
  53. #--------------------------------------------------------------------------
  54.   $imported["RatiosClov"] = true  
  55.   module Ratios
  56.     def self.Co(data = {}, b = 100)
  57.       r = rand b;n = data.keys;f = data.values;arr = [];mii = []
  58.       f.each {|v| if v >= r;arr.push v;else;arr.push nil;end}
  59.       unless arr.compact.empty?
  60.         arr.each {|a|
  61.         if a;mii.push a - rand(a) - r
  62.         else;mii.push b;end}
  63.         x = mii.index mii.min
  64.       else
  65.         x = f.index f.max
  66.       end
  67.       return [n[x],f[x]]
  68.     end
  69.   end
  70. else
  71.   msgbox "请不要重复加载脚本。"
  72. end
  73. class Game_Interpreter
  74.   def createweapon
  75.     thishash = {
  76.     ["龙神","晋库走龙剑,吴室荡燕雏。"]=>100,
  77.     ["照胆","武丁在位五十九年,以元年岁次午铸一剑,长三
  78. 尺,铭曰‘照胆’,古文篆书。"]=>500,
  79.     ["青霜","紫电青霜,王将军之武库。"]=>800,
  80.     ["龙泉","章帝赐尚书剑,韩棱渊深有谋,故得龙泉剑。"]=>1000,
  81.     ["磐郢","吴王得越所献宝剑三枚。一曰鱼肠,二曰磐郢,
  82. 三曰湛泸。"]=>50,
  83.     ["淳钧","山崩而落洛之水涸,欧治子而淳钧之剑成。"]=>10,
  84.     ["卧槽","卧槽泥马勒戈壁,兰州芝麻大烧饼。"]=>1000,
  85. }

  86.     thathash = {}
  87.     temp = RPG::BaseItem::Feature.new
  88.     temp.code = 31
  89.     temp.data_id = 1
  90.     temp.value = 0
  91.     thathash[temp]=100#100几率物理武器专精
  92.     temp = RPG::BaseItem::Feature.new
  93.     temp.code = 22
  94.     temp.data_id = 0
  95.     temp.value = 0.5
  96.     thathash[temp]=50#50几率精准专精
  97.     temp = RPG::BaseItem::Feature.new
  98.     temp.code = 33
  99.     temp.data_id = 0
  100.     temp.value = 500
  101.     thathash[temp]=25#25几率超速专精
  102.     c = Ratios.Co(thathash)
  103.     a = RPG::Weapon.new
  104.     a.icon_index = 147
  105.     a.animation_id = 7
  106.     a.features = [c[0]]
  107.     a.params = [0,0,0,0,0,0,0,0]
  108.     a.etype_id = 0
  109.     a.wtype_id = 1
  110.     a.params[0] = rand(1000)
  111.     a.params[1] = rand(50)
  112.     a.params[2] = rand(150)
  113.     a.params[3] = rand(100)
  114.     a.params[4] = rand(100)
  115.     a.params[5] = rand(100)
  116.     a.params[6] = rand(100)
  117.     a.params[7] = rand(100)
  118.     a.price = 0
  119.     for i in 0..7
  120.       case i
  121.       when 0
  122.         a.price += a.params[i] * 100
  123.       when 1
  124.         a.price += a.params[i] * 2000
  125.       when 2
  126.         a.price += a.params[i] * 2000
  127.       else
  128.         a.price += a.params[i] * 1000
  129.       end
  130.     end
  131.     a.price = a.price.to_i
  132.     c = Ratios.Co(thishash)
  133.     a.name = "价值"+a.price.to_s+"的"+c[0][0]+"剑"
  134.     if c[0][0]=="卧槽"
  135.       temp = RPG::BaseItem::Feature.new
  136.       temp.code = 43
  137.       temp.data_id = 24
  138.       temp.value = 0.0
  139.       a.features.push(temp)
  140.     end
  141.     a.description = c[0][1]
  142.     a.id = $data_weapons.size
  143.     $data_weapons[$data_weapons.size] = a.clone
  144.     a=nil
  145.     $game_party.gain_item($data_weapons[$data_weapons.size-1], 1, false)
  146.   end
  147. end
复制代码
这是新版代码。请注意此版中,价格总是50的倍数,并且随着属性而改变。
所有的卧槽剑都会附加一个冥想技能。
运用这样的思路,可以制作此系统:
RUBY 代码复制
  1. class Game_Interpreter
  2.   def makeweapon(a,b,c,d,e,f,g,h,i)
  3.     a = RPG::Weapon.new
  4.     a.icon_index = a
  5.     a.animation_id = b
  6.     a.features = c
  7.     a.params = d
  8.     a.etype_id = e
  9.     a.wtype_id = f
  10.     a.price = g
  11.     a.name = h
  12.     a.description = i
  13.     a.id = $data_weapons.size
  14.     $data_weapons[$data_weapons.size] = a.clone
  15.     a=nil
  16.     $game_party.gain_item($data_weapons[$data_weapons.size-1], 1, false)
  17.   end
  18.   def mergeweapon(a,b)
  19.     if $game_party.has_item?(a)
  20.       if $game_party.has_item?(b)
  21.         $game_party.lose_item(a, 1, false)
  22.         $game_party.lose_item(b, 1, false)
  23. 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)
  24.       end
  25.     end
  26.   end
  27. end

用mergeweapon($data_weapons[1],$data_weapons[18])这样来融合剑1与剑18。比如说剑1是属性高的龙泉剑,剑2是属性低的卧槽剑,为了得到冥想效果与高属性,可以用mergeweapon来操作。mergeweapon(龙泉的ID,卧槽的ID)。
如果结合Fomar的武器选择窗口脚本,效果更好。

评分

参与人数 1星屑 +600 收起 理由
忧雪の伤 + 600 ……

查看全部评分

签名是什么?可以吃么?

Lv1.梦旅人

梦石
0
星屑
108
在线时间
1006 小时
注册时间
2008-11-9
帖子
1658
2
发表于 2012-3-5 16:38:22 | 只看该作者
本帖最后由 判约之轮 于 2012-3-5 16:38 编辑

这么有扩展性的脚本居然没人理会?
果断收下研究一下~
看代码似乎是可以把空着的武器设置栏位充分利用起来?
但愿和其他脚本不会有冲突嗯~

哈希表大爱,那就意味着可以自由修改增加项目了~

点评

恩,即便你用满999个武器也不会有冲突,放心。  发表于 2012-3-5 18:37
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
334 小时
注册时间
2011-10-21
帖子
413
3
发表于 2012-3-5 17:07:21 | 只看该作者
本帖最后由 消失的三千 于 2012-3-5 18:43 编辑

里面的道具名字与说明也太碉堡了吧= =
不过为何不要重复加载脚本啊?

点评

恩,我这就去补上。  发表于 2012-3-5 18:38
我是活着的死人哦
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
182 小时
注册时间
2012-2-11
帖子
233
4
发表于 2012-3-5 17:14:30 | 只看该作者
为什么不允许重复加载脚本?
如果重复加载,会有什么问题?

点评

把前一个武器覆盖??因为我的ScriptManager是通过重复加载脚本来激活/取消脚本功能的。所以比较关注这个限制。  发表于 2012-3-6 22:26
如果出现了重复加载的问题,那么请删除一些脚本。 由于某些别的地方可能也要保存数据库 这样可以减少冲突  发表于 2012-3-5 18:38
RGSS3还没看到内部函数的部分,不过推测是可能会把前一个武器覆盖掉?各种不确定~  发表于 2012-3-5 17:50
回复 支持 反对

使用道具 举报

菜鸟飞呀飞 该用户已被删除
5
发表于 2012-3-5 18:39:31 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
66
在线时间
140 小时
注册时间
2012-2-6
帖子
384
6
 楼主| 发表于 2012-3-5 18:54:30 | 只看该作者
本帖最后由 杂兵天下 于 2012-3-5 23:06 编辑
  1. $imported = {} if $imported.nil?
  2. if $imported["RuntimeDB"].nil?
  3.   $imported["RuntimeDB"] = true
  4.   module DataManager
  5.     class <<self
  6.       alias make_save_contents_runtimedb_zabing make_save_contents
  7.       alias extract_save_contents_runtimedb_zabing extract_save_contents
  8.     end
  9.     def self.make_save_contents
  10.       contents = make_save_contents_runtimedb_zabing
  11.       contents[:dataactorszabing] = $data_actors
  12.       contents[:dataclasseszabing] = $data_classes
  13.       contents[:dataskillszabing] = $data_skills
  14.       contents[:dataitemszabing] = $data_items
  15.       contents[:dataweaponszabing] = $data_weapons
  16.       contents[:dataarmorszabing] = $data_armors
  17.       contents[:dataenemieszabing] = $data_enemies
  18.       contents[:datatroopszabing] = $data_troops
  19.       contents[:datastateszabing] = $data_states
  20.       contents[:dataanimationszabing] = $data_animations
  21.       contents[:datatilesetszabing] = $data_tilesets
  22.       contents[:datacommoneventszabing] = $data_common_events
  23.       contents[:datasystemzabing] = $data_system
  24.       contents[:datamapinfoszabing] = $data_mapinfos
  25.       contents
  26.     end
  27.     def self.extract_save_contents(contents)
  28.       extract_save_contents_runtimedb_zabing(contents)
  29.       $data_actors = contents[:dataactorszabing]
  30.       $data_classes = contents[:dataclasseszabing]
  31.       $data_skills = contents[:dataskillszabing]
  32.       $data_items = contents[:dataitemszabing]
  33.       $data_weapons = contents[:dataweaponszabing]
  34.       $data_armors = contents[:dataarmorszabing]
  35.       $data_enemies = contents[:dataenemieszabing]
  36.       $data_troops = contents[:datatroopszabing]
  37.       $data_states = contents[:datastateszabing]
  38.       $data_animations = contents[:dataanimationszabing]
  39.       $data_tilesets = contents[:datatilesetszabing]
  40.       $data_common_events = contents[:datacommoneventszabing]
  41.       $data_system = contents[:datasystemzabing]
  42.       $data_mapinfos = contents[:datamapinfoszabing]
  43.     end
  44.   end
  45. else
  46.   msgbox "请不要重复加载脚本。"
  47. end
  48. $imported = {} if $imported.nil?
  49. if $imported["RatiosClov"].nil?
  50. #--------------------------------------------------------------------------
  51. # 多项比率选一(Ratios) By.Clov
  52. # 使用 Ratios.Co({对象=>比率},分比数)
  53. #--------------------------------------------------------------------------
  54.   $imported["RatiosClov"] = true  
  55.   module Ratios
  56.     def self.Co(data = {}, b = 100)
  57.       r = rand b;n = data.keys;f = data.values;arr = [];mii = []
  58.       f.each {|v| if v >= r;arr.push v;else;arr.push nil;end}
  59.       unless arr.compact.empty?
  60.         arr.each {|a|
  61.         if a;mii.push a - rand(a) - r
  62.         else;mii.push b;end}
  63.         x = mii.index mii.min
  64.       else
  65.         x = f.index f.max
  66.       end
  67.       return [n[x],f[x]]
  68.     end
  69.   end
  70. else
  71.   msgbox "请不要重复加载脚本。"
  72. end
  73. class Game_Interpreter
  74.   def createweapon
  75.     thishash = {
  76.     ["龙神","晋库走龙剑,吴室荡燕雏。"]=>100,
  77.     ["照胆","武丁在位五十九年,以元年岁次午铸一剑,长三
  78. 尺,铭曰‘照胆’,古文篆书。"]=>500,
  79.     ["青霜","紫电青霜,王将军之武库。"]=>800,
  80.     ["龙泉","章帝赐尚书剑,韩棱渊深有谋,故得龙泉剑。"]=>1000,
  81.     ["磐郢","吴王得越所献宝剑三枚。一曰鱼肠,二曰磐郢,
  82. 三曰湛泸。"]=>50,
  83.     ["淳钧","山崩而落洛之水涸,欧治子而淳钧之剑成。"]=>10,
  84.     ["卧槽","卧槽泥马勒戈壁,兰州芝麻大烧饼。"]=>1000,
  85. }

  86.     thathash = {}
  87.     temp = RPG::BaseItem::Feature.new
  88.     temp.code = 31
  89.     temp.data_id = 1
  90.     temp.value = 0
  91.     thathash[temp]=100#100几率物理武器专精
  92.     temp = RPG::BaseItem::Feature.new
  93.     temp.code = 22
  94.     temp.data_id = 0
  95.     temp.value = 0.5
  96.     thathash[temp]=50#50几率精准专精
  97.     temp = RPG::BaseItem::Feature.new
  98.     temp.code = 33
  99.     temp.data_id = 0
  100.     temp.value = 500
  101.     thathash[temp]=25#25几率超速专精
  102.     c = Ratios.Co(thathash)
  103.     a = RPG::Weapon.new
  104.     a.icon_index = 147
  105.     a.animation_id = 7
  106.     a.features = [c[0]]
  107.     a.params = [0,0,0,0,0,0,0,0]
  108.     a.etype_id = 0
  109.     a.wtype_id = 1
  110.     a.params[0] = rand(1000)
  111.     a.params[1] = rand(50)
  112.     a.params[2] = rand(150)
  113.     a.params[3] = rand(100)
  114.     a.params[4] = rand(100)
  115.     a.params[5] = rand(100)
  116.     a.params[6] = rand(100)
  117.     a.params[7] = rand(100)
  118.     a.price = 0
  119.     for i in 0..7
  120.       case i
  121.       when 0
  122.         a.price += a.params[i] * 100
  123.       when 1
  124.         a.price += a.params[i] * 2000
  125.       when 2
  126.         a.price += a.params[i] * 2000
  127.       else
  128.         a.price += a.params[i] * 1000
  129.       end
  130.     end
  131.     a.price = a.price.to_i
  132.     c = Ratios.Co(thishash)
  133.     a.name = "价值"+a.price.to_s+"的"+c[0][0]+"剑"
  134.     if c[0][0]=="卧槽"
  135.       temp = RPG::BaseItem::Feature.new
  136.       temp.code = 43
  137.       temp.data_id = 24
  138.       temp.value = 0.0
  139.       a.features.push(temp)
  140.     end
  141.     a.description = c[0][1]
  142.     a.id = $data_weapons.size
  143.     $data_weapons[$data_weapons.size] = a.clone
  144.     a=nil
  145.     $game_party.gain_item($data_weapons[$data_weapons.size-1], 1, false)
  146.   end
  147. end
复制代码
这是新版代码。请注意此版中,价格总是50的倍数,并且随着属性而改变。
所有的卧槽剑都会附加一个冥想技能。
运用这样的思路,可以制作此系统:
RUBY 代码复制
  1. class Game_Interpreter
  2.   def makeweapon(a,b,c,d,e,f,g,h,i)
  3.     a = RPG::Weapon.new
  4.     a.icon_index = a
  5.     a.animation_id = b
  6.     a.features = c
  7.     a.params = d
  8.     a.etype_id = e
  9.     a.wtype_id = f
  10.     a.price = g
  11.     a.name = h
  12.     a.description = i
  13.     a.id = $data_weapons.size
  14.     $data_weapons[$data_weapons.size] = a.clone
  15.     a=nil
  16.     $game_party.gain_item($data_weapons[$data_weapons.size-1], 1, false)
  17.   end
  18.   def mergeweapon(a,b)
  19.     if $game_party.has_item?(a)
  20.       if $game_party.has_item?(b)
  21.         $game_party.lose_item(a, 1, false)
  22.         $game_party.lose_item(b, 1, false)
  23. 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)
  24.       end
  25.     end
  26.   end
  27. end

用mergeweapon($data_weapons[1],$data_weapons[18])这样来融合剑1与剑18。比如说剑1是属性高的龙泉剑,剑2是属性低的卧槽剑,为了得到冥想效果与高属性,可以用mergeweapon来操作。mergeweapon(龙泉的ID,卧槽的ID)。
如果结合Fomar的武器选择窗口脚本,效果更好。

点评

UI> 放到主楼会死么  发表于 2012-7-16 13:27
签名是什么?可以吃么?
回复 支持 反对

使用道具 举报

Lv3.寻梦者

护国公

梦石
0
星屑
1831
在线时间
2023 小时
注册时间
2005-10-21
帖子
560
7
发表于 2012-3-6 14:50:16 | 只看该作者
感觉挺棒的,做个可以下载的范例吧。

点评

范例。。。 这个系统完全不需要任何设置就可以运行 所以不需要范例。  发表于 2012-3-6 14:59
[IMG][/IMG] ================================== 寂寥宁静雅致之心 ================================== mahoro-matic mirclecompany http://www.mday.com.cn/
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
30 小时
注册时间
2012-2-24
帖子
18
8
发表于 2012-3-17 15:47:28 | 只看该作者
我喜欢LZ起的威武剑名,可我是小白啊。求LZ弄个范例,让我知道具体的操作啊。拜谢!!!

点评

威武的贱名是六柳先生起的名字。请注意保护作者版权,谢谢。  发表于 2012-3-17 18:37
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
28 小时
注册时间
2012-7-12
帖子
41
9
发表于 2012-7-13 21:42:48 | 只看该作者
小白  请教一下,这个系统,添加进去了,但是怎么使用选项把他呼出来?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
20 小时
注册时间
2015-1-4
帖子
5
10
发表于 2015-1-10 21:52:48 | 只看该作者
谢谢,好东西
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-26 10:45

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表