Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: G_G on July 21, 2009, 04:14:47 pm

Title: [XP] Battle Memory Commands
Post by: G_G on July 21, 2009, 04:14:47 pm
Battle Memory Commands
Authors: gameus
Version: 1.3
Type: Command Memorizing System
Key Term: Battle Add-on



Introduction

What this script does is memorize actions during battle. So if actor 1 attacks and actor 2 defends. The cursor will be on attack for actor 1, and the cursor will still be on defend for actor 2.


Features




Screenshots

N/A


Demo

N/A


Script

Spoiler: ShowHide

#===============================================================================
# Battle Memory Commands
# Version: 1.3
# Author: gameus
#===============================================================================
# Intro:
# What this script does is memorize actions during battle. So if actor 1 attacks
# and actor 2 defends. The cursor will be on attack for actor 1, and the cursor
# will still be on defend for actor 2.
#
# Features:
# Memorizes Battle Commands
# Memorizes Last Skill Used
# Memorizes Last Item Used (If item is still owned)
#
# Instructions:
# Place in a new script above main. Below any battle systems used.
#
# Compatibility:
# Not tested with SDK
# Not tested with any custom battle systems
# If using with Skill Categories (1.0 or above) then place this script below
#
# Credits:
# gameus ~ for making it
# Kain Nobel ~ for making an SDK version which inspired me to do this
#===============================================================================

#-------------------------------------------------------------------------------
# Scene_Battle
#-------------------------------------------------------------------------------

class Scene_Battle
 
  alias gg_reset_memory_main main
  def main
    $game_party.actors.each {|a| a.reset_memory }
    gg_reset_memory_main
  end
 
  alias set_command_memory phase3_setup_command_window
  def phase3_setup_command_window
    set_command_memory
    @actor_command_window.index = @active_battler.command_memory
  end
 
  alias get_command_memory update_phase3_basic_command
  def update_phase3_basic_command
    if Input.trigger?(Input::C)
      @active_battler.command_memory = @actor_command_window.index
    end
    get_command_memory
  end
 
  alias set_skill_memory update_phase3_skill_select
  def update_phase3_skill_select
    if Input.trigger?(Input::C)
      if $gg_skill_categories != nil && $gg_skill_categories >= 1.0 &&
          @actor_command_window.index != 1
        index = @actor_command_window.index
        cat = @actor_command_window.commands[index]
        @active_battler.category_memory[cat] = @skill_window.index
        if index == 1
          @active_battler.skill_memory = @skill_window.index
        end
      else
        @active_battler.skill_memory = @skill_window.index
      end
    end
    set_skill_memory
  end
 
  alias set_item_memory update_phase3_item_select
  def update_phase3_item_select
    if Input.trigger?(Input::C)
      @active_battler.item_memory = @item_window.index
    end
    set_item_memory
  end
 
  alias get_skill_memory start_skill_select
  def start_skill_select
    get_skill_memory
    if $gg_skill_categories != nil && $gg_skill_categories >= 1.0 &&
        @actor_command_window.index != 1
      index = @actor_command_window.index
      cat = @actor_command_window.commands[index]
      @skill_window.index = @active_battler.category_memory[cat]
      if index == 1
        @skill_window.index = @active_battler.skill_memory
      end
      return
    end
    @skill_window.index = @active_battler.skill_memory
  end
 
  alias get_item_memory start_item_select
  def start_item_select
    get_item_memory
    @item_window.index = @active_battler.item_memory
  end
 
end

#-------------------------------------------------------------------------------
# Game_Actor
#-------------------------------------------------------------------------------

class Game_Actor < Game_Battler
 
  attr_accessor :command_memory
  attr_accessor :skill_memory
  attr_accessor :item_memory
  attr_accessor :category_memory
 
  alias gg_set_memory_vars initialize
  def initialize(actor_id)
    reset_memory
    gg_set_memory_vars(actor_id)
  end
 
  def reset_memory
    @command_memory = 0
    @skill_memory = 0
    @item_memory = 0
    @category_memory = {}
    if $gg_skill_categories != nil && $gg_skill_categories >= 1.0
      Gameus::SKILL_SETS.each_key {|key| @category_memory[key] = 0 }
    end
  end
 
end



Instructions

Place in a new script above main. Below any battle systems used.

Checking Compatibility:
Make sure the following variables in the script exist

To check search through the battle system by pressing Ctrl + F then search each of the
variables to see if they exist.

