本帖最后由 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
也可以改這樣..上面的是擁有該物品時不會掉落,這個是掉落過了不會再掉落..
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("超級藥水")這樣就可以 |