Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if true # << Make true to use this script, false to disable.
- #===============================================================================
- #
- # ☆ $D13x - Battle Rows
- # -- Author : Dekita
- # -- Version : 1.2
- # -- Level : Easy / Normal
- # -- Requires : N/A
- # -- Engine : RPG Maker VX Ace.
- #
- #===============================================================================
- # ☆ Import
- #-------------------------------------------------------------------------------
- $D13x={}if$D13x==nil
- $D13x[:Battle_Rows]=true
- #===============================================================================
- # ☆ Updates
- #-------------------------------------------------------------------------------
- # D /M /Y
- # 14/o6/2o13 - Update, (row status')
- # 31/o5/2o13 - Update, (:normal / :basic modes)
- # 3o/o5/2o13 - Finished,
- # 18/o5/2o13 - Started
- #
- #===============================================================================
- # ☆ Introduction
- #-------------------------------------------------------------------------------
- # This script creates "Battle Rows".
- # Most people should know what this feature is, as its a very well known
- # aspect of most RPG games..
- #
- # For people who dont know..
- # Battle Rows allow you to have different rows while in battle..
- # EG. front row / middle row / back row, typically if you are in the front row
- # your damage output will be higher, but so will the damage recieved.
- # middle row damage is normal for both damage dealt and recived.
- # Back row damage (recieved & dealt) is reduced.
- #
- # A new command will be added to the actor command battle window,
- # This command will change your current row position.
- # You can only change your row position while in battle.
- #
- # Basically, this allows for slightly more tactical thinking while in battles.
- #
- # NOTICE:
- # If you can design a "good looking" screen for changing rows / formation
- # during the menu screen, i will happily add that feature into the script.
- # The reason i have not already implimented the ability to change row via menu
- # is because i could not think of how i wanted to place the information..
- # If you wish to take up this task, feel free, but be warned..
- # i am very very picky with how my information is displayed :p
- #
- #===============================================================================
- # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
- #===============================================================================
- # 1. You MUST give credit to "Dekita" !!
- # 2. You are NOT allowed to repost this script.(or modified versions)
- # 3. You are NOT allowed to convert this script.
- # 4. You are NOT allowed to use this script for Commercial games.
- # 5. ENJOY!
- #
- # "FINE PRINT"
- # By using this script you hereby agree to the above terms and conditions,
- # if any violation of the above terms occurs "legal action" may be taken.
- # Not understanding the above terms and conditions does NOT mean that
- # they do not apply to you.
- # If you wish to discuss the terms and conditions in further detail you can
- # contact me at http://dekitarpg.wordpress.com/
- #
- #===============================================================================
- # ☆ Instructions
- #-------------------------------------------------------------------------------
- # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
- #
- #===============================================================================
- # ☆ Notetags ( default )
- #-------------------------------------------------------------------------------
- # <row: X>
- # replace X with the row position, 0 = front, 1 = middle, 2 = back
- # For use with actors / classes / enemies
- #
- # <long range>
- # add this notetag to increase the range of an actor/enemy,
- # this notetag can be given to Actors / Classes / Equip / States / Enemies
- #
- # <fixed row>
- # add this notetag to Actors / Classes to disable changing rows.
- #
- #===============================================================================
- # ☆ HELP
- #-------------------------------------------------------------------------------
- # You should not need any..
- #
- #===============================================================================
- module Rows
- #===============================================================================
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # ☆ Settings
- #-----------------------------------------------------------------------------
- # This is the default row for all actors and enemies.
- # Reccommended to be 1 (middle row).
- Default_Row = 1
- #-----------------------------------------------------------------------------
- # These are the vocab settings for row information.
- Vocab = {
- :main => "Swap Row" ,
- :frnt => "Front Row" ,
- :midd => "Middle Row",
- :back => "Back Row" ,
- }
- #-----------------------------------------------------------------------------
- # this is the id of the switch to hide the row command.
- # keep 0 to always enable row command.
- Switch = 0
- #-----------------------------------------------------------------------------
- # These are the damage settings for each row. The values represent the damage
- # multipier for that row. The format is..
- # :type => [front, middle, back]
- DMG={
- :dealt => [ 2.0 , 1.0 , 0.5 ],
- :taken => [ 2.0 , 1.0 , 0.5 ],
- }
- #-----------------------------------------------------------------------------
- # Shows Row Info On Main Menu Screen. Make false to disable.
- Show_Row_Info = true
- #-----------------------------------------------------------------------------
- # Changes the row selection mode..
- # :normal = player can select which row to change to
- # :basic = row will automatically change between front / back rows (0 & 2)
- # depending on the actors current row.
- Mode = :normal
- #-----------------------------------------------------------------------------
- # Notetag Settings. Only change if you understand what your doing !!
- Notes={
- :_row_ => /<row:(.*)>/i,
- :range => /<long range>/i,
- :fixed => /<fixed row>/i
- }
- #-----------------------------------------------------------------------------
- # Status Settings. change nil to the id of the status for frnt/midd/back row.
- States={
- :frnt => 27,
- :midd => 28,
- :back => 29,
- }
- #####################
- # CUSTOMISATION END #
- end #####################
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
- # #
- # http://dekitarpg.wordpress.com/ #
- # #
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
- #===============================================================================#
- # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
- # YES?\.\. #
- # OMG, REALLY? \| #
- # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
- # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
- #===============================================================================#
- module DataManager
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- class << self
- alias :lbd_rows :load_database
- end
- #-----------------------------------------------------------------------------
- # Load Database (alias)
- #-----------------------------------------------------------------------------
- def self.load_database
- lbd_rows
- loa_rows
- end
- #-----------------------------------------------------------------------------
- # Load Unique Shit
- #-----------------------------------------------------------------------------
- def self.loa_rows
- classes = [ $data_weapons , $data_armors , $data_actors ,
- $data_classes , $data_enemies , $data_states ]
- for g in classes
- for o in g
- next if o == nil
- o.load_rows
- end
- end
- end
- end # DataManager
- #===============================================================================
- class RPG::BaseItem
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Pi Variables
- #-----------------------------------------------------------------------------
- attr_accessor :battle_row
- attr_accessor :battle_row_range
- attr_accessor :battle_row_fixed
- #-----------------------------------------------------------------------------
- # Load Unique Notes
- #-----------------------------------------------------------------------------
- def load_rows
- @battle_row = nil
- @battle_row_range = 0
- @battle_row_fixed = false
- self.note.split(/[\r\n]+/).each do |line|
- case line
- when Rows::Notes[:_row_] then @battle_row = $1.to_i
- when Rows::Notes[:range] then @battle_row_range = 1
- when Rows::Notes[:fixed] then @battle_row_fixed = true
- end
- end
- end
- end
- #===============================================================================
- class Game_Battler < Game_BattlerBase
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :apply_VAR_rows :apply_variance
- alias :__MDV__Rows :make_damage_value
- alias :ref_rows :refresh
- alias :add_State_for_row :add_state
- alias :rem_State_for_row :remove_state
- #-----------------------------------------------------------------------------
- # Object Initialization
- #-----------------------------------------------------------------------------
- attr_accessor :battle_row
- #-----------------------------------------------------------------------------
- # M.D.V
- #-----------------------------------------------------------------------------
- def make_damage_value(user, item)
- @row_user = user
- @row_item = item
- __MDV__Rows(user, item)
- end
- #-----------------------------------------------------------------------------
- # Apply Variance Mod
- #-----------------------------------------------------------------------------
- def apply_variance(damage, variance)
- orig = apply_VAR_rows(damage, variance)
- rowm = apply_row_mods
- newd = (orig * rowm).to_i
- newd = 1 if ((orig != newd) && ((orig > 0) && (newd <= 0)))
- newd
- end
- #-----------------------------------------------------------------------------
- # Get Row Damage Modification
- #-----------------------------------------------------------------------------
- def apply_row_mods
- user = @row_user
- item = @row_item
- deal = Rows::DMG[:dealt][user.battle_row_range]
- took = Rows::DMG[:taken][self.battle_row_range]
- return (deal * took)
- end
- #-----------------------------------------------------------------------------
- # Refresh
- #-----------------------------------------------------------------------------
- def refresh
- ref_rows
- set_battle_row
- refresh_row_state
- end
- #-----------------------------------------------------------------------------
- # Refresh Row Status
- #-----------------------------------------------------------------------------
- def refresh_row_state
- return unless @can_battle_row
- frnt = Rows::States[:frnt]
- midd = Rows::States[:midd]
- back = Rows::States[:back]
- case battle_row_range
- when 0 then add_state(frnt) ; remove_state(midd) ; remove_state(back)
- when 1 then add_state(midd) ; remove_state(frnt) ; remove_state(back)
- when 2 then add_state(back) ; remove_state(frnt) ; remove_state(midd)
- end
- end
- #-----------------------------------------------------------------------------
- # Add State
- #-----------------------------------------------------------------------------
- def add_state(state_id)
- return if state_id == nil
- add_State_for_row(state_id)
- end
- #-----------------------------------------------------------------------------
- # Remove State
- #-----------------------------------------------------------------------------
- def remove_state(state_id)
- return if state_id == nil
- rem_State_for_row(state_id)
- end
- end
- #===============================================================================
- class Game_Actor < Game_Battler
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :init______rows :initialize
- #-----------------------------------------------------------------------------
- # Object Initialization
- #-----------------------------------------------------------------------------
- def initialize(actor_id)
- init______rows(actor_id)
- set_battle_row
- @can_battle_row = true
- end
- #-----------------------------------------------------------------------------
- # Set Battle Row
- #-----------------------------------------------------------------------------
- def set_battle_row
- @battle_row = Rows::Default_Row
- @battle_row = self.class.battle_row if self.class.battle_row != nil
- @battle_row = actor.battle_row if actor.battle_row != nil
- end
- #-----------------------------------------------------------------------------
- # Get Battle Row (with range mods)
- #-----------------------------------------------------------------------------
- def battle_row_range
- base = @battle_row
- base += actor.battle_row_range
- base += self.class.battle_row_range
- base += equips.compact.inject(0) {|r, i| r += i.battle_row_range}
- base += states.compact.inject(0) {|r, i| r += i.battle_row_range }
- base >= 2 ? 2 : base
- end
- #-----------------------------------------------------------------------------
- # Is Battle Row Fixed ?
- #-----------------------------------------------------------------------------
- def battle_row_fixed
- return true if self.class.battle_row_fixed
- return true if actor.battle_row_fixed
- return false
- end
- end
- #===============================================================================
- class Game_Enemy < Game_Battler
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :init______rows :initialize
- #-----------------------------------------------------------------------------
- # Object Initialization
- #-----------------------------------------------------------------------------
- def initialize(index, enemy_id)
- init______rows(index, enemy_id)
- set_battle_row
- @can_battle_row = true
- end
- #-----------------------------------------------------------------------------
- # Set Battle Row
- #-----------------------------------------------------------------------------
- def set_battle_row
- @battle_row = Rows::Default_Row
- @battle_row = enemy.battle_row if enemy.battle_row != nil
- end
- #-----------------------------------------------------------------------------
- # Get Battle Row (with range mods)
- #-----------------------------------------------------------------------------
- def battle_row_range
- base = @battle_row
- base += enemy.battle_row_range
- base += states.compact.inject(0) {|r, i| r += i.battle_row_range }
- base >= 2 ? 2 : base
- end
- end
- #===============================================================================
- class Window_ActorCommand < Window_Command
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Pi Variables
- #-----------------------------------------------------------------------------
- attr_reader :actor
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :mcl_row_formation :make_command_list
- #-----------------------------------------------------------------------------
- # Create Command List
- #-----------------------------------------------------------------------------
- def make_command_list
- mcl_row_formation
- add_row_command
- end
- #-----------------------------------------------------------------------------
- # Add Row Command to List
- #-----------------------------------------------------------------------------
- def add_row_command
- return unless $game_switches[Rows::Switch] if Rows::Switch != 0
- add_command(Rows::Vocab[:main], :row_change, enable_row_change?)
- end
- #-----------------------------------------------------------------------------
- # Enable Row Change
- #-----------------------------------------------------------------------------
- def enable_row_change?
- return false unless @actor
- return false if @actor.battle_row_fixed
- return true
- end
- end
- #===============================================================================
- class Window_Base < Window
- #===============================================================================
- if Rows::Show_Row_Info
- #---------------------------------------------------------------------------
- # Alias List
- #---------------------------------------------------------------------------
- alias :dass_row_formation :draw_actor_simple_status
- #---------------------------------------------------------------------------
- # Draw Simple Status
- #---------------------------------------------------------------------------
- def draw_actor_simple_status(actor, x, y)
- dass_row_formation(actor, x, y)
- draw_battle_row(actor, x, y+(line_height*2))
- end
- #---------------------------------------------------------------------------
- # Draw Battle Row
- #---------------------------------------------------------------------------
- def draw_battle_row(actor, x, y)
- case actor.battle_row
- when 0 then text = Rows::Vocab[:frnt]
- when 1 then text = Rows::Vocab[:midd]
- when 2 then text = Rows::Vocab[:back]
- end
- draw_text(x, y, 108, line_height, text)
- end
- end
- end
- #===============================================================================
- class Window_RowCommand < Window_Command
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Pi Variables
- #-----------------------------------------------------------------------------
- attr_accessor :actor
- #-----------------------------------------------------------------------------
- # Object Initialization
- #-----------------------------------------------------------------------------
- def initialize
- super(0, 0)
- update_placement
- self.openness = 0
- @actor = nil
- deactivate
- close
- end
- #-----------------------------------------------------------------------------
- # Get Window Width
- #-----------------------------------------------------------------------------
- def window_width
- return Graphics.width / 4
- end
- #-----------------------------------------------------------------------------
- # Alignment
- #-----------------------------------------------------------------------------
- def alignment
- return 1
- end
- #-----------------------------------------------------------------------------
- # Update Window Position
- #-----------------------------------------------------------------------------
- def update_placement
- self.x = (Graphics.width - width) / 2
- self.y = (Graphics.height - height) / 2
- end
- #-----------------------------------------------------------------------------
- # Create Command List
- #-----------------------------------------------------------------------------
- def make_command_list
- add_command(Rows::Vocab[:frnt], :fron_row, enable_row?(0))
- add_command(Rows::Vocab[:midd], :midd_row, enable_row?(1))
- add_command(Rows::Vocab[:back], :back_row, enable_row?(2))
- end
- #-----------------------------------------------------------------------------
- # Enable Row Position ?
- #-----------------------------------------------------------------------------
- def enable_row?(pos)
- return false unless @actor
- return false if @actor.battle_row == pos
- return true
- end
- end
- #===============================================================================
- class Scene_Battle < Scene_Base
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :cacw_row_firmatioio :create_actor_command_window
- alias :caw__row_fomaiontns :create_all_windows
- #-----------------------------------------------------------------------------
- # Create All Windows
- #-----------------------------------------------------------------------------
- def create_all_windows
- caw__row_fomaiontns
- create_row_commands
- end
- #-----------------------------------------------------------------------------
- # Create Actor Commands Window
- #-----------------------------------------------------------------------------
- def create_actor_command_window
- cacw_row_firmatioio
- @actor_command_window.set_handler(:row_change, method(:command_rows))
- end
- #-----------------------------------------------------------------------------
- # Create Row Command Window
- #-----------------------------------------------------------------------------
- def create_row_commands
- @rcmndwind = Window_RowCommand.new
- @rcmndwind.set_handler(:back_row, method(:com_change_rows))
- @rcmndwind.set_handler(:midd_row, method(:com_change_rows))
- @rcmndwind.set_handler(:fron_row, method(:com_change_rows))
- @rcmndwind.set_handler(:cancel, method(:com_cancel_rows))
- end
- #-----------------------------------------------------------------------------
- # [Swap Row] Command
- #-----------------------------------------------------------------------------
- def command_rows
- return command_rows_basic if Rows::Mode == :basic
- @rcmndwind.actor = @actor_command_window.actor
- @rcmndwind.refresh
- @rcmndwind.activate
- @rcmndwind.open
- end
- #-----------------------------------------------------------------------------
- # [Swap Row] Command [ :basic ]
- #-----------------------------------------------------------------------------
- def command_rows_basic
- actor = @actor_command_window.actor
- case actor.battle_row
- when 0,1 then actor.battle_row = 2
- when 2 then actor.battle_row = 0
- end ; on_actor_ok
- end
- #-----------------------------------------------------------------------------
- # Set New Row
- #-----------------------------------------------------------------------------
- def com_change_rows
- actor = @actor_command_window.actor
- case @rcmndwind.current_symbol
- when :fron_row then actor.battle_row = 0
- when :midd_row then actor.battle_row = 1
- when :back_row then actor.battle_row = 2
- end
- @rcmndwind.deactivate
- @rcmndwind.close
- on_actor_ok
- end
- #-----------------------------------------------------------------------------
- # Swap Row [Cancel]
- #-----------------------------------------------------------------------------
- def com_cancel_rows
- @rcmndwind.deactivate
- @rcmndwind.close
- @actor_command_window.activate
- end
- end
- #==============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #==============================================================================#
- end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement