Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # XAS - Multiple Treasure Drop
- # Version: 1.10
- # Author : LiTTleDRAgo
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- $imported ||= {}
- $imported[:drg_xas_multiple_treasure_drop] = 1.10
- if !$xrxs_xas
- raise "This script needs XAS to work"
- end
- #===============================================================================
- # ■ XAS_BA_ItemDrop
- #===============================================================================
- module XAS_BA_ItemDrop
- #--------------------------------------------------------------------------
- # ● Defeat Process
- #--------------------------------------------------------------------------
- def defeat_process
- super
- treasure = []
- if self.battler.is_a?(Game_Enemy) && self.battler.dead? &&
- $game_map.passable?(self.x, self.y,0) && terrain_tag != XAS::FALL_TERRAIN
- enemy = self.battler
- if rand(100) < enemy.treasure_prob and self.battler.steal == false
- treasure << $data_items[enemy.item_id] if enemy.item_id > 0
- treasure << $data_weapons[enemy.weapon_id] if enemy.weapon_id > 0
- treasure << $data_armors[enemy.armor_id] if enemy.armor_id > 0
- end
- make_treasure(treasure.pop) if treasure != []
- # Multi Drop
- tesouro = XAS_BA_ENEMY::ENEMY_MULTI_TREASURE[enemy.id]
- tesouro.each {|item_2treasure| next if item_2treasure.nil?
- type = item_2treasure[0].to_s.downcase
- id = item_2treasure[1]
- prob = item_2treasure[2]
- prob = prob.gsub('%') {''}.strip.to_i if prob.is_a?(String)
- if rand(100) < prob and self.battler.steal == false
- treasure << $data_items[id] if [0,'i','item'].include?(type)
- treasure << $data_weapons[id] if [1,'w','weapon'].include?(type)
- treasure << $data_armors[id] if [2,'a','armor'].include?(type)
- end } if tesouro != nil
- treasure.each {|s| make_multi_treasure(s)} if treasure != []
- end
- end
- #--------------------------------------------------------------------------
- # ● Make Multi Treasure
- #--------------------------------------------------------------------------
- def make_multi_treasure(t)
- opecode,list = t.is_a?(RPG::Item) ? 126 : t.is_a?(RPG::Weapon) ? 127 :
- t.is_a?(RPG::Armor) ? 128 : nil, []
- if opecode != nil
- number = XAS::ITEM_NUMBER[t.id]
- number = 1 unless number != nil and t.is_a?(RPG::Item)
- list[0] = RPG::EventCommand.new(opecode, 0, [t.id,0,0,number])
- list[1] = RPG::EventCommand.new(250, 0, [XAS::ITEMDROP_SE])
- list[2] = RPG::EventCommand.new(116, 0, [])
- end
- list << RPG::EventCommand.new
- command = RPG::MoveCommand.new
- route = RPG::MoveRoute.new
- page = RPG::Event::Page.new
- [command.code = 14, command.parameters = [0,0]]
- [route.repeat = false, route.list = [command, RPG::MoveCommand.new]]
- [page.move_type = 3, page.move_frequency = 6]
- [page.move_route = route, page.always_on_top = true]
- page.trigger, page.list, page.through = 1, list, true
- 100.times {
- @xy = [@x+[-1,0,1][rand(2)], @y+[-1,0,1][rand(2)],0]
- break if $game_map.passable?(*@xy) && $game_map.terrain_tag(*@xy[0..1]) != XAS::FALL_TERRAIN
- }
- event = RPG::Event.new(*@xy[0..1])
- event.pages = [page]
- token = Token_Event.new($game_map.map_id, event)
- token.treasure_time = 100 + (40 * MOG::XAS_ICON_ERASE_TIME)
- [token.icon_name = t.icon_name, token.direction_fix = true]
- [token.walk_anime = false, token.step_anime = false]
- $game_map.add_token(token)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement