Battle : Command Memory
Version: 3.5
By: Kain Nobel
Introduction
With this, your input is memorized for commands and stuff selected during battle. This is a feature that is often found in games, such as the ever-popular Final Fantasy series, which allows you to set Battle Cursor to Default or Memory.
Features
Script
Instructions
Place Below SDK (only if using) and Above Main! If using DerVVulfMan's Grouping & Details script, place below that system or it probably won't work correctly.
Credit and Thanks
SP27 : Requesting Patch for DerVVulfman's Grouping and Details
Compatibility
Works with or without the SDK. Now includes a patch for DerVVulfman's Grouping and Details script too!
Enjoy :thumb:
Terms and Conditions
Another "Free to use in commercial and non-commercial games" script, but credit is required thanks!
Version: 3.5
By: Kain Nobel
Introduction
With this, your input is memorized for commands and stuff selected during battle. This is a feature that is often found in games, such as the ever-popular Final Fantasy series, which allows you to set Battle Cursor to Default or Memory.
Features
- Works with DerVVulfman's Grouping & Details system (*NEW*)
- Actors memorize their last selected battle command
- Actors memorize their last selected skill or item
- Actors memorize their last selected actor or enemy targets
- All actors memory is cleared when battle ends
Script
Battle : Command Memory
Spoiler
- #===============================================================================
- # ** Battle : Command Memory
- #===============================================================================
- #-------------------------------------------------------------------------------
- # * SDK Log
- #-------------------------------------------------------------------------------
- if Object.const_defined?(:SDK) && SDK.method_defined?(:log)
- SDK.log('Battle.CommandMemory', 'Kain Nobel ©', 3.5, '2009.06.17')
- end
- #===============================================================================
- # ** RGSS.Actor and Party Info (should be in next MACL update)
- #===============================================================================
- class Game_Actors
- #-----------------------------------------------------------------------------
- # * Name : Each
- # Info : Adds an 'each' method to $game_actors
- # Author : Kain Nobel
- # Call Info : Any normal way you'd use an 'each' method from an object
- #-----------------------------------------------------------------------------
- def each(&block)
- @data.each(&block)
- end
- end
- #===============================================================================
- # ** Game_Actor
- #===============================================================================
- class Game_Actor
- #-----------------------------------------------------------------------------
- # * Public Instance Variables
- #-----------------------------------------------------------------------------
- attr_accessor :battle_memory_command
- attr_accessor :battle_memory_skill
- attr_accessor :battle_memory_item
- attr_accessor :battle_memory_actor
- attr_accessor :battle_memory_enemy
- #-----------------------------------------------------------------------------
- # * Clear Battle Memory
- #-----------------------------------------------------------------------------
- def clear_battle_memory
- @battle_memory_command = nil
- @battle_memory_skill = nil
- @battle_memory_item = nil
- @battle_memory_actor = nil
- @battle_memory_enemy = nil
- end
- end
- #===============================================================================
- # ** Window_Command
- #===============================================================================
- class Window_Command < Window_Selectable
- #-----------------------------------------------------------------------------
- # * Command
- #-----------------------------------------------------------------------------
- def command(index = self.index)
- @commands[index]
- end unless self.method_defined?(:command)
- #-----------------------------------------------------------------------------
- # * Commands
- #-----------------------------------------------------------------------------
- def commands
- @commands
- end unless self.method_defined?(:commands)
- #-----------------------------------------------------------------------------
- # * Command = (command)
- #-----------------------------------------------------------------------------
- def command=(com)
- for i in 0..@commands.size
- if @commands[i] == com
- self.index = i
- break
- end
- end
- end
- end
- #===============================================================================
- # ** Window_Skill
- #===============================================================================
- class Window_Skill < Window_Selectable
- #-----------------------------------------------------------------------------
- # * Public Instance Variables
- #-----------------------------------------------------------------------------
- attr_reader :data
- end
- #===============================================================================
- # ** Window_Item
- #===============================================================================
- class Window_Item < Window_Selectable
- #-----------------------------------------------------------------------------
- # * Public Instance Variables
- #-----------------------------------------------------------------------------
- attr_reader :data
- end
- #===============================================================================
- # ** Scene_Battle
- #===============================================================================
- class Scene_Battle
- #-----------------------------------------------------------------------------
- # * Alias Listings
- #-----------------------------------------------------------------------------
- alias_method :bcmem_snbattle_main, :main
- alias_method :bcmem_snbattle_p3setupcomwindow, :phase3_setup_command_window
- alias_method :bcmem_snbattle_p3updatebasiccom, :update_phase3_basic_command
- alias_method :bcmem_snbattle_startactorselect, :start_actor_select
- alias_method :bcmem_snbattle_startenemyselect, :start_enemy_select
- alias_method :bcmem_snbattle_startsklselect, :start_skill_select
- alias_method :bcmem_snbattle_startitmselect, :start_item_select
- alias_method :bcmem_snbattle_endactorselect, :end_actor_select
- alias_method :bcmem_snbattle_endenemyselect, :end_enemy_select
- alias_method :bcmem_snbattle_endsklselect, :end_skill_select
- alias_method :bcmem_snbattle_enditmselect, :end_item_select
- alias_method :bcmem_snbattle_makeitmactresult, :make_item_action_result
- #-----------------------------------------------------------------------------
- # * Main
- #-----------------------------------------------------------------------------
- def main
- bcmem_snbattle_main
- $game_actors.each do |a|
- next unless a.is_a?(Game_Actor)
- a.clear_battle_memory
- end
- end
- #-----------------------------------------------------------------------------
- # * Phase 3 : Setup Command Window
- #-----------------------------------------------------------------------------
- def phase3_setup_command_window
- bcmem_snbattle_p3setupcomwindow
- return unless @active_battler
- command = @active_battler.battle_memory_command
- if @actor_command_window.commands.include?(command)
- @actor_command_window.command = command
- else
- @active_battler.battle_memory_command = nil
- end
- end
- #-----------------------------------------------------------------------------
- # * Phase 3 : Basic Command
- #-----------------------------------------------------------------------------
- def update_phase3_basic_command
- if Input.trigger?(Input::C)
- @active_battler.battle_memory_command = @actor_command_window.command
- end
- bcmem_snbattle_p3updatebasiccom
- end
- #-----------------------------------------------------------------------------
- # * Start Actor Select
- #-----------------------------------------------------------------------------
- def start_actor_select
- bcmem_snbattle_startactorselect
- unless @active_battler.battle_memory_actor.nil?
- actor = @active_battler.battle_memory_actor
- if $game_party.actors.include?(actor)
- @actor_arrow.index = actor.index
- else
- @active_battler.battle_memory_actor = nil
- end
- end
- end
- #-----------------------------------------------------------------------------
- # * Start Enemy Select
- #-----------------------------------------------------------------------------
- def start_enemy_select
- bcmem_snbattle_startenemyselect
- unless @active_battler.battle_memory_enemy.nil?
- enemy = @active_battler.battle_memory_enemy
- if $game_troop.enemies.include?(enemy)
- @enemy_arrow.index = enemy.index
- else
- @active_battler.battle_memory_enemy = nil
- end
- end
- end
- #-----------------------------------------------------------------------------
- # * Start Skill Select
- #-----------------------------------------------------------------------------
- def start_skill_select
- bcmem_snbattle_startsklselect
- unless @active_battler.battle_memory_skill.nil?
- for i in 0..@skill_window.data.size
- if @skill_window.data[i].id == @active_battler.battle_memory_skill
- @skill_window.index = i
- break
- end
- end
- end
- end
- #-----------------------------------------------------------------------------
- # * Start Item Select
- #-----------------------------------------------------------------------------
- def start_item_select
- bcmem_snbattle_startitmselect
- unless @active_battler.battle_memory_item.nil?
- for i in 0..@item_window.data.size
- if @item_window.data[i].id == @active_battler.battle_memory_item
- @item_window.index = i
- break
- end
- end
- end
- end
- #-----------------------------------------------------------------------------
- # * End Actor Select
- #-----------------------------------------------------------------------------
- def end_actor_select
- actor = $game_party.actors[@actor_arrow.index]
- @active_battler.battle_memory_actor = actor
- bcmem_snbattle_endactorselect
- end
- #-----------------------------------------------------------------------------
- # * End Enemy Select
- #-----------------------------------------------------------------------------
- def end_enemy_select
- enemy = $game_troop.enemies[@enemy_arrow.index]
- @active_battler.battle_memory_enemy = enemy
- bcmem_snbattle_endenemyselect
- end
- #-----------------------------------------------------------------------------
- # * End Skill Select
- #-----------------------------------------------------------------------------
- def end_skill_select
- @active_battler.battle_memory_skill = @skill_window.skill.id
- bcmem_snbattle_endsklselect
- end
- #-----------------------------------------------------------------------------
- # * End Item Select
- #-----------------------------------------------------------------------------
- def end_item_select
- @active_battler.battle_memory_item = @item_window.item.id
- bcmem_snbattle_enditmselect
- end
- #-----------------------------------------------------------------------------
- # * Make Item Action Results
- #-----------------------------------------------------------------------------
- def make_item_action_result
- bcmem_snbattle_makeitmactresult
- item_id = @active_battler.current_action.item_id
- unless $game_party.item_number(item_id) > 0
- @active_battler.battle_memory_item = nil
- end
- end
- end
- #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
- #===============================================================================
- # ** Battle : Command Memory (DerVVulfman's Grouping & Details Patch)
- #===============================================================================
- #-------------------------------------------------------------------------------
- # * Grouping & Detail Test : Begin
- #-------------------------------------------------------------------------------
- if Object.const_defined?(:Window_ItemGroup) &&
- Object.const_defined?(:Window_SkillGroup)
- #===============================================================================
- # ** Game_Actor
- #===============================================================================
- class Game_Actor < Game_Battler
- #-----------------------------------------------------------------------------
- # * Public Instance Variables
- #-----------------------------------------------------------------------------
- attr_accessor :battle_memory_Gitem
- attr_accessor :battle_memory_Gskill
- #-----------------------------------------------------------------------------
- # * Alias Listings
- #-----------------------------------------------------------------------------
- alias_method :bcmemGNDpatch_gmactor_clearbattlememory, :clear_battle_memory
- #-----------------------------------------------------------------------------
- # * Clear Battle Memory
- #-----------------------------------------------------------------------------
- def clear_battle_memory
- bcmemGNDpatch_gmactor_clearbattlememory
- @battle_memory_Gitem = nil
- @battle_memory_Gskill = nil
- end
- end
- #===============================================================================
- # ** Scene_Battle
- #===============================================================================
- class Scene_Battle
- #-----------------------------------------------------------------------------
- # * Alias Listings
- #-----------------------------------------------------------------------------
- alias_method :bcmemGNDpatch_snbattle_startitmselect, :start_item_select
- alias_method :bcmemGNDpatch_snbattle_enditmselect, :end_item_select
- alias_method :bcmemGNDpatch_snbattle_startsklselect, :start_skill_select
- alias_method :bcmemGNDpatch_snbattle_endsklselect, :end_skill_select
- #-----------------------------------------------------------------------------
- # * Start Item Select
- #-----------------------------------------------------------------------------
- def start_item_select
- bcmemGNDpatch_snbattle_startitmselect
- return if @active_battler.battle_memory_Gitem.nil?
- return unless GROUP_ITEMS_ON
- if @item_group_window.active
- @item_group_window.index = @active_battler.battle_memory_Gitem
- end
- end
- #-----------------------------------------------------------------------------
- # * End Item Select
- #-----------------------------------------------------------------------------
- def end_item_select
- if GROUP_ITEMS_ON
- @active_battler.battle_memory_Gitem = @item_group_window.index
- end
- bcmemGNDpatch_snbattle_enditmselect
- end
- #-----------------------------------------------------------------------------
- # * Start Skill Select
- #-----------------------------------------------------------------------------
- def start_skill_select
- bcmemGNDpatch_snbattle_startsklselect
- return if @active_battler.battle_memory_Gskill.nil?
- return unless GROUP_SKILL_ON
- if @skill_group_window.active
- @skill_group_window.index = @active_battler.battle_memory_Gskill
- end
- end
- #-----------------------------------------------------------------------------
- # * End Skill Select
- #-----------------------------------------------------------------------------
- def end_skill_select
- if GROUP_SKILL_ON
- @active_battler.battle_memory_Gskill = @skill_group_window.index
- end
- bcmemGNDpatch_snbattle_endsklselect
- end
- end
- #-------------------------------------------------------------------------------
- # * Grouping & Detail Test : End
- #-------------------------------------------------------------------------------
- end
Expand to see the code.
Instructions
Place Below SDK (only if using) and Above Main! If using DerVVulfMan's Grouping & Details script, place below that system or it probably won't work correctly.
Credit and Thanks
SP27 : Requesting Patch for DerVVulfman's Grouping and Details
Compatibility
Works with or without the SDK. Now includes a patch for DerVVulfman's Grouping and Details script too!
Enjoy :thumb:
Terms and Conditions
Another "Free to use in commercial and non-commercial games" script, but credit is required thanks!
