Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[VX] Custom Commands

Custom Commands
by Dargor
Version 1.16


Introduction

Here it is, the little brother of the XP Commands Manager script!
This scripting tool deals with general commands such as Menu, Party and Actor commands.
It helps modifying these commands without having to worry about their index in the window.
NEW: Version 1.5 supports commands substitution based on actor's class ID.
Search for
Code:
 

class RPG::Class

 
and edit the @commands array.

IMPORTANT: READ THE NOTES BELOW!

Features
  • Supports Menu, Title, Party and Actor Commands
  • Commands are now 'String Based' (Instead of 'Index Based')
  • Add/remove any commands of any windows at any index
  • Support for commands substitutes (based on an actor class ID)
  • Support command icons
  • Support message codes (Color, Variable & Name) in command ans item names
  • Can make flashy rainbow commands!
  • Comes with a template for Custom Battle Commands!

Screenshots


Script

Read the script comments carefully before using this it!
Code:
#==============================================================================

# ** Custom Commands

#------------------------------------------------------------------------------

#  © Dargor, 2008-2009

#  18/12/09

#  Version 1.16

#------------------------------------------------------------------------------

#  VERSION HISTORY:

#   - 1.0   (09/03/08), Initial release

#   - 1.1   (15/03/08), Added support for Party Commands

#   - 1.2   (15/03/08), Added support for Actor Commands

#   - 1.2.1 (15/03/08), Bug fixed with Selectable Window's contents

#   - 1.3   (24/03/08), Added the 'Selection' method to Window_Selectable

#   - 1.4   (08/05/08), Works with the 'Selection' method

#   - 1.5   (08/06/08), Added support for command substitution based

#                         on an actor's class ID

#   - 1.6   (13/06/08), Added support for Title Screen Commands

#   - 1.7   (13/06/08), Bug fixed when disabling default commands

#   - 1.7.1 (16/06/08), Increased compatibility

#   - 1.8   (18/06/08), Menu Index has been corrected when comming back of

#                       default scenes (Item/Skill/Equip/Status/Save/End).

#   - 1.9   (18/06/08), Added support for enabling/disabling commands.

#   - 1.9.1 (05/09/08), Minor revisions

#   - 1.10  (07/09/08), Added support for command icons

#   - 1.11  (16/02/09), Added support for message codes in command names

#   - 1.12  (16/02/09), Added a "Rainbow" command feature

#   - 1.13  (16/02/09), Added support for message codes in item names

#   - 1.14  (23/02/09), Fixed a bug when drawing command names

#   - 1.15  (03/03/09), Fixed a bug with font characters width

#   - 1.16  (18/12/09), Fixed a bug with icon placement in horizontal commands

#------------------------------------------------------------------------------

#  INSTRUCTIONS:

#     1) Place this script above all custom scripts and below all 

#         default scripts

#     2) To change the default menu commands, use:

#           - $game_system.menu_commands = [string1, string2...]

#               or

#           - $game_system.add_menu_command(index, command)

#               or

#           - $game_system.remove_menu_command(command)

#     3) To change the default party commands, use:

#           - $game_system.party_commands = [string1, string2...]

#               or

#           - $game_system.add_party_command(index, command)

#               or

#           - $game_system.remove_party_command(command)

#     4) To change an actor's battle commands, use:

#           - $game_actors[id].commands = [string1, string2...]

#               or

#           - $game_actors[id].add_command(index, command)

#               or

#           - $game_actors[id].remove_command(command)

#------------------------------------------------------------------------------

#  NOTES:

#     - When using the following methods:

#             > $game_system.add_menu_command(index, command)

#             > $game_system.remove_menu_command(command)

#             > $game_system.add_party_command(index, command)

#             > $game_system.remove_party_command(command)

#             > $game_actors[id].add_command(index, command)

#             > $game_actors[id].remove_command(command)

#       'command' can be a String or an Array

#     - This script overides the following methods:

#             > Window_PartyCommand 

#               <> initialize

#             > Window_ActorCommand

#               <> initialize

#               <> setup

#             > Scene_Menu

#               <> create_command_window

#               <> update_command_selection

#               <> update_actor_selection

#             > Scene_Battle

#               <> update_party_command_selection

#               <> update_actor_command_selection

#         This script will be incompatible with any other scripts 

#         modifying these methodsunless they are based on the 

#         Custom Commands script methods.

#     - Some message codes are available for command and item names:

#             > Color Change: \C[x]

#             > Variable:     \V[x]

#             > Actor Name:   \N[x]

#==============================================================================

        

module Custom_Commands

  # Temporary System Data

  $data_system = load_data('Data/System.rvdata')

  # Maximum number of commands visible at the same time in the

  # command windows

  Menu_Item_Max = 7

  Party_Item_Max = 4

  Actor_Item_Max = 4

  Title_Item_Max = 3

  # Icon index based on command names

  Icons = {

            # title screen

            Vocab::new_game => 141, 

            Vocab::continue => 133, 

            Vocab::shutdown => 112,

            # main menu

            Vocab::item => 144,

            Vocab::skill => 119, 

            Vocab::equip => 41, 

            Vocab::status => 149, 

            Vocab::save => 159, 

            Vocab::game_end => 112,

            # battle

            Vocab::attack => 2,

            Vocab::guard => 52,

            Vocab::fight => 2,

            Vocab::escape => 48,

            # game end

            Vocab::to_title => 141,

            Vocab::cancel => 143

          }

  # Commands that will flash in rainbow colors

  Rainbow_Commands = []

  # Colors for "Rainbow" commands (color index from windowskin)

  Rainbow_Colors = [1,2,5,10,17]

  # Delay between "Rainbow" commands update

  Rainbow_Frame_Skip = 4

end

 

#==============================================================================

# ** RPG::Class

#------------------------------------------------------------------------------

#  This class handles actors classes.

#==============================================================================

 

class RPG::Class

  #--------------------------------------------------------------------------

  # * Command Name

  # Returns a substitute to command_name. 

  # Returns the original command name if no substitues are found.

  #     command_name : command name

  #--------------------------------------------------------------------------

  def command_name(command)

    # Commands Substitution Array

    @commands = []

    # SYNTAX: @commands[class_ID] = { original_command => substitute }

    @commands[1] = {

                    Vocab::attack => 'Strike',

                    Vocab::item   => 'Things',

                   }

    @commands[2] = {

                    Vocab::guard => 'Protect',

                    Vocab::item  => 'Stuff',

                   }

    # Get command substitute

    if @commands[@id].nil? or @commands[@id][command].nil?

      return command

    end

    return @commands[@id][command]

  end

end

 

#==============================================================================

# ** Game_System

#------------------------------------------------------------------------------

#  This class handles system-related data. Also manages vehicles and BGM, etc.

# The instance of this class is referenced by $game_system.

#==============================================================================

 

class Game_System

  #--------------------------------------------------------------------------

  # * Public Instance Variables

  #--------------------------------------------------------------------------

  attr_accessor :menu_commands

  attr_accessor :party_commands

  attr_accessor :title_commands

  attr_accessor :disabled_menu_commands

  attr_accessor :disabled_party_commands

  attr_accessor :disabled_title_commands

  #--------------------------------------------------------------------------

  # * Alias Listing

  #--------------------------------------------------------------------------

  alias dargor_vx_cmc_system_initialize initialize

  #--------------------------------------------------------------------------

  # * Object Initialization

  #--------------------------------------------------------------------------

  def initialize

    dargor_vx_cmc_system_initialize

    @disabled_menu_commands = {}

    @disabled_party_commands = {}

    @disabled_title_commands = {}

    s1 = Vocab::item

    s2 = Vocab::skill

    s3 = Vocab::equip

    s4 = Vocab::status

    s5 = Vocab::save

    s6 = Vocab::game_end

    @menu_commands = []

    add_menu_command(0,[s1, s2, s3, s4, s5, s6])

    s1 = Vocab::fight

    s2 = Vocab::escape

    @party_commands = []

    add_party_command(0,[s1, s2])

    s1 = Vocab::new_game

    s2 = Vocab::continue

    s3 = Vocab::shutdown

    @title_commands = []

    add_title_command(0,[s1, s2, s3])

  end

  #--------------------------------------------------------------------------

  # * Add Menu Command

  #--------------------------------------------------------------------------

  def add_menu_command(index, command)

    return if @menu_commands.include?(command)

    if command.is_a?(String)

      @menu_commands.insert(index, command)

      @disabled_menu_commands[command] = false

    elsif command.is_a?(Array)

      for i in 0...command.size

        @menu_commands.insert(index+i, command[i])

        @disabled_menu_commands[command[i]] = false

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Add Party Command

  #--------------------------------------------------------------------------

  def add_party_command(index, command)

    return if @party_commands.include?(command)

    if command.is_a?(String)

      @party_commands.insert(index, command)

      @disabled_party_commands[command] = false

    elsif command.is_a?(Array)

      for i in 0...command.size

        @party_commands.insert(index+i, command[i])

        @disabled_party_commands[command[i]] = false

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Add Title Command

  #--------------------------------------------------------------------------

  def add_title_command(index, command)

    return if @title_commands.include?(command)

    if command.is_a?(String)

      @title_commands.insert(index, command)

      @disabled_party_commands[command] = false

    elsif command.is_a?(Array)

      for i in 0...command.size

        @title_commands.insert(index+i, command[i])

        @disabled_title_commands[command[i]] = false

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Remove Menu Command

  #--------------------------------------------------------------------------

  def remove_menu_command(command)

    if command.is_a?(String)

      @menu_commands.delete(command)

    elsif command.is_a?(Array)

      for i in command

        @menu_commands.delete(i)

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Remove Party Command

  #--------------------------------------------------------------------------

  def remove_party_command(command)

    if command.is_a?(String)

      @party_commands.delete(command)

    elsif command.is_a?(Array)

      for i in command

        @party_commands.delete(i)

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Remove Title Command

  #--------------------------------------------------------------------------

  def remove_title_command(command)

    if command.is_a?(String)

      @title_commands.delete(command)

    elsif command.is_a?(Array)

      for i in command

        @party_commands.delete(i)

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Add Menu Command

  #--------------------------------------------------------------------------

  def enable_menu_command(command)

    @disabled_menu_commands[command] = false

  end

  #--------------------------------------------------------------------------

  # * Add Party Command

  #--------------------------------------------------------------------------

  def enable_party_command(command)

    @disabled_party_commands[command] = false

  end

  #--------------------------------------------------------------------------

  # * Add Title Command

  #--------------------------------------------------------------------------

  def enable_title_command(command)

    @disabled_title_commands[command] = false

  end

  #--------------------------------------------------------------------------

  # * Add Menu Command

  #--------------------------------------------------------------------------

  def disable_menu_command(command)

    @disabled_menu_commands[command] = true

  end

  #--------------------------------------------------------------------------

  # * Add Party Command

  #--------------------------------------------------------------------------

  def disable_party_command(command)

    @disabled_party_commands[command] = true

  end

  #--------------------------------------------------------------------------

  # * Add Title Command

  #--------------------------------------------------------------------------

  def disable_title_command(command)

    @disabled_title_commands[command] = true

  end

  #--------------------------------------------------------------------------

  # * Add Menu Command

  #--------------------------------------------------------------------------

  def menu_command_disabled?(command)

    return @disabled_menu_commands[command]

  end

  #--------------------------------------------------------------------------

  # * Add Party Command

  #--------------------------------------------------------------------------

  def party_command_disabled?(command)

    return @disabled_party_commands[command]

  end

  #--------------------------------------------------------------------------

  # * Add Title Command

  #--------------------------------------------------------------------------

  def title_command_disabled?(command)

    return @disabled_title_commands[command]

  end

end

 

#==============================================================================

# ** Game_Interpreter

#------------------------------------------------------------------------------

#  An interpreter for executing event commands. This class is used within the

#  Game_Map, Game_Troop, and Game_Event classes.

#==============================================================================

 

class Game_Interpreter

  #--------------------------------------------------------------------------

  # * Alias Listing

  #--------------------------------------------------------------------------

  alias dargor_vc_cmc_interpreter_command_134 command_134

  alias dargor_vc_cmc_interpreter_command_301 command_301

  #--------------------------------------------------------------------------

  # * Change Save Access

  #--------------------------------------------------------------------------

  def command_134

    if @params[0] == 0

      $game_system.disable_party_command(Vocab::save)

    else

      $game_system.enable_party_command(Vocab::save)

    end

    # The usual

    dargor_vc_cmc_interpreter_command_134

  end

  #--------------------------------------------------------------------------

  # * Battle Processing

  #--------------------------------------------------------------------------

  def command_301

    return true if $game_temp.in_battle

    if @params[2]

      $game_system.enable_party_command(Vocab::escape)

    else

      $game_system.disable_party_command(Vocab::escape)

    end

    # The usual

    dargor_vc_cmc_interpreter_command_301

  end

end

 

#==============================================================================

# ** Game_Actor

#------------------------------------------------------------------------------

#  This class handles actors. It's used within the Game_Actors class

# ($game_actors) and referenced by the Game_Party class ($game_party).

#==============================================================================

 

class Game_Actor < Game_Battler

  #--------------------------------------------------------------------------

  # * Public Instance Variables

  #--------------------------------------------------------------------------

  attr_reader   :commands                   # battle commands

  #--------------------------------------------------------------------------

  # * Alias Listing

  #--------------------------------------------------------------------------

  alias dargor_vx_battle_commands_actor_setup setup

  #--------------------------------------------------------------------------

  # * Setup

  #     actor_id : actor ID

  #--------------------------------------------------------------------------

  def setup(actor_id)

    dargor_vx_battle_commands_actor_setup(actor_id)

    actor = $data_actors[actor_id]

    s1 = self.class.command_name(Vocab::attack)

    s2 = self.class.command_name(Vocab::skill)

    s3 = self.class.command_name(Vocab::guard)

    s4 = self.class.command_name(Vocab::item)

    if self.class.skill_name_valid     # Skill command name is valid?

      s2 = self.class.skill_name       # Replace command name

    end

    @commands = [s1, s2, s3, s4, 'Black']

  end

  #--------------------------------------------------------------------------

  # * Add Command

  #--------------------------------------------------------------------------

  def add_command(index, command)

    return if @commands.include?(command)

    if command.is_a?(String)

      @commands.insert(index, command)

    elsif command.is_a?(Array)

      for i in 0...command.size

        @commands.insert(index+i, command[i])

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Remove Command

  #--------------------------------------------------------------------------

  def remove_command(command)

    if command.is_a?(String)

      @commands.delete(command)

    elsif command.is_a?(Array)

      for i in command

        @commands.delete(i)

      end

    end

  end

end

 

#==============================================================================

# ** Window_Base

#------------------------------------------------------------------------------

#  This is a superclass of all windows in the game.

#==============================================================================

 

