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.

Change Skill to another command

hi there, i was wondering if someone can help make me a small script that allows me to change the battle command from skill to something else, i want to have a different command for the characters based on their class..
example:
if character 1 is a Black wizard he has Blk. Magic (instead of Skill) 
-Attack
-Blk. Magic
-Defend
-Item
and character 2 is a Blade Master he has Sword Skill (instead of just Skill)
-Attack
-Sword Skill
-Defend
-Item

oh and sorry i forgot to mention that I'm using RTAB so it'll have five commands
-Attack
-(skill)
-Defend
-Item
-Escape
hope someone can help me out with this
thanx
 

poccil

Sponsor

Use this.  Look at the "skillCommand" method below to learn how to customize it.

Code:
class Window_Command
  attr_accessor :commands
end

class Scene_Battle
  alias :petero_skillcommand_Scene_Battle_phase3_setup_command_window phase3_setup_command_window
  def phase3_setup_command_window
    # Disable party command window
    @party_command_window.active = false
    @party_command_window.visible = false
    # Enable actor command window
    @actor_command_window.active = true
    @actor_command_window.visible = true
    # Set actor command window position
    @actor_command_window.x = @actor_index * 160
    # Set index to 0
    @actor_command_window.index = 0
    @actor_command_window.commands[1]=skillCommand(@active_battler)
    @actor_command_window.refresh
  end
  # Returns the text to replace the default "Skill" depending on class
  def skillCommand(battler)
    case battler.class_id
     when 1
      return "Fighter Skill"
     when 2
      return "Lancer Skill"
     when 3
      return "Warrior Skill"
     else
      return "Skill"
    end
  end
end

This assumes an unmodified battle system, so I'm not sure whether it will work in your case.
 

poccil

Sponsor

Then the battle system you are using must have interfered.  As I mentioned, the solution I gave assumes the default battle system.
We need to know which script you are using, preferably by including the "scripts.rxdata" file to this thread.
 

poccil

Sponsor

Here's the new version of the script.  Replace the script I gave you with the one below.
Code:
class Window_Command
  attr_accessor :commands
end

class Scene_Battle
  alias :petero_skillcommand_Scene_Battle_phase3_setup_command_window phase3_setup_command_window
  def phase3_setup_command_window
    petero_skillcommand_Scene_Battle_phase3_setup_command_window
    # Real Time Active Battle uses @active_actor instead of @active_battler
    battler=@active_battler ? @active_battler : @active_actor
    @actor_command_window.commands[1]=skillCommand(battler)
    @actor_command_window.refresh
  end
  # Returns the text to replace the default "Skill" depending on class
  def skillCommand(battler)
    case battler.class_id
     when 1
      return "Fighter Skill"
     when 2
      return "Lancer Skill"
     when 3
      return "Warrior Skill"
     else
      return "Skill"
    end
  end
end
 

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