Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================
- # Battle Item & Skill Use Limits
- # Autor skryptu: Narzew
- # Bazowano na skrypcie Ayene
- #===============================================
- ############################################################
- #**Battle Item & Skill Use Limits
- #**Narzew
- #**Based work on Ayene script.
- ############################################################
- #11.04.12 - Script Start Date
- #11.04.12 - Script Completed Date V 1.0
- #23.02.14 - Script Completed Date V 1.01
- #V 1.01
- ############################################################
- #**Instructions:
- #**$itemuselimit[id] = limit of item use
- #**$skilluselimit[id] = limit of skill use
- #**Module BattleUseLimits
- #**change_itemuselimit
- #**In: Id (Integer)
- #**In: Modifier (Value - add, remove, set (with no quotes))
- #**In: Value (Integer)
- #**Out: Nil (Operation)
- #**DescEn: Changes the item id x use limit
- #**DescPl: Zwiększa limit użyć przedmiotu o id x
- #**change_skilluselimit
- #**In: Id (Integer)
- #**In: Modifier (Value - add, remove, set (with no quotes))
- #**In: Value (Integer)
- #**Out: Nil (Operation)
- #**DescEn: Changes the skill id x use limit
- #**DescPl: Zwiększa limit użyć czaru o id x
- ############################################################
- $itemuselimit = {
- 1=>3,
- 2=>3,
- 4=>1
- }
- $skilluselimit = {
- 1=>2,
- 2=>1
- }
- module BattleUseLimits
- def self.change_itemuselimit(id, modifier, value)
- case modifier
- when 0 then $itemuselimit[id] += value
- when 1 then $itemuselimit[id] -= value
- when 2 then $itemuselimit[id] = value
- end
- end
- def self.change_skilluselimit(id, modifier, value)
- case modifier
- when 0 then $skilluselimit[id] += value
- when 1 then $skilluselimit[id] -= value
- when 2 then $skilluselimit[id] = value
- end
- end
- end
- class Game_Temp
- attr_accessor :battle_item_used
- attr_accessor :battle_skill_used
- alias aye_gamtemp_ini initialize
- def initialize
- aye_gamtemp_ini
- @battle_item_used = {}
- @battle_skill_used = {}
- end
- end
- class Window_Skill < Window_Selectable
- def draw_item(index)
- skill = @data[index]
- if @actor.skill_can_use?(skill.id)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- if $game_temp.battle_skill_used.include?(skill.id)
- if $game_temp.battle_skill_used[skill.id] >= $skilluselimit[skill.id]
- self.contents.font.color = disabled_color
- end
- end
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(skill.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
- self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
- end
- end
- class Window_Item < Window_Selectable
- def draw_item(index)
- item = @data[index]
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- if item.is_a?(RPG::Item) and
- $game_party.item_can_use?(item.id)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- if $game_temp.battle_item_used.include?(item.id)
- if $game_temp.battle_item_used[item.id] >= $itemuselimit[item.id]
- self.contents.font.color = disabled_color
- end
- end
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
- end
- end
- class Scene_Battle
- alias aye_scbat_update_phase3_skill_select update_phase3_skill_select
- def update_phase3_skill_select
- if Input.trigger?(Input::C)
- @skill = @skill_window.skill
- if $game_temp.battle_skill_used.include?(@skill.id)
- if $game_temp.battle_skill_used[@skill.id] >= $skilluselimit[@skill.id]
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- end
- end
- aye_scbat_update_phase3_skill_select
- end
- alias aye_scbat_update_phase3_item_select update_phase3_item_select
- def update_phase3_item_select
- if Input.trigger?(Input::C)
- @item = @item_window.item
- if $game_temp.battle_item_used.include?(@item.id)
- if $game_temp.battle_item_used[@item.id] >= $itemuselimit[@item.id]
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- end
- end
- aye_scbat_update_phase3_item_select
- end
- alias aye_scbat_make_skill_action_result make_skill_action_result
- def make_skill_action_result
- @skill = $data_skills[@active_battler.current_action.skill_id]
- skill_number = $game_temp.battle_skill_used.include?(@skill.id) ?
- $game_temp.battle_skill_used[@skill.id] : 0
- $game_temp.battle_skill_used[@skill.id] = skill_number + 1
- aye_scbat_make_skill_action_result
- end
- alias aye_scbat_make_item_action_result make_item_action_result
- def make_item_action_result
- @item = $data_items[@active_battler.current_action.item_id]
- item_number = $game_temp.battle_item_used.include?(@iteml.id) ?
- $game_temp.battle_item_used[@iteml.id] : 0
- $game_temp.battle_item_used[@item.id] = item_number + 1
- aye_scbat_make_item_action_result
- end
- alias aye_scbat_battle_end battle_end
- def battle_end(result)
- $game_temp.battle_skill_used.clear
- $game_temp.battle_item_used.clear
- aye_scbat_battle_end(result)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement