Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # IC Equipment Enhanced
- # Version 1.0
- # By Szyu
- #
- # About:
- # Enhance weapons and armors of a kind. Increase stats of a type and every
- # equipment from the same type will be enhanced.
- # You gain Equipment Points by level ups or by script command.
- #
- # Instructions:
- # - Place below "▼ Materials" but above "▼ Main Process".
- #
- # How to Use:
- # - <no_enhancing> in equipment's tag for disable function for certain armors
- # and weapons.
- #
- # - set LEVEL_UP_MESSAGE to nil or "" if you don't want to show a message on
- # level up.
- #
- # - Press the "A"-Button on Equip Menu or Item Menu while selecting a weapon
- # or armor to enhance it.
- # BEWARE: Each action costs Equipment Points. So enhance your items carefully.
- #
- # - You can allow and disallow the player to use Equipment Enhancing on certain
- # moments with the following commands:
- # * $game_party.enable_eq_enhancing
- # * $game_party.disable_eq_enhancing
- # * $game_party.toggle_eq_enhancing
- #
- # Requires:
- # - RPG Maker VX Ace
- #
- # Terms of Use:
- # - Free for commercal and non-commercial use. Please list me
- # in the credits to support my work.
- #
- # Pastebin:
- # http://adf.ly/W58jj
- #
- #==============================================================
- # * Configuration
- #==============================================================
- # Term in the Enhancing Menu
- EQUIPMENT_POINTS_TERM = "Equipment Points"
- # Message on level up
- LEVEL_UP_MESSAGE = "Equipment Points increased!"
- # Equipment Points gained on level up
- EQP_PER_LEVEL_UP = 1
- # Equipment Points needed for enhance parameters.
- EQP_ENHANCING_VALUE = 1
- # Enables Equipment Enhancing on startup
- EQENH_ENABLED_START = true
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- #==============================================================
- # * Game_Party
- #==============================================================
- class Game_Party < Game_Unit
- attr_accessor :eqp # Equipment Points
- attr_reader :eq_enhancing_enabled
- alias :ic_eqp_init :initialize
- def initialize
- ic_eqp_init
- @eqp = 0
- @eq_enhancing_enabled = EQENH_ENABLED_START
- end
- def toggle_eq_enhancing
- @eq_enhancing_enabled = !@eq_enhancing_enabled
- end
- def enable_eq_enhancing
- @eq_enhancing_enabled = true
- end
- def disable_eq_enhancing
- @eq_enhancing_enabled = false
- end
- def gain_eqp(val=1)
- @eqp += val
- end
- end
- #==============================================================
- # * Game_Actor
- #==============================================================
- class Game_Actor < Game_Battler
- alias :ic_eqp_change_level :change_level
- def change_level(level, show)
- ic_eqp_change_level(level, show)
- $game_party.eqp += EQP_PER_LEVEL_UP
- end
- alias :ic_eqp_message :display_level_up
- def display_level_up(new_skills)
- ic_eqp_message(new_skills)
- $game_message.add(LEVEL_UP_MESSAGE) if LEVEL_UP_MESSAGE && LEVEL_UP_MESSAGE != ""
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- #==============================================================
- # * Scene_Equip
- #==============================================================
- class Scene_Equip < Scene_MenuBase
- alias :ic_eqp_sceq_start :start
- def start
- ic_eqp_sceq_start
- @enhance_window = Window_EnhanceEquipment.new
- @enhance_window.set_handler(:cancel, method(:on_enhancing_cancel))
- @enhance_base_window = Window_EquipmentItemBase.new
- @eqpoints_window = Window_EquipmentPoints.new
- @enhance_window.points_window = @eqpoints_window
- end
- alias :ic_eqp_sceq_itwin :create_item_window
- def create_item_window
- ic_eqp_sceq_itwin
- @item_window.set_handler(:enhance_item, method(:on_enhance_item))
- end
- def on_enhance_item
- return unless @item_window.item
- show_equipment_enhance_windows
- @enhance_window.item = @item_window.item
- @enhance_base_window.item = @item_window.item
- end
- def show_equipment_enhance_windows
- @viewport.rect.x = @viewport.ox = 0
- @viewport.rect.width = 0
- @enhance_window.show.activate
- @enhance_base_window.show.activate
- @eqpoints_window.show.activate
- end
- def hide_equipment_enhance_windows
- @viewport.rect.x = @viewport.ox = 0
- @viewport.rect.width = Graphics.width
- @enhance_window.hide.deactivate
- @enhance_base_window.hide.deactivate
- @eqpoints_window.hide.deactivate
- @item_window.refresh
- @item_window.activate
- end
- def on_enhancing_cancel
- hide_equipment_enhance_windows
- end
- end
- #==============================================================
- # * Scene_Item
- #==============================================================
- class Scene_Item < Scene_ItemBase
- alias :ic_eqp_scit_start :start
- def start
- ic_eqp_scit_start
- @enhance_window = Window_EnhanceEquipment.new
- @enhance_window.set_handler(:cancel, method(:on_enhancing_cancel))
- @enhance_base_window = Window_EquipmentItemBase.new
- @eqpoints_window = Window_EquipmentPoints.new
- @enhance_window.points_window = @eqpoints_window
- end
- alias :ic_eqp_scit_itwin :create_item_window
- def create_item_window
- ic_eqp_scit_itwin
- @item_window.set_handler(:enhance_item, method(:on_enhance_item))
- end
- def on_enhance_item
- return unless @item_window.item
- return unless @item_window.item.is_a?(RPG::Weapon) || @item_window.item.is_a?(RPG::Armor)
- show_equipment_enhance_windows
- @enhance_window.item = @item_window.item
- @enhance_base_window.item = @item_window.item
- end
- def show_equipment_enhance_windows
- @viewport.rect.x = @viewport.ox = 0
- @viewport.rect.width = 0
- @enhance_window.show.activate
- @enhance_base_window.show.activate
- @eqpoints_window.show.activate
- end
- def hide_equipment_enhance_windows
- @viewport.rect.x = @viewport.ox = 0
- @viewport.rect.width = Graphics.width
- @enhance_window.hide.deactivate
- @enhance_base_window.hide.deactivate
- @eqpoints_window.hide.deactivate
- @item_window.refresh
- @item_window.activate
- end
- def on_enhancing_cancel
- hide_equipment_enhance_windows
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- #==============================================================
- # * Window_ItemList
- #==============================================================
- class Window_ItemList < Window_Selectable
- alias :ic_eqp_winsel_prohan :process_handling
- def process_handling
- ic_eqp_winsel_prohan
- return process_enhance_item if handle?(:enhance_item) && Input.trigger?(:X) && $game_party.eq_enhancing_enabled
- end
- def process_enhance_item
- return if item == nil || (!item.is_a?(RPG::Weapon) && !item.is_a?(RPG::Armor))
- return if item.no_enhancing
- Sound.play_cursor
- Input.update
- deactivate
- call_handler(:enhance_item)
- end
- end
- #==============================================================
- # * Window_EnhanceEquipment
- #==============================================================
- class Window_EnhanceEquipment < Window_Selectable
- attr_reader :item
- attr_accessor :points_window
- def initialize
- super(0, line_height*5, Graphics.width/3+8, line_height*9)
- self.visible = false
- @points_window = nil
- @item = nil
- @param = 0
- end
- def item=(it)
- @item = it
- select(0)
- refresh
- end
- def make_item_list
- @data = @item.params
- end
- def item_max
- @data ? @data.size : 1
- end
- def draw_item(index)
- param = @data[index]
- if $data_system.terms.params[index]
- rect = item_rect(index)
- rect.width -= 4
- draw_text(rect, $data_system.terms.params[index])
- draw_text(rect, param.to_s,2)
- end
- end
- def refresh
- make_item_list
- create_contents
- draw_all_items
- @points_window.refresh
- end
- def update
- super
- if active
- last_param = @param
- update_params
- if @param != last_param
- Sound.play_cursor
- refresh
- end
- end
- end
- def update_params
- if Input.trigger?(:LEFT)
- if $game_party.eqp > 0
- @item.params[@index] -= (@index == 0 || @index == 1) ? 10 : 1
- $game_party.eqp -= EQP_ENHANCING_VALUE
- refresh
- Sound.play_cursor
- else
- Sound.play_buzzer
- end
- elsif Input.trigger?(:RIGHT)
- if $game_party.eqp > 0
- @item.params[@index] += (@index == 0 || @index == 1) ? 10 : 1
- $game_party.eqp -= EQP_ENHANCING_VALUE
- refresh
- Sound.play_cursor
- else
- Sound.play_buzzer
- end
- end
- end
- end
- #==============================================================
- # * Window_EquipmentItemBase
- #==============================================================
- class Window_EquipmentItemBase < Window_Selectable
- attr_reader :item
- def initialize
- super(0,0,Graphics.width, line_height*5)
- self.visible = false
- @item = nil
- end
- def item=(it)
- @item = it
- refresh
- end
- def draw_horz_line(y)
- line_y = y + line_height / 2 - 1
- contents.fill_rect(0, line_y, contents_width, 2, line_color)
- end
- def line_color
- color = normal_color
- color.alpha = 48
- color
- end
- def refresh
- contents.clear
- xx = contents.text_size(@item.name).width
- draw_icon(@item.icon_index, (width-xx)/2-32,0)
- change_color(system_color)
- draw_text(0,0,width,line_height,@item.name,1)
- change_color(normal_color)
- draw_horz_line(line_height*1)
- draw_text_ex(0,line_height*2,@item.description)
- end
- end
- #==============================================================
- # * Window_EquipmentPoints
- #==============================================================
- class Window_EquipmentPoints < Window_Selectable
- def initialize
- super(0,line_height*14,Graphics.width/3+8, Graphics.height-line_height*14)
- self.visible = false
- end
- def refresh
- contents.clear
- change_color(system_color)
- draw_text(0,0,width,line_height, EQUIPMENT_POINTS_TERM)
- change_color(normal_color)
- draw_text_ex(0,line_height,$game_party.eqp)
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- #==============================================================
- # * RPG::BaseItem
- #==============================================================
- class RPG::BaseItem
- def no_enhancing
- return self.note.include?("<no_enhancing>")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement