class Game_Enemy < Game_Battler
alias :drop_item_rate_20241029 :drop_item_rate
def drop_item_rate
return 1000 if $game_switches[开关编号]
return drop_item_rate_20241029
end
end
比如$game_switches[29]那么当29号开关打开时就会必定掉落了
要是你只是想,只有当前在某几个敌群时,某种敌人的某一样物品,才会必定掉落的话,那就是以下的写法
class Game_Troop < Game_Unit
attr_reader :troop_id
end
class Game_Enemy < Game_Battler
alias :make_drop_items_20241019 :make_drop_items
def make_drop_items
r = make_drop_items_20241019; s = $game_switches[开关编号]
t = $game_troop.troop_id; e = @enemy_id; i = $data_items[13]
r.push(i) if s && [2, 3, 5, 8].include?(t) && e == 1 && !r.include?(i)
return r
end
end