赞 | 5 |
VIP | 359 |
好人卡 | 195 |
积分 | 3 |
经验 | 560179 |
最后登录 | 2024-5-17 |
在线时间 | 1373 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 275
- 在线时间
- 1373 小时
- 注册时间
- 2005-10-16
- 帖子
- 5113
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
- 说明:
- 1.因为本系统对RPG底层数据结构的改动非常大,对RGSS完全不了解者不建议采用本系统
- 2.因为同样的原因,本系统造成脚本冲突的可能性非常大
- 使用方法:
- 第一步,插入下列代码到Main以前:
- class Game_System
- attr_accessor :weapons
- alias sailcat_initialize initialize
- def initialize
- sailcat_initialize
- @weapons = [nil]
- end
- end
- class Game_Party
- def gain_weapon(weapon_id, n)
- if weapon_id > 0
- if n > 0
- weapon = RPG::Random_Weapon.new(weapon_id)
- weapon.id = $game_system.weapons.size
- $game_system.weapons.push(weapon)
- @weapons[weapon.id] = n
- end
- if n < 0
- @weapons[weapon_id] = [@weapons[weapon_id] + n, 0].max
- end
- elsif weapon_id < 0
- @weapons[-weapon_id] = [[@weapons[-weapon_id] + n, 0].max, 99].min
- end
- end
- end
- module RPG
- class Random_Weapon < Weapon
- attr_accessor :type
- attr_accessor :rarity
- attr_accessor :reqlevel
- def initialize(id)
- @type = id
- @name = $data_weapons[id].name
- @icon_name = $data_weapons[id].icon_name
- @description = $data_weapons[id].description
- @animation1_id = $data_weapons[id].animation1_id
- @animation2_id = $data_weapons[id].animation2_id
- @price = $data_weapons[id].price
- base_atk = $data_weapons[id].atk
- @atk = base_atk
- @pdef = $data_weapons[id].pdef
- @mdef = $data_weapons[id].mdef
- @str_plus = $data_weapons[id].str_plus
- @dex_plus = $data_weapons[id].dex_plus
- @agi_plus = $data_weapons[id].agi_plus
- @int_plus = $data_weapons[id].int_plus
- @element_set = $data_weapons[id].element_set
- @plus_state_set = $data_weapons[id].plus_state_set
- @minus_state_set = $data_weapons[id].minus_state_set
- @element_set.push(suffix)
- @minus_state_set.push(prefix)
- @reqlevel = 1
- case rand(256)
- when 0..31 # Low-Quality
- prefix = [99 - rand(4)]
- suffix = [101]
- @rarity = 0
- @name = $data_system.elements[prefix[0]] + " " + @name
- when 32..191 # Normal
- prefix = [101]
- suffix = [101]
- @rarity = 1
- when 192..223 # High-Quality
- prefix = [100]
- suffix = [101]
- @rarity = 2
- @name = $data_system.elements[prefix[0]] + " " + @name
- when 224..239 # Magic
- case rand(3)
- when 0
- prefix = [rand(40) + 102]
- suffix = [101]
- @name = $data_system.elements[prefix[0]] + " " + @name
- when 1
- prefix = [101]
- suffix = [rand(40) + 102]
- @name = @name + " of " + $data_states[suffix[0]].name
- when 2
- prefix = [rand(40) + 102]
- suffix = [rand(40) + 102]
- @name = $data_system.elements[prefix[0]] + " " + @name + " of " + $data_states[suffix[0]].name
- end
- @rarity = 3
- when 240..247 # Rare
- rname1 = rand(10) + 501
- rname2 = id * 2 + 501 + rand(2)
- prefix = []
- suffix = []
- case rand(10)
- when 0..1 # 3 affixes
- n = 1
- odd = true
- when 2..3 # 4 affixes
- n = 2
- odd = false
- when 4..6 # 5 affixes
- n = 2
- odd = true
- when 7..9 # 6 affixes
- n = 3
- odd = false
- end
- n.times do
- prefix.push(rand(40) + 102)
- suffix.push(rand(40) + 102)
- end
- if odd
- if rand(2) == 1
- prefix.push(rand(40) + 102)
- else
- suffix.push(rand(40) + 102)
- end
- end
- @rarity = 4
- @name = $data_system.elements[rname1] + " " + $data_states[rname2].name + " " + @name
- when 248..253 # Set
- sname = id + 801
- prefix = [sname]
- suffix = [101]
- @name = $data_system.elements[sname] + " " + @name
- @rarity = 5
- when 254..255 # Unique
- prefix = [101]
- uname = id + 801
- suffix = [uname]
- @name = $data_states[uname].name + " " + @name
- @rarity = 6
- end
- for i in prefix
- modify_weapon_prefix(i)
- end
- for j in suffix
- modify_weapon_suffix(j)
- end
- end
- def modify_weapon_prefix(prefix)
- case prefix
- when 96
- @atk -= base_atk * (31 + rand(10)) / 100 + 1
- when 97
- @atk -= base_atk * (21 + rand(10)) / 100 + 1
- when 98
- @atk -= base_atk * (11 + rand(10)) / 100 + 1
- when 99
- @atk -= base_atk * (1 + rand(10)) / 100 + 1
- when 100
- @atk += base_atk * (1 + rand(15)) / 100 + 1
- when 101
- @atk = base_atk
- when 102
- @atk += base_atk * (10 + rand(11)) / 100 + 1
- @reqlevel = [@reqlevel, 1].max
- when 103
- @atk += base_atk * (21 + rand(10)) / 100 + 1
- @reqlevel = [@reqlevel, 5].max
- when 104
- @atk += base_atk * (31 + rand(10)) / 100 + 1
- @reqlevel = [@reqlevel, 8].max
- when 105
- @atk += base_atk * (41 + rand(10)) / 100 + 1
- @reqlevel = [@reqlevel, 14].max
- when 106
- @atk += base_atk * (51 + rand(15)) / 100 + 1
- @reqlevel = [@reqlevel, 20].max
- when 107
- @atk += base_atk * (66 + rand(15)) / 100 + 1
- @reqlevel = [@reqlevel, 26].max
- when 108
- @atk += base_atk * (81 + rand(20)) / 100 + 1
- @reqlevel = [@reqlevel, 32].max
- when 109
- @atk += base_atk * (101 + rand(100)) / 100 + 1
- @reqlevel = [@reqlevel, 41].max
- when 110
- @atk += base_atk * (201 + rand(100)) / 100 + 1
- @reqlevel = [@reqlevel, 51].max
- if @rarity == 4
- @reqlevel = [@reqlevel, 56].max
- end
- when 111
- end
- end
- def modify_weapon_suffix(suffix)
- case suffix
- when 101
- @reqlevel = 1
- when 102
- @str_plus += rand(2) + 1
- @reqlevel = [@reqlevel, 1].max
- when 103
- @str_plus += rand(3) + 3
- @reqlevel = [@reqlevel, 10].max
- when 104
- @str_plus += rand(4) + 6
- @reqlevel = [@reqlevel, 26].max
- when 105
- @str_plus += rand(6) + 10
- @reqlevel = [@reqlevel, 42].max
- when 106
- @str_plus += rand(5) + 16
- @reqlevel = [@reqlevel, 58].max
- when 107
- @str_plus += rand(10) + 21
- @reqlevel = [@reqlevel, 71].max
- when 108
- end
- end
- end
- end
- 第二步: 修改所插入代码中的modify_weapon_prefix和modify_weapon_suffix两个方法的内容
- 通过你需要的效果更改相应的武器属性,如
- 攻击力: @atk
- 防御力: @pdef
- 魔防力: @mdef
- 力/灵/速/魔加成: @str_plus/@dex_plus/@agi_plus/@int_plus
- 价格: @price
- 武器属性: @element_set (用push/delete方法增减)
- 武器状态: @plus_state_set/@minus_state_set(用push/delete方法增减)
- 第三步: 设定数据库
- 在武器设定里,只写武器的基本名称
- 在状态设定里,从102编号开始,填写魔法类武器的后辍名,从501编号开始,填写稀有类武器的后辍名,从802编号开始,填写无双类武器的后辍名(从802开始须与数据库的基本名称一一对应)
- 在系统设定-属性里,从96-99编号填写低品质武器的前辍名,100号填写强化武器的前辍名,101留白,102开始填魔法类武器的前辍名,501开始填稀有类武器的前辍名,802开始填套装类武器的前辍名(从802开始须与数据库的基本名称一一对应)
- 第四步: 修改原有系统脚本
- 在Game_Actor定义部分
- 1.全局搜索 $data_weapons,替换为$game_system.weapons
- 2.修改装备可能判定
- def equippable?(item)
- ....
- if $data_classes[@class_id].weapon_set.include?(item.type)
- ....
- end
- 3. 修改更改装备方法
- def equip(equip_type, id)
- case equip_type
- when 0 # 武器
- if id == 0 or $game_party.weapon_number(id) > 0
- $game_party.gain_weapon(-@weapon_id, 1)
- @weapon_id = id
- $game_party.lose_weapon(id, 1)
- end
- ....
- 在Window_Item, Window_Status, Window_EquipItem, Window_EquipRight四个定义中
- 全局搜索$data_weapons,替换为$game_system.weapons
- 将Window_EquipItem第41行改为
- if $game_party.weapon_number(i) > 0 and weapon_set.include?($game_system.weapons[i].type)
- 第五步: 调用方法
- 使用事件"增减装备"来获得武器,武器的编号为数据库的编号
- 例如: 增减装备, 1.剑, 1
- 这样就会随机产生一把剑并获取之
- 不建议使用事件"增减装备"来失去武器
- 要失去武器时,可事件调用脚本
- $game_party.lose_item(weapon.id, 数量)
- (weapon请预先定义为你持有的某一件具体武器)
- 备注:系统生成的装备类型概率
- 1/8 - 低品质武器
- 1/16 - 强化品质武器
- 1/16 - 魔法类武器
- 1/32 - 稀有类武器
- 1/64 - 套装类武器
- 1/128 - 无双类武器
- 其余为一般的武器
- 追加的武器公共定义,以下可以按自己需要在相关脚本中调用:
- @type: 武器的原本类型,主要是判断能不能装备
- @rarity: 武器的稀有度,可以配合道具颜色脚本进行颜色显示控制
- @reqlevel: 武器的需要等级,可以用在判定是否能装备该武器上(该Demo脚本没有加这个判定)
复制代码 |
|