#============================================================================== # ■ RGSS2&3兼用 ドロップチェック Ver1.00 by 星潟 #------------------------------------------------------------------------------ # 直近の勝利した戦闘のドロップアイテムの内容を保存し # 各アイテムの入手数を取得出来ます。 #============================================================================== # 変数の操作やイベントコマンドのスクリプト等で使用します。 #------------------------------------------------------------------------------ # drop_check(type,id) # # typeに0〜2の数字(0がアイテム、1が武器、2が防具)、idにアイテムIDが入ります。 # 指定したアイテムのドロップ数を返します。 #------------------------------------------------------------------------------ # 例1.drop_check(0,10) # # アイテムID10をいくつドロップしたかを取得。 #------------------------------------------------------------------------------ # 例2.drop_check(1,20) # # 武器ID20をいくつドロップしたかを取得。 #------------------------------------------------------------------------------ # 例3.drop_check(2,30) # # 防具ID30をいくつドロップしたかを取得。 #============================================================================== class Game_Party attr_accessor :last_drops #-------------------------------------------------------------------------- # ドロップチェック #-------------------------------------------------------------------------- def drop_check(type,id) return 0 unless @last_drops i = a_for_drop_check(type)[id] return 0 unless i (@last_drops.select {|d| d == i}).size end #-------------------------------------------------------------------------- # ドロップチェック用アイテム配列 #-------------------------------------------------------------------------- def a_for_drop_check(type) case type when 0;$data_items when 1;$data_weapons when 2;$data_armors else;[] end end end class Game_Troop < Game_Unit #-------------------------------------------------------------------------- # ドロップアイテムの配列作成 #-------------------------------------------------------------------------- alias make_drop_items_temp_preserve make_drop_items def make_drop_items a = make_drop_items_temp_preserve $game_party.last_drops = a a end end class Game_Interpreter #-------------------------------------------------------------------------- # ドロップチェック #-------------------------------------------------------------------------- def drop_check(type,id) $game_party.drop_check(type,id) end end