If so then this script will work. If not post here requesting me to make this script
compatible with any battle system (Except Blizz ABS because I think it'd be useless xD)


Compatibility

Not tested with SDK
Not tested with any custom battle systems
If using with Skill Categories (http://forum.chaos-project.com/index.php/topic,13055.new.html) (1.0 or above) then place this script below


Credits and Thanks




Author's Notes

Enjoy and give credits.
Title: Re: [XP] Battle Memory Commands
Post by: Fantasist on July 22, 2009, 07:28:17 am

def update_phase3_basic_command
    if Input.trigger?(Input::C)
      case @actor_command_window.index
      when 0
        @active_battler.memory = 0
      when 1
        @active_battler.memory = 1
      when 2
        @active_battler.memory = 2
      when 3
        @active_battler.memory = 3
      end
    end
    change_actor_index
  end


You could simply...

def update_phase3_basic_command
    if Input.trigger?(Input::C)
      @active_battler.memory = @actor_command_window.index
    end
    change_actor_index
  end


Otherwise, good job :up:
Title: Re: [XP] Battle Memory Commands
Post by: G_G on July 22, 2009, 10:48:54 am
Fixed Thanks Fantasist

I see why that words in your name now. You're always asisting people



EDIT:

Updated to 1.1
Now memorizes last skill and item used
Title: Re: [XP] Battle Memory Commands
Post by: Ryex on July 23, 2009, 01:18:02 am
Dose it work with AnTBS?  :naughty:
Title: Re: [XP] Battle Memory Commands
Post by: G_G on July 23, 2009, 07:58:47 am
I'll test it. Like I said I havent tested it with any custom battle systems. But if anyones willing to help me by doing this I'd be much obliged.
But for it to work the custom battle system has to have the same command window.
Title: Re: [XP] Battle Memory Commands
Post by: Fantasist on July 24, 2009, 07:28:51 am
QuoteI see why that words in your name now. You're always asisting people

Wow, I never realized it till now o.o I named myself that because I think I'm hopelessly dependent on unreality...
Title: Re: [XP] Battle Memory Commands
Post by: G_G on August 22, 2009, 01:33:18 pm
Added a few instructions to check battle system compatibility.
Title: Re: [XP] Battle Memory Commands
Post by: G_G on April 13, 2013, 01:19:29 am
Updated to work with my new script, Skill Categories.
http://forum.chaos-project.com/index.php/topic,13055.new.html#new
Title: Re: [XP] Battle Memory Commands
Post by: PrinceEndymion88 on February 06, 2015, 06:01:03 am
Quote from: gameus on April 13, 2013, 01:19:29 am
Updated to work with my new script, Skill Categories.
http://forum.chaos-project.com/index.php/topic,13055.new.html#new


Can you make it compatible with CCOA 3.04 EX Battle System? :)
Title: Re: [XP] Battle Memory Commands
Post by: KK20 on February 07, 2015, 12:25:16 am
Place below everything related to the battle system.

#===============================================================================
# Battle Memory Commands
# Version: 1.3
# Author: gameus
#===============================================================================
# Intro:
# What this script does is memorize actions during battle. So if actor 1 attacks
# and actor 2 defends. The cursor will be on attack for actor 1, and the cursor
# will still be on defend for actor 2.
#
# Features:
# Memorizes Battle Commands
# Memorizes Last Skill Used
# Memorizes Last Item Used (If item is still owned)
#
# Instructions:
# Place in a new script above main. Below any battle systems used.
#
# Compatibility:
# Not tested with SDK
# Not tested with any custom battle systems
# If using with Skill Categories (1.0 or above) then place this script below
#
# Credits:
# gameus ~ for making it
# Kain Nobel ~ for making an SDK version which inspired me to do this
#===============================================================================

#-------------------------------------------------------------------------------
# Scene_Battle
#-------------------------------------------------------------------------------

class Scene_Battle
 
  alias gg_reset_memory_main main
  def main
    $game_party.actors.each {|a| a.reset_memory }
    gg_reset_memory_main
  end
 
  alias set_command_memory phase3_setup_command_window
  def phase3_setup_command_window
    set_command_memory
    @actor_command_windows[@actor_index].index = @active_battler.command_memory #<=====
  end
 
  alias get_command_memory update_phase3_basic_command
  def update_phase3_basic_command
    if Input.trigger?(Input::C)
      @active_battler.command_memory = @actor_command_windows[@actor_index].index #<=====
    end
    get_command_memory
  end
 
  alias set_skill_memory update_phase3_skill_select
  def update_phase3_skill_select
    if Input.trigger?(Input::C)
      if $gg_skill_categories != nil && $gg_skill_categories >= 1.0 &&
          @actor_command_window.index != 1
        index = @actor_command_window.index
        cat = @actor_command_window.commands[index]
        @active_battler.category_memory[cat] = @skill_window.index
        if index == 1
          @active_battler.skill_memory = @skill_window.index
        end
      else
        @active_battler.skill_memory = @skill_window.index
      end
    end
    set_skill_memory
  end
 
  alias set_item_memory update_phase3_item_select
  def update_phase3_item_select
    if Input.trigger?(Input::C)
      @active_battler.item_memory = @item_window.index
    end
    set_item_memory
  end
 
  alias get_skill_memory start_skill_select
  def start_skill_select(*args) #<=====
    get_skill_memory(*args) #<=====
    if $gg_skill_categories != nil && $gg_skill_categories >= 1.0 &&
        @actor_command_window.index != 1
      index = @actor_command_window.index
      cat = @actor_command_window.commands[index]
      @skill_window.index = @active_battler.category_memory[cat]
      if index == 1
        @skill_window.index = @active_battler.skill_memory
      end
      return
    end
    @skill_window.index = @active_battler.skill_memory
  end
 
  alias get_item_memory start_item_select
  def start_item_select(*args) #<=====
    get_item_memory(*args) #<=====
    @item_window.index = @active_battler.item_memory
  end
 
end

#-------------------------------------------------------------------------------
# Game_Actor
#-------------------------------------------------------------------------------

class Game_Actor < Game_Battler
 
  attr_accessor :command_memory
  attr_accessor :skill_memory
  attr_accessor :item_memory
  attr_accessor :category_memory
 
  alias gg_set_memory_vars initialize
  def initialize(actor_id)
    reset_memory
    gg_set_memory_vars(actor_id)
  end
 
  def reset_memory
    @command_memory = 0
    @skill_memory = 0
    @item_memory = 0
    @category_memory = {}
    if $gg_skill_categories != nil && $gg_skill_categories >= 1.0
      Gameus::SKILL_SETS.each_key {|key| @category_memory[key] = 0 }
    end
  end
 
end
Title: Re: [XP] Battle Memory Commands
Post by: PrinceEndymion88 on February 07, 2015, 11:47:34 am
really thanks, I'll try :D
Title: Re: [XP] Battle Memory Commands
Post by: PhoenixFire on February 11, 2015, 08:23:57 am
This would be very cool to see as a VXA port. Love the idea, surprised I didn't see it until now because of the last request on it.