[XP] Battle Memory Commands

Started by G_G, July 21, 2009, 04:14:47 pm

Previous topic - Next topic

G_G

July 21, 2009, 04:14:47 pm Last Edit: April 13, 2013, 01:30:29 am by gameus
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


  • Memorizes Battle Commands
  • Memorizes Last Skill Used
  • Memorizes Last Item Used (If item is owned)
  • Resets Memory at Beginning of Each Battle



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

  • @actor_command_window
  • @skill_window
  • @item_window

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 (1.0 or above) then place this script below


Credits and Thanks


  • game_guy ~ for making it
  • Kain Nobel ~ for making an SDK version which inspired me to do this
  • Fantasist ~ for improved version of code



Author's Notes

Enjoy and give credits.

Fantasist


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:
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




G_G

July 22, 2009, 10:48:54 am #2 Last Edit: July 22, 2009, 01:57:07 pm by game_guy
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

Ryex

I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

G_G

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.

Fantasist

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...
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




G_G

Added a few instructions to check battle system compatibility.

G_G


PrinceEndymion88

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? :)

KK20

February 07, 2015, 12:25:16 am #9 Last Edit: February 07, 2015, 12:26:43 am by KK20
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

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

PrinceEndymion88


PhoenixFire

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.
Quote from: Subsonic_Noise on July 01, 2011, 02:42:19 amNext off, how to create a first person shooter using microsoft excel.

Quote from: Zeriab on September 09, 2011, 02:58:58 pm<Remember when computers had turbo buttons?