Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ************************ Commissioned by Kudaaj330 *************************
- #==============================================================================
- # Kadafi - Equip Skill Notification
- # Version : 1.0
- # Contact : http://forums.rpgmakerweb.com/index.php?/user/33654-kadafi/
- #==============================================================================
- ($imported ||= {})[:Kadafi_EquipSkillNotif] = true
- #==============================================================================
- # CHANGE LOGS:
- # -----------------------------------------------------------------------------
- # 2016.11.17 - Finished script
- #==============================================================================
- =begin
- Introduction :
- This script create a equip skill notification.
- How to Use :
- Edit the configuration below.
- Terms of Use :
- 1. Credit me as Kadafi (Optional)
- =end
- #==============================================================================
- # Configuration
- #==============================================================================
- module Kadafi
- #--------------------------------------------------------------------------
- # * Notification Window Width in Scene_Skill
- #--------------------------------------------------------------------------
- EquipSkillNotifWindow_Width = 256
- #--------------------------------------------------------------------------
- # * Notification Window Vocab
- #--------------------------------------------------------------------------
- EquipSkillNotif_Vocab = " is equipped."
- #--------------------------------------------------------------------------
- # * Notification Window Show Count
- #--------------------------------------------------------------------------
- EquipSkillNotif_ShowCount = 30 # Frames / 60s
- end
- #==============================================================================
- # Don't edit below this line unless you know what to do.
- #==============================================================================
- #==============================================================================
- # ** Window_EquipSkillNotification
- #==============================================================================
- class Window_EquipSkillNotification < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, window_width, fitting_height(1))
- update_placement
- @skill_name = ""
- @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 = @skill_name + Kadafi::EquipSkillNotif_Vocab
- 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
- @fade = true if @show_count == 0
- end
- if @fade
- self.opacity -= 1
- self.contents_opacity -= 1
- @fade = false if self.opacity == 0
- end
- end
- #--------------------------------------------------------------------------
- # * Show Notification
- #--------------------------------------------------------------------------
- def show_notification(skill)
- self.opacity = 255
- self.contents_opacity = 255
- @skill_name = skill.name
- @show_count = Kadafi::EquipSkillNotif_ShowCount
- refresh
- show
- end
- end
- #==============================================================================
- # ** Window Skill List
- #==============================================================================
- class Window_SkillList < Window_Selectable
- #--------------------------------------------------------------------------
- # * Can Equip Skill Action
- #--------------------------------------------------------------------------
- def can_equip_skill_action?
- return false if $game_party.in_battle
- skill = @data[index]
- if skill != nil and skill.note =~ /<Duration = (\d+)>/
- #~ p @stype_id
- #~ p Kadafi::Magic_SkillTypesID
- #~ p Kadafi::WeaponSkill_SkillTypesID
- if @stype_id == Kadafi::Magic_SkillTypesID
- @actor.skill_id = skill.id
- elsif @stype_id == Kadafi::WeaponSkill_SkillTypesID
- @actor.skill2_id = skill.id
- end
- Sound.play_equip
- SceneManager.scene.show_notification(skill)
- return true
- end
- return false
- end
- end
- #==============================================================================
- # ** Scene_Skill
- #==============================================================================
- class Scene_Skill < Scene_ItemBase
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- alias old_start start
- def start
- old_start
- create_notification_window
- end
- #--------------------------------------------------------------------------
- # * Create Notification Window
- #--------------------------------------------------------------------------
- def create_notification_window
- @notification_window = Window_EquipSkillNotification.new
- end
- #--------------------------------------------------------------------------
- # * Show Equip Skill Notification
- #--------------------------------------------------------------------------
- def show_notification(skill)
- @notification_window.show_notification(skill)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement