Project1
标题: 关于物品掉落问题 [打印本页]
作者: yl51379 时间: 2015-6-11 13:34
标题: 关于物品掉落问题
我想请教一下 比如我设定了某一种怪物身上 某一件物品掉落的几率是10%
可是我想在这件物品获得以后 就不会再重复获得了
该要如何设定了 需要用到事件分歧嘛?
作者: howhow1314 时间: 2015-6-11 13:48
本帖最后由 howhow1314 于 2015-6-11 15:15 编辑
module BattleManager
Kfc = ["超級藥水","魔液"]
def self.gain_drop_items
$game_troop.make_drop_items.each do |item|
unless $game_party.has_item?(item) && Kfc.include?(item.name)
$game_party.gain_item(item, 1)
$game_message.add(sprintf(Vocab::ObtainItem, item.name))
end
end
wait_for_message
end
end
module BattleManager
Kfc = ["超級藥水","魔液"]
def self.gain_drop_items
$game_troop.make_drop_items.each do |item|
unless $game_party.has_item?(item) && Kfc.include?(item.name)
$game_party.gain_item(item, 1)
$game_message.add(sprintf(Vocab::ObtainItem, item.name))
end
end
wait_for_message
end
end
[line]10[/line]
也可以改這樣..上面的是擁有該物品時不會掉落,這個是掉落過了不會再掉落..
module BattleManager
Kfc = ["超級藥水","魔液"]
def self.gain_drop_items
$game_troop.make_drop_items.each do |item|
unless $game_party.kfc.include?(item.name)
$game_party.kfc.push(item.name) if Kfc.include?(item.name)
$game_party.gain_item(item, 1)
$game_message.add(sprintf(Vocab::ObtainItem, item.name))
end
end
wait_for_message
end
end
class Game_Party
def kfc
@kfc ||= []
end
end
module BattleManager
Kfc = ["超級藥水","魔液"]
def self.gain_drop_items
$game_troop.make_drop_items.each do |item|
unless $game_party.kfc.include?(item.name)
$game_party.kfc.push(item.name) if Kfc.include?(item.name)
$game_party.gain_item(item, 1)
$game_message.add(sprintf(Vocab::ObtainItem, item.name))
end
end
wait_for_message
end
end
class Game_Party
def kfc
@kfc ||= []
end
end
想再次掉落的話$game_party.kfc.delete("超級藥水")這樣就可以
欢迎光临 Project1 (https://rpg.blue/) |
Powered by Discuz! X3.1 |