class Window_Base < Window

  #--------------------------------------------------------------------------

  # * Draw Item Name

  #     item    : Item (skill, weapon, armor are also possible)

  #     x       : draw spot x-coordinate

  #     y       : draw spot y-coordinate

  #     enabled : Enabled flag. When false, draw semi-transparently.

  #--------------------------------------------------------------------------

  def draw_item_name(item, x, y, enabled = true)

    if item != nil

      draw_icon(item.icon_index, x, y, enabled)

      self.contents.font.color = normal_color

      temp_name = item.name.dup

      temp_name.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }

      temp_name.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }

      temp_name.gsub!(/\\C\[([0-9]+)\]/i) { "\x01[#{$1}]" }

      cx = 0

      loop do

        c = temp_name.slice!(/./m)           # Get next text character

        case c

        when nil

          break

        when "\x01"                       # \C[n]  (text character color change)

          temp_name.sub!(/\[([0-9]+)\]/, "")

          self.contents.font.color = text_color($1.to_i)

          next

        else

          cw = contents.text_size(c).width

          ch = contents.text_size(c).height

          self.contents.font.color.alpha = enabled ? 255 : 128

          self.contents.draw_text(x + cx + 24, y + 2, cw, ch, c)

          cx += cw

        end

      end

      self.contents.font.color = normal_color

    end

  end

end

 

#==============================================================================

# ** Window_Selectable

#------------------------------------------------------------------------------

#  This window contains cursor movement and scroll functions.

#==============================================================================

 

class Window_Selectable < Window_Base

  #--------------------------------------------------------------------------

  # * Selection

  #--------------------------------------------------------------------------

  def selection

    return @commands[self.index]

  end

end

 

#==============================================================================

# ** Window_Command

#------------------------------------------------------------------------------

#  This window deals with general command choices.

#==============================================================================

 

class Window_Command < Window_Selectable

  #--------------------------------------------------------------------------

  # * Alias Listing

  #--------------------------------------------------------------------------

  alias dargor_vx_cmc_window_command_draw_item draw_item

  alias dargor_vx_cmc_window_command_update update

  #--------------------------------------------------------------------------

  # * Draw Item

  #     index   : item number

  #     enabled : enabled flag. When false, draw semi-transparently.

  #--------------------------------------------------------------------------

  def draw_item(index, enabled = true)

    return if index.nil?

    return if @commands[index].nil?

    rect = item_rect(index)

    rect.x += 4

    icon_index = Custom_Commands::Icons[@commands[index]]

    rect.x += 20 unless icon_index.nil?

    rect.width -= 8

    self.contents.clear_rect(rect)

    self.contents.font.color = normal_color

    self.contents.font.color.alpha = enabled ? 255 : 128

    temp_command = @commands[index].dup

    temp_command.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }

    temp_command.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }

    temp_command.gsub!(/\\C\[([0-9]+)\]/i) { "\x01[#{$1}]" }

    cx = 0

    loop do

      c = temp_command.slice!(/./m)           # Get next text character

      case c

      when nil

        break

      when "\x01"                       # \C[n]  (text character color change)

        temp_command.sub!(/\[([0-9]+)\]/, "")

        self.contents.font.color = text_color($1.to_i)

        next

      else

        if Custom_Commands::Rainbow_Commands.include?(@commands[index])

          color = Custom_Commands::Rainbow_Colors[rand(Custom_Commands::Rainbow_Colors.size)]

          self.contents.font.color = text_color(color)

        end

        cw = contents.text_size(c).width

        ch = contents.text_size(c).height

        self.contents.draw_text(rect.x + cx, rect.y, cw, ch, c)

        cx += cw

      end

    end

    draw_icon(icon_index,rect.x - 24,rect.y, enabled) unless icon_index.nil?

  end

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    # The Usual

    dargor_vx_cmc_window_command_update

    # Update "Rainbow" commands

    for command in @commands

      if Custom_Commands::Rainbow_Commands.include?(command)

        index = @commands.index(command)

        if Graphics.frame_count % Custom_Commands::Rainbow_Frame_Skip == 0

          draw_item(index)

        end

      end

    end

  end

end

 

#==============================================================================

# ** Window_PartyCommand

#------------------------------------------------------------------------------

#  This window is used to select whether to fight or escape on the battle

# screen.

#==============================================================================

 

class Window_PartyCommand < Window_Command

  #--------------------------------------------------------------------------

  # * Object Initialization

  #--------------------------------------------------------------------------

  def initialize

    @commands = $game_system.party_commands

    super(128, @commands, 1, 0)

    self.height = 32 + Custom_Commands::Party_Item_Max * WLH

    for i in [email=0...@commands.size]0...@commands.size[/email]

      draw_item(i, !$game_system.party_command_disabled?(@commands[i]))

    end

    self.active = false

  end

end

 

#==============================================================================

# ** Window_ActorCommand

#------------------------------------------------------------------------------

#  This window is used to select actor commands, such as "Attack" or "Skill".

#==============================================================================

 

class Window_ActorCommand < Window_Command

  #--------------------------------------------------------------------------

  # * Object Initialization

  #--------------------------------------------------------------------------

  def initialize

    super(128, [], 1, 4)

    self.active = false

  end

  #--------------------------------------------------------------------------

  # * Setup

  #     actor : actor

  #--------------------------------------------------------------------------

  def setup(actor)

    @commands = actor.commands

    @item_max = @commands.size

    height = 32 + Custom_Commands::Actor_Item_Max * WLH

    self.contents = Bitmap.new(width - 32, (@item_max * WLH))

    refresh

    self.index = 0

  end

end

 

#==============================================================================

# ** Scene_Menu

#------------------------------------------------------------------------------

#  This class performs the menu screen processing.

#==============================================================================

 

class Scene_Menu < Scene_Base

  #--------------------------------------------------------------------------

  # * Create Command Window

  #--------------------------------------------------------------------------

  def create_command_window

    @command_window = Window_Command.new(160, $game_system.menu_commands)

    @command_window.index = @menu_index

    @command_window.height = 8 + Custom_Commands::Menu_Item_Max * 24

    if $game_party.members.size == 0          # If number of party members is 0

      index = $game_system.menu_commands.index(Vocab::item)

      @command_window.draw_item(index, false)     # Disable item

      index = $game_system.menu_commands.index(Vocab::skill)

      @command_window.draw_item(index, false)     # Disable skill

      index = $game_system.menu_commands.index(Vocab::equip)

      @command_window.draw_item(index, false)     # Disable equipment

      index = $game_system.menu_commands.index(Vocab::status)

      @command_window.draw_item(index, false)     # Disable status

    end

    if $game_system.save_disabled             # If save is forbidden

      index = $game_system.menu_commands.index(Vocab::save)

      @command_window.draw_item(index, false)     # Disable save

    end

    for command in $game_system.menu_commands

      index = $game_system.menu_commands.index(command)

      if $game_system.menu_command_disabled?(command)

        @command_window.draw_item(index, false)    # Disable command

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Update Command Selection

  #--------------------------------------------------------------------------

  def update_command_selection

    command = @command_window.selection

    if Input.trigger?(Input::B)

      Sound.play_cancel

      $scene = Scene_Map.new

    elsif Input.trigger?(Input::C)

      if $game_party.members.size == 0 and (command == Vocab::item or

                                            command == Vocab::skill or

                                            command == Vocab::equip or

                                            command == Vocab::status)

        Sound.play_buzzer

        return

      elsif $game_system.save_disabled and command == Vocab::save

        Sound.play_buzzer

        return

      elsif $game_system.menu_command_disabled?(command)

        Sound.play_buzzer

        return

      end

      Sound.play_decision if !$game_system.menu_command_disabled?(command)

      case command

      when Vocab::item

        $scene = Scene_Item.new

      when Vocab::skill,Vocab::equip,Vocab::status

        start_actor_selection

      when Vocab::save

        $scene = Scene_File.new(true, false, false)

      when Vocab::game_end

        $scene = Scene_End.new

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Update Actor Selection

  #--------------------------------------------------------------------------

  def update_actor_selection

    if Input.trigger?(Input::B)

      Sound.play_cancel

      end_actor_selection

    elsif Input.trigger?(Input::C)

      $game_party.last_actor_index = @status_window.index

      Sound.play_decision

      case @command_window.selection

      when Vocab::skill  # skill

        $scene = Scene_Skill.new(@status_window.index)

      when Vocab::equip  # equipment

        $scene = Scene_Equip.new(@status_window.index)

      when Vocab::status  # status

        $scene = Scene_Status.new(@status_window.index)

      end

    end

  end

end

 

#==============================================================================

# ** Scene_Battle

#------------------------------------------------------------------------------

#  This class performs battle screen processing.

#==============================================================================

 

class Scene_Battle < Scene_Base

  #--------------------------------------------------------------------------

  # * Alias Listing

  #--------------------------------------------------------------------------

  alias dargor_vx_custom_commands_battle_create_info_viewport create_info_viewport

  #--------------------------------------------------------------------------

  # * Create Information Display Viewport

  #--------------------------------------------------------------------------

  def create_info_viewport

    dargor_vx_custom_commands_battle_create_info_viewport

    for command in $game_system.party_commands

      index = $game_system.party_commands.index(command)

      if $game_system.party_command_disabled?(command)

        @party_command_window.draw_item(index, false)    # Disable command

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Update Party Command Selection

  #--------------------------------------------------------------------------

  def update_party_command_selection

    if Input.trigger?(Input::C)

      case @party_command_window.selection

      when Vocab::fight  # Fight

        Sound.play_decision

        @status_window.index = @actor_index = -1

        next_actor

      when Vocab::escape  # Escape

        if $game_troop.can_escape == false

          Sound.play_buzzer

          return

        end

        Sound.play_decision

        process_escape

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Update Actor Command Selection

  #--------------------------------------------------------------------------

  def update_actor_command_selection

    skill = Vocab::skill

    if @active_battler.class.skill_name_valid

      skill = @active_battler.class.skill_name

    end

    if Input.trigger?(Input::B)

      Sound.play_cancel

      prior_actor

    elsif Input.trigger?(Input::C)

      case @actor_command_window.selection

      when @active_battler.class.command_name(Vocab::attack)  # Attack

        Sound.play_decision

        @active_battler.action.set_attack

        start_target_enemy_selection

      when skill # Skill

        Sound.play_decision

        start_skill_selection

      when @active_battler.class.command_name(Vocab::guard)  # Guard

        Sound.play_decision

        @active_battler.action.set_guard

        next_actor

      when @active_battler.class.command_name(Vocab::item)  # Item

        Sound.play_decision

        start_item_selection

      end

    end

  end

end

 

#==============================================================================

# ** Scene_Title

#------------------------------------------------------------------------------

#  This class performs the title screen processing.

#==============================================================================

 

class Scene_Title < Scene_Base

  #--------------------------------------------------------------------------

  # * Create Command Window

  #--------------------------------------------------------------------------

  alias dargor_vx_cmc_title_check_continue check_continue

  #--------------------------------------------------------------------------

  # * Create Command Window

  #--------------------------------------------------------------------------

  def create_command_window

    @command_window = Window_Command.new(172, $game_system.title_commands)

    @command_window.x = (544 - @command_window.width) / 2

    @command_window.y = 288

    @command_window.height = 32 + Custom_Commands::Title_Item_Max * 24

    continue_index = $game_system.title_commands.index(Vocab::continue)

    if @continue_enabled                      # If continue is enabled

      @command_window.index = continue_index  # Move cursor over command

    else                                      # If disabled

      @command_window.draw_item(continue_index, false) # Make command semi-transparent

    end

    for command in $game_system.title_commands

      index = $game_system.title_commands.index(command)

      if $game_system.title_command_disabled?(command)

        @command_window.draw_item(index, false)    # Disable command

      end

    end

    @command_window.openness = 0

    @command_window.open

  end

  #--------------------------------------------------------------------------

  # * Determine if Continue is Enabled

  #--------------------------------------------------------------------------

  def check_continue

    # The usual

    dargor_vx_cmc_title_check_continue

    if @continue_enabled

      $game_system.enable_title_command(Vocab::continue)

    else

      $game_system.disable_title_command(Vocab::continue)

    end

  end

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    super

    @command_window.update

    if Input.trigger?(Input::C)

      case @command_window.selection

      when Vocab::new_game    #New game

        command_new_game

      when Vocab::continue    # Continue

        command_continue

      when Vocab::shutdown    # Shutdown

        command_shutdown

      end

    end

  end

end

 

#==============================================================================

# ** Scene_Item

#------------------------------------------------------------------------------

#  This class performs the item screen processing.

#==============================================================================

 

class Scene_Item < Scene_Base

  #--------------------------------------------------------------------------

  # * Return to Original Screen

  #--------------------------------------------------------------------------

  def return_scene

    index = $game_system.menu_commands.index(Vocab::item)

    $scene = Scene_Menu.new(index)

  end

end

 

#==============================================================================

# ** Scene_Skill

#------------------------------------------------------------------------------

#  This class performs the skill screen processing.

#==============================================================================

 

class Scene_Skill < Scene_Base

  #--------------------------------------------------------------------------

  # * Return to Original Screen

  #--------------------------------------------------------------------------

  def return_scene

    index = $game_system.menu_commands.index(Vocab::skill)

    $scene = Scene_Menu.new(index)

  end

end

 

#==============================================================================

# ** Scene_Equip

#------------------------------------------------------------------------------

#  This class performs the equipment screen processing.

#==============================================================================

 

class Scene_Equip < Scene_Base

  #--------------------------------------------------------------------------

  # * Return to Original Screen

  #--------------------------------------------------------------------------

  def return_scene

    index = $game_system.menu_commands.index(Vocab::equip)

    $scene = Scene_Menu.new(index)

  end

end

 

#==============================================================================

# ** Scene_Status

#------------------------------------------------------------------------------

#  This class performs the status screen processing.

#==============================================================================

 

class Scene_Status < Scene_Base

  #--------------------------------------------------------------------------

  # * Return to Original Screen

  #--------------------------------------------------------------------------

  def return_scene

    index = $game_system.menu_commands.index(Vocab::status)

    $scene = Scene_Menu.new(index)

  end

end

 

#==============================================================================

# ** Scene_File

#------------------------------------------------------------------------------

#  This class performs the save and load screen processing.

#==============================================================================

 

class Scene_File < Scene_Base

  #--------------------------------------------------------------------------

  # * Return to Original Screen

  #--------------------------------------------------------------------------

  alias dargor_vx_custom_commands_return_scene return_scene

  #--------------------------------------------------------------------------

  # * Return to Original Screen

  #--------------------------------------------------------------------------

  def return_scene

    if !@from_title && !@from_event

      index = $game_system.menu_commands.index(Vocab::save)

      $scene = Scene_Menu.new(index)

    else

      dargor_vx_custom_commands_return_scene

    end

  end

end

 

#==============================================================================

# ** Scene_End

#------------------------------------------------------------------------------

#  This class performs game end screen processing.

#==============================================================================

 

class Scene_End < Scene_Base

  #--------------------------------------------------------------------------

  # * Return to Original Screen

  #--------------------------------------------------------------------------

  def return_scene

    index = $game_system.menu_commands.index(Vocab::game_end)

    $scene = Scene_Menu.new(index)

  end

end

 

Demo
http://www.mediafire.com/?2oafnsrq0jg

Extra Commands

  • Devour - Requested by Ryuzaki
  • Darkside - Requested by iceplosion
  • Prayer - Requested by wsensor
  • Run - Requested by Chronopro
  • Dargor's Bestiary - Requested by Reikei
  • Lettuce's Stat Points Distribution - Requested by Sesune

Notes

An important note:
This script overrides the following methods:
> Window_PartyCommand
initialize
> Window_ActorCommand
initialize
setup
> Scene_Menu
create_command_window
update_command_selection
update_actor_selection
> Scene_Battle
update_party_command_selection
update_actor_command_selection
This script will be incompatible with any other scripts modifying these methods unless they are based on the Custom Commands script methods.

BE SURE TO PLACE THIS SCRIPT ABOVE EVERY CUSTOM SCRIPTS!

Dargor":12uq5h4m said:
IMPORTANT: I'M NOT TAKING REQUESTS ANYMORE
Please, don't ask for another requests. Thank you for your comprehension. :smile:

Enjoy!
-Dargor
 

Kafei

Member

I have it installed and everything, and I was able to add in a custom battle command for actor 2 just under the 'Attack' option (following the scripting demo you provided). Let's say I want to remove that command once it is used, is it possible to do so by calling a common event with some scripting in it, or what exactly would I need to do? And then if I wanted the command to re-appear for the next battle, how should I go about that? I'm figuring I can set a switch with the common event that will auto-run another common event to turn the switch off, and then the command will reappear, but I need to know the syntax I'd need to use, everything I've tried using doesn't work. (I don't script with Ruby much if you couldn't tell. =p)

Anyway, thanks in advance.

EDIT: Never mind, I figured it out through lots of trial and error.
 
I'm now taking Custom Battle Commands and Menu Commands requests.
When asking for a command, please follow this form:

Name: (name of the command)
Type: (menu/battle/both?)
Description: (short description)
Index: (optional, specify the commands position in the window)
Related Scripts: (if another script is needed, specify the name/version/author)
 

reikei

Member

I am sorry if this isn't the exact format you wanted, but I was a bit confused over the name portion. Did you want my name, or did you want me to name the custom menu? Anyways, here is my request. I have been trying to get it myself for the past couple of hours, but I can't figure out how to modify your script easily.

Name: Bestiary
Type: Menu
Description: Bestiary
Index:
  • Item
  • Skill
  • Equip
  • Status
  • Party
  • Order
  • Bestiary
  • Save
  • Exit Program
Related Scripts: Dargor's bestiary.
 
Here it is reikei.
Place the script bellow the Bestiary.
Code:
#==============================================================================
# ** Custom Commands - Bestiary
#------------------------------------------------------------------------------
#  © Dargor, 2008
#  25/05/08
#  Requested by reikei  
#==============================================================================

# Vocabulary
Vocab::Bestiary = 'Bestiary'

#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs the menu screen processing.
#==============================================================================

class Scene_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias dargor_vx_cmcbestiary_menu_create_command_window create_command_window
  alias dargor_vx_cmcbestiary_menu_update_command_selection update_command_selection
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    commands = $game_system.menu_commands
    index = commands.index(Vocab::save)
    $game_system.add_menu_command(index, Vocab::Bestiary) if $game_system.menu_party_changer
    dargor_vx_cmcbestiary_menu_create_command_window
  end
  #--------------------------------------------------------------------------
  # * Update Command Selection
  #--------------------------------------------------------------------------
  def update_command_selection
    dargor_vx_cmcbestiary_menu_update_command_selection
    command = @command_window.selection
    if Input.trigger?(Input::C)
      Sound.play_decision
      case @command_window.selection
      when Vocab::Bestiary
        $scene = Scene_Bestiary.new(true)
      end
    end
  end
end
#==============================================================================
# ** Scene_Bestiary
#------------------------------------------------------------------------------
#  This class performs the bestiary screen processing.
#==============================================================================

class Scene_Bestiary < Scene_Base
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias dargor_vx_cmcbestiary_update_list_selection update_list_selection
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(from_menu=false)
    @from_menu = from_menu
  end
  #--------------------------------------------------------------------------
  # * Update List Selection
  #--------------------------------------------------------------------------
  def update_list_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      if @from_menu
        index = $game_system.menu_commands.index(Vocab::Bestiary)
        $scene = Scene_Menu.new(index)
      else
        $scene = Scene_Map.new
      end
      return
    end
    dargor_vx_cmcbestiary_update_list_selection
  end
end

By the way, "Name" is the name of the command that will appear in the window. I'm sure you don't want Game_System (Menu Command) to appear in the command window :thumb:

Hope you like it!
 
hey this is from ff4 / ff2jp

Name: Prayer
Type: (battle)
Description: Well in the jap version it would heal your party members by some ammount... not 100% sure how this ammount was done lol..

other info: if you could is there a way to make it so it chooses from 4-5 different skills? I sorta want to make a couple skills get used with it...
like random amounts of healing or just nothing at all... like so if I have 3 skills that heal and 2 that just say your prayers have gone unanswered...
I would like it to choose randomly which ones to use that way its not as if it always heals the same...

Index: under attack or 3rd position
Related Scripts: none that I know of
 
Code:
#==============================================================================
# ** Custom Commands - Prayer
#------------------------------------------------------------------------------
#  © Dargor, 2008
#  25/05/08
#  Requested by wsensor
#==============================================================================

# Command name
Vocab::Prayer = 'Prayer'
Vocab::PrayerFail = "%s's prayer has not been heared..."

# Prayer COmmand Customization Module
module CBC_Prayer
  # Actors with the Prayer command
  Actors = [1,2]
  # Random Skills casted
  Skills = [33,34,35]
  # Success Rate
  # SYNTAX: Actor_ID => Rate (percent)
  Success_Rate = {
                   1 => 75,
                   2 => 60,
                 }
  # ID of the uneffective skill
  # This skill will NEVER be casted.
  Uneffective_Skill = 93
end

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias dargor_vx_cbcprayer_actor_setup setup
  #--------------------------------------------------------------------------
  # * Setup
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def setup(actor_id)
    dargor_vx_cbcprayer_actor_setup(actor_id)
    # Add battle commands
    if CBC_Prayer::Actors.include?(@actor_id)
      # Add 'Prayer' command
      add_command(2, Vocab::Prayer)
    end
  end
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias dargor_vx_cbcprayer_update_actor_command_selection update_actor_command_selection
  alias dargor_vx_cbcprayer_execute_action_skill execute_action_skill
  #--------------------------------------------------------------------------
  # * Update Actor Command Selection
  #--------------------------------------------------------------------------
  def update_actor_command_selection
    dargor_vx_cbcprayer_update_actor_command_selection
    if Input.trigger?(Input::C)
      case @actor_command_window.selection
      when Vocab::Prayer # Prayer Command
        Sound.play_decision
        # Prepare to cast Newclear
        success_rate = rand(100)
        if success_rate < CBC_Prayer::Success_Rate[@active_battler.id]
          skill_id = CBC_Prayer::Skills[rand(CBC_Prayer::Skills.size)]
        else
          skill_id = CBC_Prayer::Uneffective_Skill
        end
        @active_battler.last_skill_id = skill_id
        @active_battler.action.set_skill(skill_id)
        # Force the action to be executed
        @active_battler.action.forcing = true
        # Switch to next actor
        next_actor
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Execute Battle Action: Skill
  #--------------------------------------------------------------------------
  def execute_action_skill
    skill = @active_battler.action.skill
    if skill.id == CBC_Prayer::Uneffective_Skill
      text = sprintf(Vocab::PrayerFail, @active_battler.name)
      @message_window.add_instant_text(text)
      wait(60)
      return
    else
      dargor_vx_cbcprayer_execute_action_skill
    end
  end
end

I added a little customization module. You can randomize prayer skills, set the success rate depending on the actor, choose which actor has the Prayer command and more!
 
so I put this below the command script and add it to party members XD hmm...
oh yea is there a way to make it so they have to have a certain (item in inventory) or equiped equipment?
Item would be easier but I was actually wandering is it possible to set it based on class?
either way works but actually the item/equipment way would work better for me I think

thanks XD I figured since Atemu asked for ff4 skills that I would recommend something about prayer XD

I love that prayer has not been heard haha... what I was originally going to do was set the 2 different skills with failure messages but this works better haha


gonna mess around and make other skills XD

ok well this worked for me and I am using http://rmxp.org/forums/index.php?topic=45777.0
and well lets just say that using the Prayer skill works...
but it casts all 3 skills one after another

hmm ok that might not be right lol hmm ok I seem to have screwed up and made themattack skills

now if only it would show the skill messages
 
wsensor":6z8vq9bh said:
ok well this worked for me and I am using http://rmxp.org/forums/index.php?topic=45777.0
and well lets just say that using the Prayer skill works...
but it casts all 3 skills one after another

hmm ok that might not be right lol hmm ok I seem to have screwed up and made themattack skills

So you're using Tankentai's CBS... I don't guaranty compatibility with this CBS because this one overrides a lot of methods... 
I've designed this script for the Default Battle System.
 
yea ok I also have a default battle system problem for me T_T

script 'game_battleaction' line 212:NoMethodError occurred.
undefined method 'speed' fir buk:nilclass

Code:
  #--------------------------------------------------------------------------
  # * Confirm Action Speed
  #--------------------------------------------------------------------------
  def make_speed
    @speed = battler.agi + rand(5 + battler.agi / 4)
    @speed += skill.speed if skill?
    @speed += item.speed if item?
    @speed += 2000 if guard?
    @speed += 1000 if attack? and battler.fast_attack
  end
 
Name: Darkside
Type: Battle
Description: An attack that has increased power and hits all enemies but uses up a percentage of the users HP
Index: um...in the battle window above Guard
Related Scripts:
 
What's with the FFIV requests? I'd rather see this:

Name: Devour
Type: Battle
Description: Eats the enemy when their HP is low enough and depending on the enemy the character either regains HP, MP or loses HP, MP or is even inflicted with a negative stat!
Related Scripts: I don't think there is a Devour script yet :(
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top