Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if true # << Make true to use this script, false to disable.
- #===============================================================================
- #
- # ☆ $D13x - Item Popups
- # -- Author : Dekita
- # -- Version : 1.0
- # -- Level : Easy / Normal
- # -- Requires : $D13x Core v2.3+
- # -- Engine : RPG Maker VX Ace.
- #
- #===============================================================================
- # ☆ Import
- #-------------------------------------------------------------------------------
- $D13x={}if$D13x==nil
- $D13x[:Item_Pops]=true
- #===============================================================================
- # ☆ Updates
- #-------------------------------------------------------------------------------
- # D /M /Y
- # 13/o3/2o13 - Finished,
- # ??/??/2o13 - Started
- #
- #===============================================================================
- # ☆ Introduction
- #-------------------------------------------------------------------------------
- # This script creates an animated popup that is shown automatically when the
- # party's inventory is changed. It shows all item, weapon, armor and gold
- # gains && losses.
- #
- # You can also use script calls to change weather popups are displayed and to
- # turn on / off the popup feature.
- #
- #===============================================================================
- # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
- #===============================================================================
- # 1. You MUST give credit to "Dekita" !!
- # 2. You are NOT allowed to repost this script.(or modified versions)
- # 3. You are NOT allowed to convert this script.
- # 4. You are NOT allowed to use this script for Commercial games.
- # 5. ENJOY!
- #
- # "FINE PRINT"
- # By using this script you hereby agree to the above terms and conditions,
- # if any violation of the above terms occurs "legal action" may be taken.
- # Not understanding the above terms and conditions does NOT mean that
- # they do not apply to you.
- # If you wish to discuss the terms and conditions in further detail you can
- # contact me at http://dekitarpg.wordpress.com/
- #
- #===============================================================================
- # ☆ Instructions
- #-------------------------------------------------------------------------------
- # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
- #
- #===============================================================================
- # ☆ Script Calls
- #-------------------------------------------------------------------------------
- # make_popup(type, id, value)
- # type = :item, :weapon, :armor, :gold
- # id = item, weapon, armor id. if gold, leave 0 or nil
- # valu = the value shown in the popup.
- #
- #-------------------------------------------------------------------------------
- # $game_temp.item_pops_on?
- # Returns true / false depending on weather popups can be shown.
- #
- #-------------------------------------------------------------------------------
- # $game_temp.show_item_pops
- # Enables popups to be shown
- #
- #-------------------------------------------------------------------------------
- # $game_temp.hide_item_pops
- # Disables popups from being shown
- #
- #-------------------------------------------------------------------------------
- # $game_temp.alt_item_pops
- # Alternate Show/Hide Popups.
- #
- #===============================================================================
- # ☆ HELP
- #-------------------------------------------------------------------------------
- #
- #===============================================================================
- module Item_Popping
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Position after offset slide.
- #-----------------------------------------------------------------------------
- X_Pos = 8 # X Position
- Y_Pos = 330 # Y Position
- #-----------------------------------------------------------------------------
- # Offset Slide happens before the item fadeout
- #-----------------------------------------------------------------------------
- X_Offset = 40 # X Slide
- Y_Offset = 0 # Y Slide
- #-----------------------------------------------------------------------------
- # Move happens during the item fadeout
- #-----------------------------------------------------------------------------
- X_Move = 0 # X Move Speed
- Y_Move = -1 # Y Move Speed
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- Init_Opacity = 0
- Fade_Speed = 2.5
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- Authority = 200
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- Font = ["VL Gothic", "Arial"]
- Font_Size = 16
- Font_Bold = true
- Font_Italic = false
- Value_Size = 12
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- Gold_Icon = [361,0] # [icon index, hue]
- Gold_Color = Text_Color::Gold
- #-----------------------------------------------------------------------------
- # Sound Fx - ['Sfx Name', volume, pitch]
- #-----------------------------------------------------------------------------
- Sound_Fx ={
- :item => ['Load' , 60, 100],
- :weapon => ['Equip1' , 60, 100],
- :armor => ['Equip1' , 60, 100],
- :gold => ['Shop' , 60, 100],
- }
- #####################
- # CUSTOMISATION END #
- end #####################
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
- # #
- # http://dekitarpg.wordpress.com/ #
- # #
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
- #===============================================================================#
- # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
- # YES?\.\. #
- # OMG, REALLY? \| #
- # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
- # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
- #===============================================================================#
- class Game_Interpreter
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- alias :com125_popup :command_125
- alias :com126_popup :command_126
- alias :com127_popup :command_127
- alias :com128_popup :command_128
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def command_125
- com125_popup
- value = operate_value(@params[0], @params[1], @params[2])
- make_popup(:gold,@params[0],value)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def command_126
- com126_popup
- value = operate_value(@params[1], @params[2], @params[3])
- make_popup(:item,@params[0],value)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def command_127
- com127_popup
- value = operate_value(@params[1], @params[2], @params[3])
- make_popup(:weapon,@params[0],value)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def command_128
- com128_popup
- value = operate_value(@params[1], @params[2], @params[3])
- make_popup(:armor,@params[0],value)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def make_popup(type,id,value)
- return unless $game_temp.item_pops_on?
- case type
- when :item then item = $data_items[id]
- when :weapon then item = $data_weapons[id]
- when :armor then item = $data_armors[id]
- when :gold then item = Popup_Gold.new
- end
- play_pop_noise(type)
- display_popup(item,value)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def play_pop_noise(type)
- v = Item_Popping::Sound_Fx[type]
- Audio.se_play("Audio\\SE\\#{v[0]}",v[1],v[2])
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def display_popup(item,value)
- SceneManager.scene.spriteset.init_item_popups(item,value)
- end
- end
- #===============================================================================
- class Game_Temp
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- alias :init_itempopups :initialize
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def initialize
- @can_popups = true
- init_itempopups
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def item_pops_on?
- @can_popups
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def show_item_pops
- @can_popups = true
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def hide_item_pops
- @can_popups = false
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def alt_item_pops
- @can_popups = !@can_popups
- end
- end
- #===============================================================================
- class Popup_Gold
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- attr_reader :name
- attr_reader :icon_hue
- attr_reader :icon_index
- attr_reader :item_disp_color
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def initialize
- @name = Vocab.currency_unit
- @icon_hue = Item_Popping::Gold_Icon[1]
- @icon_index = Item_Popping::Gold_Icon[0]
- @item_disp_color = Item_Popping::Gold_Color
- end
- end
- #===============================================================================
- class Sprite_PopItem < Sprite
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- attr_reader :finished
- #-----------------------------------------------------------------------------
- # Initialize
- #-----------------------------------------------------------------------------
- def initialize(vp=nil,item=nil,amo=0)
- super(vp)
- self.z = Item_Popping::Authority
- self.x = Item_Popping::X_Pos - Item_Popping::X_Offset
- self.y = Item_Popping::Y_Pos - Item_Popping::Y_Offset
- self.opacity = Item_Popping::Init_Opacity
- self.bitmap = Bitmap.new(152,24)
- init_icon(item.icon_index,item.icon_hue)
- init_text(item)
- init_amount(item,amo)
- @starting = true
- @finished = false
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def init_icon(icon=0,hue=0)
- @icon = Cache.icon(IconEvents::Set,hue)
- rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
- self.bitmap.blt(0, 0, @icon, rect)
- @icon.dispose
- @icon = nil
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def init_text(item)
- self.bitmap.font.name = Item_Popping::Font
- self.bitmap.font.size = Item_Popping::Font_Size
- self.bitmap.font.bold = Item_Popping::Font_Bold
- self.bitmap.font.italic = Item_Popping::Font_Italic
- self.bitmap.font.color = item.item_disp_color
- self.bitmap.draw_text(24,-2,128,24, item.name)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def init_amount(item,amount)
- self.bitmap.font.name = Item_Popping::Font
- self.bitmap.font.size = Item_Popping::Value_Size
- self.bitmap.font.bold = Item_Popping::Font_Bold
- self.bitmap.font.italic = Item_Popping::Font_Italic
- self.bitmap.font.color = item.item_disp_color
- amount > 0 ? amount = "+#{amount}" : "-#{amount}"
- self.bitmap.draw_text(20,8,128,24,amount)
- end
- #-----------------------------------------------------------------------------
- # Dispose
- #-----------------------------------------------------------------------------
- def dispose
- super
- if self.bitmap != nil
- self.bitmap.dispose
- end
- end
- #-----------------------------------------------------------------------------
- # Update
- #-----------------------------------------------------------------------------
- def update
- super
- if @starting
- self.x += 1 if self.x < Item_Popping::X_Pos
- else
- self.x += Item_Popping::X_Move
- end
- self.y += Item_Popping::Y_Move if !@starting
- if @starting
- self.opacity += (Item_Popping::Fade_Speed*2)
- @starting = false if self.opacity >= 255
- else
- self.opacity -= Item_Popping::Fade_Speed
- if self.opacity <= 0
- @finished = true
- end
- end
- end
- end
- #===============================================================================
- module Spriteset_ItemPopup
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def load_itempop_data
- @item_pops = []
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def init_item_popups(item,amo=0)
- return unless amo != 0
- @item_pops << Sprite_PopItem.new(nil,item,amo)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def disp_item_popups
- return unless @item_pops
- @item_pops.each do |i|
- next unless i.disposed?
- i.dispose
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def updt_item_popups
- return unless @item_pops
- @item_pops.each do |i|
- disp = i.disposed?
- next if i.disposed?
- i.update
- i.dispose if i.finished
- end
- end
- end
- #===============================================================================
- class Spriteset_Map
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Included Modules
- #-----------------------------------------------------------------------------
- include Spriteset_ItemPopup
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :popitem_initialize :initialize
- alias :popitem_dispose :dispose
- alias :popitem_update :update
- #-----------------------------------------------------------------------------
- # Initialize
- #-----------------------------------------------------------------------------
- def initialize
- popitem_initialize
- load_itempop_data
- end
- #-----------------------------------------------------------------------------
- # Dispose
- #-----------------------------------------------------------------------------
- def dispose
- disp_item_popups
- popitem_dispose
- end
- #-----------------------------------------------------------------------------
- # Update
- #-----------------------------------------------------------------------------
- def update
- updt_item_popups
- popitem_update
- end
- end
- #===============================================================================
- class Spriteset_Battle
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Included Modules
- #-----------------------------------------------------------------------------
- include Spriteset_ItemPopup
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :popitem_initialize :initialize
- alias :popitem_dispose :dispose
- alias :popitem_update :update
- #-----------------------------------------------------------------------------
- # Initialize
- #-----------------------------------------------------------------------------
- def initialize
- popitem_initialize
- load_itempop_data
- end
- #-----------------------------------------------------------------------------
- # Dispose
- #-----------------------------------------------------------------------------
- def dispose
- disp_item_popups
- popitem_dispose
- end
- #-----------------------------------------------------------------------------
- # Update
- #-----------------------------------------------------------------------------
- def update
- updt_item_popups
- popitem_update
- end
- end
- #===============================================================================
- class Scene_Map < Scene_Base
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- attr_reader :spriteset
- end
- #===============================================================================
- class Scene_Battle < Scene_Base
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- attr_reader :spriteset
- end
- #==============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #==============================================================================#
- end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement