if true # make false to disable script. true = enabled#===============================================================================#
http://dekitarpg.wordpress.com/#===============================================================================# # Tomb Of Lost Art #5 )- Unbreakable.# #===============================================================================## This script re-creates my interpretation of the limit break system from# final fantasy 7. # As the theme was 'unbreakable', I have included the ability to notetag a # state so that when the state is applied, your characters cannot break their # limit. ie.. their limit is 'unbreakable' # # NOTE: # THIS SCRIPT REQUIRES THE $D13x CORE SCRIPT TO FUNCTION. #
http://dekitarpg.wordpress.com/2013/03/14/d13x-core/#===============================================================================# # You are not allowed to use this script for commercial games !!# You are not allowed to repost/translate/convert this script for any reason.# #===============================================================================#
http://dekitarpg.wordpress.com/#===============================================================================module Limit_Break#=============================================================================== #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- Vocab = { :menu_command => "Limit", :battle_command => "Limit Skill", :change_help => "View skill data and change active limit.", :leave_help => "Leave Scene", } #----------------------------------------------------------------------------- # Notetag used in states to disallow limit break. # <unbreakable> #----------------------------------------------------------------------------- Notetag = /<unbreakable>/i #----------------------------------------------------------------------------- # true = override attack command # false = place new command above it #----------------------------------------------------------------------------- Override = true #----------------------------------------------------------------------------- # Hash of actor id => [limit skilll id, limit skilll id, limit skilll id, ...] #----------------------------------------------------------------------------- Limits = { 1 =>[118,119,120,121,122,123,124,125], # << Actor 1 2 =>[118,119,120,121,122,123,124,125], # << Actor 2 3 =>[118,119,120,121,122,123,124,125], # << Actor 3 4 =>[118,119,120,121,122,123,124,125], # << Actor 4 5 =>[118,119,120,121,122,123,124,125], # << Actor 5 6 =>[118,119,120,121,122,123,124,125], # << Actor 6 7 =>[118,119,120,121,122,123,124,125], # << Actor 7 8 =>[118,119,120,121,122,123,124,125], # << Actor 8 9 =>[118,119,120,121,122,123,124,125], # << Actor 9 10 =>[118,119,120,121,122,123,124,125], # << Actor 10 } #----------------------------------------------------------------------------- # Customization Section End. # There is really no point in trying to edit below this line... #-----------------------------------------------------------------------------end#===============================================================================#
http://dekitarpg.wordpress.com/#===============================================================================class RPG::State < RPG::BaseItem#=============================================================================== #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def unbreakable? if @unbreakable.nil? @unbreakable = false if self.note =~ Limit_Break::Notetag @unbreakable = true end end @unbreakable end #----------------------------------------------------------------------------- # #-----------------------------------------------------------------------------end#===============================================================================class Game_Battler < Game_BattlerBase#=============================================================================== #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- alias :use_item_for_limit :use_item #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def use_item(item) process_limit_counter(item) use_item_for_limit(item) end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def process_limit_counter(i) return unless self.is_a?(Game_Actor) add_limit_counter if can_process_limit_count?(i) end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def can_process_limit_count?(i) all_limit_skills.include?(i.id) end #----------------------------------------------------------------------------- # #-----------------------------------------------------------------------------end#===============================================================================class Game_Actor < Game_Battler#=============================================================================== #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- alias :setup_limits :setup #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def setup(actor_id) setup_limits(actor_id) setup_limit_break end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def setup_limit_break @current_limit_skill_id = Limit_Break::Limits[@actor_id].first @current_limit_arraypos = 0 @times_used_limits = [0] * Limit_Break::Limits[@actor_id].size end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def all_limit_skills Limit_Break::Limits[@actor_id] end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def limit_skill $data_skills[@current_limit_skill_id] end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def limit_count(limit_id) @times_used_limits[limit_id] end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def limit_unlocked?(limit_id) return true if limit_id == 0 return @times_used_limits[limit_id-1] >= ((limit_id) * 10) end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def add_limit_counter @times_used_limits[@current_limit_arraypos] += 1 end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def set_limit_skill(array_pos) return unless Limit_Break::Limits[@actor_id][array_pos] return unless Limit_Break::Limits[@actor_id][array_pos] != @current_limit_skill_id @current_limit_skill_id = Limit_Break::Limits[@actor_id][array_pos] @current_limit_arraypos = array_pos end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def can_limit_break? return false unless tp >= max_tp return false if states.compact.any? {|s| s.unbreakable? } return true end #----------------------------------------------------------------------------- # #-----------------------------------------------------------------------------end#===============================================================================class Window_CurrentLimit < Window_Selectable#=============================================================================== #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def initialize(actor,y) super(0, y, Graphics.width, fitting_height(1)) @actor = actor refresh end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def actor=(actor) return if @actor == actor @actor = actor refresh end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def refresh contents.clear text = "Current Limit : #{@actor.limit_skill.name}" draw_text(0, 0, width-24, line_height, text ,1) end #----------------------------------------------------------------------------- # #-----------------------------------------------------------------------------end#===============================================================================class Window_LimitCommand < Window_Command#=============================================================================== #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def initialize super(0, 0) end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def window_width return Graphics.width / 4 end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def visible_line_number return 2 end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def make_command_list add_command("Change Limit", :change) add_command("Leave", :leave) end #----------------------------------------------------------------------------- # #-----------------------------------------------------------------------------end#===============================================================================class Window_LimitSelect < Window_Command#=============================================================================== #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def initialize(actor,y) @actor = actor @window_y = y super(0, y) deactivate unselect end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def actor=(actor) return unless @actor != actor @actor = actor refresh end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def window_width return Graphics.width end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def window_height return Graphics.height - @window_y end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def col_max return 2 end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def make_command_list return unless @actor && Limit_Break::Limits[@actor.id] i = 0 Limit_Break::Limits[@actor.id].each do |val| add_command($data_skills[val].name, :limit_change, limit_locked?(i), val) i += 1 end end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def limit_locked?(id) @actor.limit_unlocked?(id) end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def current_limit command_skill(@index) end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def command_skill(index) return $data_skills[0] unless @list[index] && @list[index][:ext] return $data_skills[@list[index][:ext]] end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def draw_item(index) change_color(normal_color, limit_locked?(index)) p = item_rect_for_text(index) draw_text(p.x,p.y,p.width,line_height,command_skill(index).name, 1) draw_text(p.x,p.y+20,p.width,line_height,@actor.limit_count(index).to_s, 1) end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def item_height (self.height - 24) / 4 end #----------------------------------------------------------------------------- # #-----------------------------------------------------------------------------end#===============================================================================class Scene_Limit < Scene_MenuBase#=============================================================================== #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def start super make_command_window make_help_window make_status_window make_current_window make_select_window end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def make_command_window @command_window = Window_LimitCommand.new @command_window.set_handler
:)change, method
:)change_limit)) @command_window.set_handler
:)leave, method
:)return_scene)) @command_window.set_handler
:)cancel, method
:)return_scene)) @command_window.set_handler
:)pagedown, method
:)next_actor)) @command_window.set_handler
:)pageup, method
:)prev_actor)) end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def make_help_window @help_window = Deki_Help.new @help_window.x = Graphics.width / 4 end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def make_status_window @status_window = Window_StatusDekita.new(@actor,@help_window.height) end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def make_current_window y = @status_window.y + @status_window.height @current_window = Window_CurrentLimit.new(@actor,y) end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def make_select_window y = @current_window.y + @current_window.height @select_window = Window_LimitSelect.new(@actor,y) @select_window.set_handler
:)limit_change, method
:)set_limit)) @select_window.set_handler
:)cancel , method
:)bk2com)) end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def change_limit @command_window.deactivate @select_window.select(0) @select_window.activate end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def set_limit Sound.play_equip @actor.set_limit_skill(@select_window.index) @status_window.refresh @current_window.refresh bk2com end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def bk2com @select_window.deactivate @select_window.unselect @command_window.activate end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def update super updt_help end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def updt_help if @select_window.active @help_window.set_text(@select_window.current_limit.description) elsif @command_window.active case @command_window.current_symbol when :change then @help_window.set_text(Limit_Break::Vocab[:change_help]) when :leave then @help_window.set_text(Limit_Break::Vocab[:leave_help]) end else @help_window.set_text("") end end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def on_actor_change @status_window.actor = @actor @current_window.actor = @actor @select_window.actor = @actor @command_window.activate end #----------------------------------------------------------------------------- # #-----------------------------------------------------------------------------end#===============================================================================class Window_MenuCommand < Window_Command#=============================================================================== #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- alias :amc_limits :add_main_commands #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def add_main_commands amc_limits add_command(Limit_Break::Vocab[:menu_command],:limit,main_commands_enabled) end #----------------------------------------------------------------------------- # #-----------------------------------------------------------------------------end#===============================================================================class Scene_Menu < Scene_MenuBase#=============================================================================== #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- alias :ccw_limits_longassaliasname :create_command_window alias
:opoklimitz_longassaliasname
:on_personal_ok #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def create_command_window ccw_limits_longassaliasname @command_window.set_handler
:)limit, method
:)command_personal)) end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def on_personal_ok opoklimitz_longassaliasname if @command_window.current_symbol == :limit SceneManager.call(Scene_Limit) end end #----------------------------------------------------------------------------- # #-----------------------------------------------------------------------------end#===============================================================================class Window_ActorCommand < Window_Command#=============================================================================== #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def add_attack_command if @actor.can_limit_break? add_command(Limit_Break::Vocab[:battle_command], :limit) unless Limit_Break:
:override add_command(Vocab::attack, :attack, @actor.attack_usable?) end else add_command(Vocab::attack, :attack, @actor.attack_usable?) end end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def draw_item(index) if index == 0 && @actor.can_limit_break? change_color(Text_Color:
:Deep_Orange) else change_color(normal_color, command_enabled?(index)) end draw_text(item_rect_for_text(index), command_name(index), alignment) end #----------------------------------------------------------------------------- # #-----------------------------------------------------------------------------end#===============================================================================class Scene_Battle < Scene_Base#=============================================================================== #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- alias :limit_command :create_actor_command_window #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def create_actor_command_window limit_command @actor_command_window.set_handler
:)limit, method
:)command_limit)) end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def command_limit @skill = BattleManager.actor.limit_skill BattleManager.actor.input.set_skill(@skill.id) BattleManager.actor.last_skill.object = @skill if !@skill.need_selection? @skill_window.hide next_command elsif @skill.for_opponent? select_enemy_selection else select_actor_selection end end #----------------------------------------------------------------------------- # #-----------------------------------------------------------------------------end#===============================================================================#
http://dekitarpg.wordpress.com/#===============================================================================end # if false / true