Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ************************ Commissioned by Kudaaj330 *************************
- #==============================================================================
- # Kadafi - Item Use Notification
- # Version : 1.0
- # Contact : http://forums.rpgmakerweb.com/index.php?/user/33654-kadafi/
- #==============================================================================
- ($imported ||= {})[:Kadafi_ItemUseNotif] = true
- #==============================================================================
- # CHANGE LOGS:
- # -----------------------------------------------------------------------------
- # 2016.09.30 - Finished script
- #==============================================================================
- =begin
- Introduction :
- This script create an item use notification.
- How to Use :
- Edit the configuration below.
- NOTE :
- 1. This script will only show the "Parameter Grow" effect on item use
- 2. You must set the "Parameter Grow" effect into no. 1 from the effect lists
- Terms of Use :
- 1. Credit me as Kadafi (Optional)
- =end
- #==============================================================================
- # Configuration
- #==============================================================================
- module Kadafi
- #--------------------------------------------------------------------------
- # * List of Allowed Item Use Notification (Item IDs)
- #--------------------------------------------------------------------------
- ItemUseNotif_Items = [9, 10, 11, 12, 13, 14]
- #--------------------------------------------------------------------------
- # * Notification Window Width in Scene_Map
- #--------------------------------------------------------------------------
- ItemUseNotifWindow_Width = 256
- #--------------------------------------------------------------------------
- # * Parameter Grow Vocab
- #--------------------------------------------------------------------------
- Parameter_Vocab = [
- "Life", # Max HP
- "Mana", # Max MP
- "Strength", # Attack
- "Defense", # Defense
- "Magic", # Magic ATK
- "Magic Defense", # Magic DEF
- "Agility", # Agility
- "Luck", # Luck
- ]
- #--------------------------------------------------------------------------
- # * Notification Window Show Count
- #--------------------------------------------------------------------------
- ItemUseNotif_ShowCount = 30 # Frames / 60s
- end
- #==============================================================================
- # Don't edit below this line unless you know what to do.
- #==============================================================================
- #==============================================================================
- # ** Game_Map
- #==============================================================================
- class Game_Map
- attr_reader :recall_menu, :show_notif, :show_item_id
- attr_accessor :recall_menu, :show_notif, :show_item_id
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- alias old_initialize_1 initialize
- def initialize
- old_initialize_1
- @recall_menu = false
- @show_notif = false
- @show_item_id = 0
- end
- #--------------------------------------------------------------------------
- # * Show Item Use Notification
- #--------------------------------------------------------------------------
- def show_notification(item)
- if Kadafi::ItemUseNotif_Items.include?(item.id)
- if item.effects[0].code == 42
- @show_notif = true
- @show_item_id = item.id
- end
- end
- end
- end
- #==============================================================================
- # ** Window_EquipSkillNotification
- #==============================================================================
- class Window_ItemUseNotification < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, window_width, fitting_height(1))
- update_placement
- @parameter = ""
- @value1 = 0
- @fade = false
- @show_count = 0
- refresh
- hide
- end
- #--------------------------------------------------------------------------
- # * Update Window Position
- #--------------------------------------------------------------------------
- def update_placement
- self.x = (Graphics.width - width) / 2
- self.y = Graphics.height - height
- end
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- return Kadafi::EquipSkillNotifWindow_Width
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- text = @parameter + " +" + @value1.to_s
- draw_text(0 - line_height / 2, 0, width, line_height, text, 1)
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- if open? && @show_count > 0
- @show_count -= 1
- if @show_count == 0
- @fade = true
- #~ SceneManager.call(Scene_Item)
- end
- end
- if @fade
- self.opacity -= 3
- self.contents_opacity -= 3
- if self.opacity == 0
- @fade = false
- $game_map.recall_menu = true
- SceneManager.call(Scene_Item)
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Show Notification
- #--------------------------------------------------------------------------
- def show_notification(item)
- self.opacity = 255
- self.contents_opacity = 255
- @parameter = Kadafi::Parameter_Vocab[item.effects[0].data_id]
- @value1 = item.effects[0].value1.to_i
- @show_count = Kadafi::ItemUseNotif_ShowCount
- refresh
- show
- end
- end
- #==============================================================================
- # ** Scene_Map
- #==============================================================================
- class Scene_Map < Scene_Base
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- alias old_start start
- def start
- old_start
- create_notification_window
- end
- #--------------------------------------------------------------------------
- # * Create Notification Window
- #--------------------------------------------------------------------------
- def create_notification_window
- @notification_window = Window_ItemUseNotification.new
- end
- #--------------------------------------------------------------------------
- # * Show Item Use Notification
- #--------------------------------------------------------------------------
- def show_notification(item)
- @notification_window.show_notification(item)
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- alias old_update_1 update
- def update
- old_update_1
- if $game_map.show_notif
- show_notification($data_items[$game_map.show_item_id])
- $game_map.show_notif = false
- end
- end
- end
- #==============================================================================
- # ** Scene_Item
- #==============================================================================
- class Scene_Item < Scene_ItemBase
- #--------------------------------------------------------------------------
- # * Use Item
- #--------------------------------------------------------------------------
- alias old_use_item_1 use_item
- def use_item
- old_use_item_1
- $game_map.show_notification(item)
- SceneManager.goto(Scene_Map)
- end
- #--------------------------------------------------------------------------
- # * Return to Calling Scene
- #--------------------------------------------------------------------------
- alias old_return_scene_1 return_scene
- def return_scene
- if $game_map.recall_menu
- $game_map.recall_menu = false
- SceneManager.goto(Scene_Menu)
- else
- old_return_scene_1
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement