| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2019-4-2 |
| 在线时间 | 26 小时 |
- 梦石
- 0
- 星屑
- 55
- 在线时间
- 26 小时
- 注册时间
- 2011-1-7
- 回帖
- 5
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 radiational 于 2013-12-31 01:29 编辑
在這個腳本中
無法添加D以上禮物組
有辦法擴大嗎
[pre lang="ruby" line="1"]=begin
說明:
事件中執行腳本呼叫來獲取隨機物品
random_gift(group, number)
例:隨機獲得組:A中的三件物品: random_gift(:A, 3)
=end
class Game_Interpreter
Random_Gifts = { #隨機獎品列表
:A => [:i1, :i2, :i3, :w1, :w2, :a1, :a3], #i物品,w武器,每個組用逗號隔開
:B => [:i1_10, :w1_12, :a5_9], #這樣代表物品1~10,武器1~12,護甲5~9
:C => [:w1_60]
}
# 設置開關號碼,當開關開啟時一定會獲取到不同的幾件物品
# 設置為 nil 的話則總是有可能獲取到相同的物品
Diff_Gift_Swth = 1
def display_gift_text(name)
$game_message.add("獲得:" + name)
end
#
def random_gift(group, num)
gifts = []
Random_Gifts[group].each {|g|
g = g.to_s
type = g[0]=="i" ? 0 : g[0]=="w" ? 1 : 2
if g.include?("_")
a, b = g.scan(/\d+/)
for i in a.to_i..b.to_i
gift = which_random_gift(type)
gift ? gifts.push(gift) : (return report_random_gifts_crash(group, g))
end
else
g =~ /(\d+)/
gift = which_random_gift(type)[$1.to_i]
gift ? gifts.push(gift) : (return report_random_gifts_crash(group, g))
end
}
wait_for_message
if Diff_Gift_Swth && $game_switches[Diff_Gift_Swth]
gifts.sample(num).each {|g|
$game_party.gain_item(g, 1)
display_gift_text(g.name)
}
else
num.times {
g = gifts[rand(gifts.size)]
$game_party.gain_item(g, 1)
display_gift_text(g.name)
}
end
$game_message.face_name = ''
$game_message.face_index = 0
$game_message.background = 0
$game_message.position = 2
wait_for_message
end
#
def which_random_gift(type)
case type
when 0; $data_items
when 1; $data_weapons
when 2; $data_armors
end
end
#
def report_random_gifts_crash(group, g)
msgbox("隨機禮物發生錯誤:Group :#{group} Element :#{g}") if $TEST
end
end
[/pre] |
|