Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # Pacman Advanced Creative (PAC) Engine - Skills Scene
- # 7/5/2011
- # Type: Menu
- # Installation: Configuration.
- # Level: Average
- # With: Cozziekuns
- #
- #===============================================================================
- #
- # Description:
- # This skill inventory allows you to sort your items in the categories: All,
- # Damage, Healing and Status. You can even make your own categories, if that's
- # how you roll. This PAC format version makes several graphical improvements
- # in Pacman's preference.
- #
- #===============================================================================
- #
- # Instructions:
- # INSTALLATION
- # Paste above main, below materials and following PAC format if applicable.
- # Compatible with all PAC scripts, but not dependent on them. This should be
- # compatible with any script that doesn't mess around with the Skill Scene.
- # CONFIGURATION
- # Instructions on how to use the script begin at line 38. Follow them
- # religiously.
- #
- #===============================================================================
- $imported = {} if $imported == nil
- $imported["PACSkills"] = true
- module PAC
- module MENU
- CATEGORY_TEXT = "Currently Displayed:"
- #===============================================================================
- # Extra Skill Categories
- # ------------------------------------------------------------------------------
- # Each item in the hash represents a certain category. For example, the first
- # hash we see here is:
- #
- # 0 => [21, "All", false],
- #
- # The syntax of this is:
- #
- # Category ID => [Icon Number, Text, Prime],
- #
- # Probably the most important part, the category ID is the number you want to
- # put into the notebox that the item contains. For example, if you wanted to
- # make the skill "Teleport" into the category 4, you would put:
- #
- # \category[4]
- #
- # into the notebox. Note that numbers 0, 1, 2, and 3 are special. They're prime
- # categories. Sound special right? Not really, this just means you have to have
- # them in the inventory for this script to work. I could've gotten rid of them,
- # but that would've just given more work on your part (and mine), so bear with
- # them, please. Icon Numbers and Text are pretty self explanatory.
- #
- # Last, but not least, is the "Prime" function. Setting this to "true" means
- # that anything in the prime category will not show up in the other categories.
- # You can set if you want it to show up in all.
- #===============================================================================
- SKILL_CATEGORIES = {
- 0 => [21, "All", false],
- 1 => [132, "Battle", false],
- 2 => [128, "Healing", false],
- 3 => [113, "Buffs", false],
- 4 => [80, "Special", true],
- }
- SKILL_CATEGORY_WIDTH = 300 # How wide you want your text window.
- ALL_CATEOGRY_PRIME = false # If you want prime key items to show up in the all window.
- MAX_NUMBER = (544 - SKILL_CATEGORY_WIDTH) / 54 # The maximum number of icons that will fit.
- end
- end
- #==============================================================================
- # ** RPG::Skill
- #------------------------------------------------------------------------------
- # The superclass of all skills.
- #==============================================================================
- class RPG::Skill
- #--------------------------------------------------------------------------
- # * Cozziekuns Category Index
- #--------------------------------------------------------------------------
- def pac_skill_category_index
- @pac_skill_category_index = 0
- if self.note[/\\category\[(\d+)]/i] != nil
- @pac_skill_category_index = $1.to_i
- end
- return @pac_skill_category_index
- end
- end
- #==============================================================================
- # ** Window_Skill
- #------------------------------------------------------------------------------
- # This window displays a list of usable skills on the skill screen, etc.
- #==============================================================================
- class Window_Skill < Window_Selectable
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh(sort_index = 0)
- @sort_index = sort_index
- @data = []
- for skill in @actor.skills
- next unless include?(skill)
- @data.push(skill)
- if skill.id == @actor.last_skill_id
- self.index = @data.size - 1
- end
- end
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
- #--------------------------------------------------------------------------
- # * Whether or not to include in skill list
- # skill : skill
- #--------------------------------------------------------------------------
- def include?(skill)
- return case @sort_index
- when 0
- unless PAC::MENU::ALL_CATEOGRY_PRIME
- if PAC::MENU::SKILL_CATEGORIES[skill.pac_skill_category_index][2]
- return false
- else
- return true
- end
- else
- return true
- end
- when 1
- if PAC::MENU::SKILL_CATEGORIES[skill.pac_skill_category_index][2]
- return false
- else
- return skill.base_damage > 0
- end
- when 2
- if PAC::MENU::SKILL_CATEGORIES[skill.pac_skill_category_index][2]
- return false
- else
- return skill.base_damage < 0
- end
- when 3
- if PAC::MENU::SKILL_CATEGORIES[skill.pac_skill_category_index][2]
- return false
- elsif skill.plus_state_set.size != 0
- return true
- else
- return skill.minus_state_set.size != 0
- end
- when 4..999
- return skill.pac_skill_category_index == @sort_index
- end
- end
- end
- #==============================================================================
- # ** Window_SkillCategory
- #------------------------------------------------------------------------------
- # This window displays what type of skill is being displayed.
- #==============================================================================
- class Window_SkillCategory < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- # x : window X coordinate
- # y : window Y coordinate
- #--------------------------------------------------------------------------
- def initialize(x, y, width)
- super(x, y, width, WLH + 32)
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh(sort_index = 0)
- @sort_index = sort_index
- @skill_categories = PAC::MENU::SKILL_CATEGORIES
- @skill_categories_width = PAC::MENU::SKILL_CATEGORY_WIDTH
- @category_string = PAC::MENU::CATEGORY_TEXT
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.draw_text(4, 0, @skill_categories_width - 40, WLH, @category_string, 0)
- self.contents.font.color = normal_color
- for i in 0...@skill_categories.size
- if @sort_index == i
- self.contents.draw_text(4, 0, @skill_categories_width - 40, WLH, @skill_categories[i][1], 2)
- end
- end
- end
- end
- #==============================================================================
- # ** Window_SkillSort
- #------------------------------------------------------------------------------
- # This window displays what type of skill is being displayed.
- #==============================================================================
- class Window_SkillSort < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- # x : window X coordinate
- # y : window Y coordinate
- #--------------------------------------------------------------------------
- def initialize(x, y, width)
- super(x, y, width, WLH + 32)
- @ox = 0
- if PAC::MENU::MAX_NUMBER < PAC::MENU::SKILL_CATEGORIES.size
- self.contents = Bitmap.new(self.width - 32 + ((PAC::MENU::SKILL_CATEGORIES.size - PAC::MENU::MAX_NUMBER) * 54), self.height - 32)
- end
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh(sort_index = 0)
- @sort_index = sort_index
- @item_categories = PAC::MENU::SKILL_CATEGORIES
- @item_categories_width = PAC::MENU::SKILL_CATEGORY_WIDTH
- self.contents.clear
- for i in 0...@item_categories.size
- @icon_x = 0 + (i * ((544 - @item_categories_width) / @item_categories.size))
- if @item_categories.size < PAC::MENU::MAX_NUMBER
- draw_item(i)
- else
- draw_items(i)
- end
- if @sort_index == i
- if @item_categories.size < PAC::MENU::MAX_NUMBER
- draw_icon(@item_categories[i][0], @icon_x, 0, true)
- else
- draw_icon(@item_categories[i][0], i * 54, 0, true)
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Item
- # index : item number
- #--------------------------------------------------------------------------
- def draw_item(index)
- icons_x = (544 - @item_categories_width) / @item_categories.size
- draw_icon(@item_categories[index][0], index * icons_x, 0, false)
- end
- #--------------------------------------------------------------------------
- # * Draw Items
- # index : item number
- #--------------------------------------------------------------------------
- def draw_items(index)
- draw_icon(@item_categories[index][0], index * 54, 0, false)
- end
- end
- #==============================================================================
- # ** Window_PACSkillHelp
- #------------------------------------------------------------------------------
- # This window shows skill and item explanations along with actor status and
- # graphics fit for PAC scripts.
- #==============================================================================
- class Window_PACSkillHelp < Window_Base
- def initialize
- super(0, 112, 544, WLH + 32)
- end
- def set_text(text, align = 0)
- if text != @text or align != @align
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 0, self.width - 40, WLH, text, align)
- @text = text
- @align = align
- end
- end
- end
- #==============================================================================
- # ** Scene_Skill
- #------------------------------------------------------------------------------
- # This class performs the skill screen processing.
- #==============================================================================
- class Scene_Skill < Scene_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- # actor_index : actor index
- #--------------------------------------------------------------------------
- def initialize(actor_index = 0, equip_index = 0)
- @actor_index = actor_index
- @sort_index = 0
- end
- #--------------------------------------------------------------------------
- # * Start processing
- #--------------------------------------------------------------------------
- def start
- super
- create_menu_background
- @actor = $game_party.members[@actor_index]
- @viewport = Viewport.new(0, 0, 544, 416)
- @help_window = Window_PACSkillHelp.new
- @help_window.viewport = @viewport
- @status_window = Window_SkillStatus.new(0, 0, @actor)
- @status_window.viewport = @viewport
- @skill_window = Window_Skill.new(0, 168, 544, 248, @actor)
- @skill_window.viewport = @viewport
- @skill_window.help_window = @help_window
- @category_width = PAC::MENU::SKILL_CATEGORY_WIDTH
- @category_window = Window_SkillCategory.new(544 - @category_width, 56, @category_width)
- @sort_window = Window_SkillSort.new(0, 56, 544 - @category_width)
- @target_window = Window_MenuStatus.new(0, 0)
- @skill_categories = PAC::MENU::SKILL_CATEGORIES
- hide_target_window
- end
- #--------------------------------------------------------------------------
- # * Termination Processing
- #--------------------------------------------------------------------------
- alias pac_skill_pss_ss_terminate terminate
- def terminate
- pac_skill_pss_ss_terminate
- @category_window.dispose
- @sort_window.dispose
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- update_menu_background
- @help_window.update
- @status_window.update
- @skill_window.update
- @target_window.update
- if @skill_window.active
- update_skill_selection
- elsif @target_window.active
- update_target_selection
- end
- end
- #--------------------------------------------------------------------------
- # * Update Skill Selection
- #--------------------------------------------------------------------------
- def update_skill_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- return_scene
- elsif Input.trigger?(Input::X)
- @sort_index -= 1
- @sort_index %= @skill_categories.size
- if @sort_index + 1 == @skill_categories.size
- @sort_window.ox += 54 * (@skill_categories.size - PAC::MENU::MAX_NUMBER)
- else
- if @skill_categories.size > PAC::MENU::MAX_NUMBER and @sort_index > PAC::MENU::MAX_NUMBER - 2
- @sort_window.ox -= 54
- end
- end
- @category_window.refresh(@sort_index)
- @sort_window.refresh(@sort_index)
- @skill_window.refresh(@sort_index)
- @skill_window.index = 0
- Sound.play_cursor
- elsif Input.trigger?(Input::Y)
- @sort_index += 1
- @sort_index %= @skill_categories.size
- if @sort_index != 0
- if @skill_categories.size > PAC::MENU::MAX_NUMBER and @sort_index > PAC::MENU::MAX_NUMBER - 1
- @sort_window.ox += 54
- end
- else
- @sort_window.ox = 0
- end
- @category_window.refresh(@sort_index)
- @sort_window.refresh(@sort_index)
- @skill_window.refresh(@sort_index)
- @skill_window.index = 0
- Sound.play_cursor
- elsif Input.trigger?(Input::R)
- Sound.play_cursor
- next_actor
- elsif Input.trigger?(Input::L)
- Sound.play_cursor
- prev_actor
- elsif Input.trigger?(Input::C)
- @skill = @skill_window.skill
- if @skill != nil
- @actor.last_skill_id = @skill.id
- end
- if @actor.skill_can_use?(@skill)
- Sound.play_decision
- determine_skill
- else
- Sound.play_buzzer
- end
- end
- end
- end
- PAC::MENU::USE_SKILLS_BATTLE = false
- class Scene_Battle < Scene_Base
- if PAC::MENU::USE_SKILLS_BATTLE
- #--------------------------------------------------------------------------
- # * Start Skill Selection
- #--------------------------------------------------------------------------
- def start_skill_selection
- @help_window = Window_Help.new
- @skill_window = Window_Skill.new(0, 112, 544, 304, @active_battler)
- @category_width = PAC::MENU::SKILL_CATEGORY_WIDTH
- @category_window = Window_SkillCategory.new(544 - @category_width, 56, @category_width)
- @sort_window = Window_SkillSort.new(0, 56, 544 - @category_width)
- @skill_window.help_window = @help_window
- @actor_command_window.active = false
- end
- #--------------------------------------------------------------------------
- # * End Skill Selection
- #--------------------------------------------------------------------------
- def end_skill_selection
- if @skill_window != nil
- @skill_window.dispose
- @skill_window = nil
- @category_window.dispose
- @category_window = nil
- @sort_window.dispose
- @sort_window = nil
- @help_window.dispose
- @help_window = nil
- end
- @actor_command_window.active = true
- end
- #--------------------------------------------------------------------------
- # * Update Skill Selection
- #--------------------------------------------------------------------------
- def update_skill_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- end_skill_selection
- elsif Input.trigger?(Input::X)
- @sort_index -= 1
- @sort_index %= @skill_categories.size
- if @sort_index + 1 == @skill_categories.size
- @sort_window.ox += 54 * (@skill_categories.size - PAC::MENU::MAX_NUMBER)
- else
- if @skill_categories.size > PAC::MENU::MAX_NUMBER and @sort_index > PAC::MENU::MAX_NUMBER - 2
- @sort_window.ox -= 54
- end
- end
- @category_window.refresh(@sort_index)
- @sort_window.refresh(@sort_index)
- @skill_window.refresh(@sort_index)
- @skill_window.index = 0
- Sound.play_cursor
- elsif Input.trigger?(Input::Y)
- @sort_index += 1
- @sort_index %= @skill_categories.size
- if @sort_index != 0
- if @skill_categories.size > PAC::MENU::MAX_NUMBER and @sort_index > PAC::MENU::MAX_NUMBER - 1
- @sort_window.ox += 54
- end
- else
- @sort_window.ox = 0
- end
- @category_window.refresh(@sort_index)
- @sort_window.refresh(@sort_index)
- @skill_window.refresh(@sort_index)
- @skill_window.index = 0
- Sound.play_cursor
- elsif Input.trigger?(Input::R)
- Sound.play_cursor
- next_actor
- elsif Input.trigger?(Input::L)
- Sound.play_cursor
- prior_actor
- elsif Input.trigger?(Input::C)
- @skill = @skill_window.skill
- if @actor.skill_can_use?(@skill)
- Sound.play_decision
- determine_skill
- else
- Sound.play_buzzer
- end
- end
- end
- end
- end
- #===============================================================================
- #
- # END OF SCRIPT
- #
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement