Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- J Fix-tha-dropz
- v1.1
- ::::Cleaned up script a bit
- v1.0
- ::::Initial script-modification.
- Stand alone fix for the drops-issue that XAS for VX Ace has(only dropping 1).
- Also adds in multiple drops, courtesy Yanfly.
- This does rewrite the damage to always use the draw_text function instead of
- picture formatting.
- $j_items and $j_names are temporary global variables.
- These will eventually be replaced when I find a way to get this info cross-class.
- (read: I get better at scripting/programming)
- =end
- # This is the very tiny customization module!
- #=======================================================#
- module J #
- module XAS #
- #
- # Text color used for healing damage pops #
- HEAL_FONT_COLOR = Color.new(150, 255, 150) #
- #
- # BETA; This enables an enemy that drops multiple items #
- # to scatter them in random places around where the #
- # enemy died. Currently, it can drop them on unpassable #
- # terrain, use at your own risk! (until I fix) #
- DROP_ARRANGEMENT = false #
- #
- end #
- end #
- #=======================================================#
- $imported = {} if $imported.nil?
- class Sprite_Base < Sprite
- include XAS_DAMAGE_POP
- include XAS_BA_ItemDrop
- alias j_xas_alt_damage damage
- def damage(value, type = "")
- dispose_damage
- @damage_ox = 0
- @damage_type = type
- damage_string = value.to_s
- #Dynamically draws the invisible bitmap for writing onto with the item's effects.
- h = 40
- count = $j_names + $j_items
- for i in count
- h += 24
- end
- bitmap = Bitmap.new(160, h)
- #Draws all the details regarding what the text looks like based on the content.
- bitmap.font.name = DAMAGE_FONT_NAME
- bitmap.font.size = DAMAGE_FONT_SIZE
- bitmap.font.bold = DAMAGE_FONT_BOLD
- bitmap.font.italic = DAMAGE_FONT_ITALIC
- bitmap.font.color = Color.new(0,0,0)
- case @damage_type
- when "Exp"; string_color = DAMAGE_EXP_FONT_COLOR
- when "Gold"; string_color = DAMAGE_GOLD_FONT_COLOR
- when "Item"; string_color = DAMAGE_ITEM_FONT_COLOR
- #=============================================================================== ========#
- # Parry is an NEW additional function created that is effectively a glorified miss. #
- when "Parry"; string_color = J::XAS::PARRY_FONT_COLOR #
- #=======================================================================================#
- else
- string_color = DAMAGE_DEFAULT_FONT_COLOR
- end
- if @damage_type != "Item" && value.to_i < 0
- bitmap.font.size = DAMAGE_FONT_SIZE + 8
- string_color = J::XAS::HEAL_FONT_COLOR
- value = value.abs
- end
- bitmap.font.color = string_color
- damage_string = value.to_s
- damage_string = "MP " + damage_string if @damage_type == "Mp"
- a = 0
- if @damage_type == "Item"
- for n in $j_names
- bitmap.draw_text(0, 12 + a, 160, 36, n.to_s, 1)
- bitmap.draw_text(1, 13 + a, 160, 36, n.to_s, 1)
- a += 24
- end
- unless $j_items.empty?
- bitmap.font.size = DAMAGE_FONT_SIZE + 8
- string_color = J::XAS::HEAL_FONT_COLOR
- bitmap.font.color = string_color
- for i in $j_items
- bitmap.draw_text(0, 12 + a, 160, 36, i.to_s, 1)
- bitmap.draw_text(1, 13 + a, 160, 36, i.to_s, 1)
- a += 24
- end
- end
- else
- bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
- bitmap.draw_text(1, 13, 160, 36, damage_string, 1)
- end
- @_damage_sprite = ::Sprite.new(self.viewport)
- @_damage_sprite.bitmap = bitmap
- @_damage_sprite.ox = 80
- @_damage_sprite.oy = 20
- @_damage_sprite.x = self.x + @damage_ox
- @_damage_sprite.y = self.y - self.oy / 2
- @_damage_sprite.z = 3000
- @_damage_duration = 60
- end
- end#Sprite_Base
- module XAS_BA_ItemDrop
- alias j_xas_fixdrops make_treasure
- def make_treasure(target)
- drops = []
- # if yanfly drops are included, will push those drops into the droplist too.
- if $imported["YEA-ExtraDrops"] == true
- for drop in target.extra_drops
- next if rand > drop.drop_rate
- drops << drop
- end
- end
- # Runs through the standard drop process, too.
- for drop in target.drop_items
- next if rand(drop.denominator) != 0
- next if drop.kind == 0
- drops << drop
- end
- # Actually drops all the items and turns them into collectable events.
- return unless $game_player.map_passable?(self.x, self.y, 0)
- for di in drops
- command = RPG::MoveCommand.new
- command.code = 14
- command.parameters = [0,0]
- route = RPG::MoveRoute.new
- route.repeat = false
- route.list = [command, RPG::MoveCommand.new]
- page = RPG::Event::Page.new
- page.move_type = 3
- page.move_route = route
- page.move_frequency = 6
- page.priority_type = 1
- page.trigger = 2
- page.through = true
- #===============================================================================================#
- # This will move the drops around, but as of now, they could land on an un-passable tile. #
- # Use at your own risk! (not that items on un-passable tiles break anything) #
- if J::XAS::DROP_ARRANGEMENT #
- ix = self.x #
- iy = self.y #
- ix += rand(2) - 1 #
- iy += rand(2) - 1 #
- end #
- #===============================================================================================#
- event = RPG::Event.new(self.x, self.y)
- event.pages = [page]
- token = Token_Event.new($game_map.map_id, event)
- if di.kind == 1
- token.icon_name = $data_items[di.data_id].icon_index
- elsif di.kind == 2
- token.icon_name = $data_weapons[di.data_id].icon_index
- elsif di.kind == 3
- token.icon_name = $data_armors[di.data_id].icon_index
- end
- token.treasure = [di.kind, di.data_id]
- token.treasure_time = 120 + XAS_BA::TREASURE_ERASE_TIME * 60
- token.jump_high(0,0,20)
- token.force_update = true
- token.move_speed = 6
- $game_map.add_token(token)
- end#for
- end#def
- end#moduleXASBAItemDrop
- class Game_Player < Game_Character
- alias j_xas_collectdrops check_treasure_here
- def check_treasure_here
- name = ""
- $j_items = []
- $j_names = []
- for event in $game_map.events_xy(@x, @y)
- if event.treasure != nil
- name_pop = true
- case event.treasure[0]
- when 1
- item = $data_items[event.treasure[1]]
- if can_execute_field_item_effect?(item)
- $j_items << self.battler.damage.abs.to_s
- else
- $game_party.gain_item(item, 1)
- $j_names << item.name
- end
- $game_map.need_refresh = true
- when 2
- item = $data_weapons[event.treasure[1]]
- $game_party.gain_item(item, 1, false)
- $j_names << item.name
- when 3
- item = $data_armors[event.treasure[1]]
- $game_party.gain_item(item, 1, false)
- $j_names << item.name
- end
- Audio.se_play("Audio/SE/" + XAS_SOUND::ITEM_DROP , 100, 100)
- event.erase
- if item != nil
- if item.note =~ /<Drop Animation = (\d+)>/
- self.animation_id = $1.to_i
- end
- end
- end#if event.treasure
- end#for event
- if XAS_DAMAGE_POP::DAMAGE_ITEM_POP and name_pop
- self.battler.damage = item.name
- self.battler.damage_pop = true
- self.battler.damage_type = "Item"
- end
- end#def
- end#Game_Player
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement