Jump to content
AJNR

Actor Command Sub-Menu

Recommended Posts

I recently created a topic about my battle command window in my project. I wanted to request/ask if anyone could create a sub-menu for the Actor Command (specifically compatible with Yanfly's Battle Engine and Yanfly's Battle Command List). Since, another member brought the idea up and it was a great suggestion.

 

For a visual interpretation, I've created a GIF Image (Isn't animated when I set it as an IMG on this post. I'd highly appreciate it if someone could create this. If there needs to be any specific suggestions for this, probably a :skillcategory command that opens up all of the User's/Actor's known Skill Types. I wouldn't mind if the sub-menu doesn't slide, just a window that opens up above the main command window and disappears when canceled and returns to the main command window.

 

For the topic I created earlier relevant to this, this is the link

 

And this is optional, but it would be nice to have more than 1 Sub-Menu capable of being on the Main Command. Say, Skill is a Sub-Menu that opens up to Skill Type 1, 2, and 3. And on the same Main Command - Item is also a Sub-Menu that opens up to Item, CustomCommand, CustomCommand2.

Edited by AJNR

Share this post


Link to post
Share on other sites

I think this is what you wanted:

 

 

 

$imported = {} if $imported.nil?
$imported["Karanum_SkillSubMenu"] = true

module KARANUM
  module SKILLSUBMENU
    
    # Define the skill types that shouldn't show up in this list.
    # Only enter the number they have in the database, not the name.
    # Multiple skill types must be separated by a comma (e.g. [1,2,3])
    HIDDEN_SKILL_TYPES = [3]
    
  end
end

#==============================================================================
# Window_ActorCommand
#==============================================================================
class Window_ActorCommand < Window_Command
  def add_skill_commands
    add_command("Skills", :skill, true)
  end
  
  def add_skill_commands_new
    if $imported["YEA-BattleCommandList"]
      @actor.added_skill_types.each do |stype_id|
        next if KARANUM::SKILLSUBMENU::HIDDEN_SKILL_TYPES.include?(stype_id)
        next if @stype_list.include?(stype_id)
        next if include_subclass_type?(stype_id)
        add_skill_type_command(stype_id)
      end
    else
      @actor.added_skill_types.sort.each do |stype_id|
        next if KARANUM::SKILLSUBMENU::HIDDEN_SKILL_TYPES.include?(stype_id)
        name = $data_system.skill_types[stype_id]
        add_command(name, :skill, true, stype_id)
      end
    end
  end
end

#==============================================================================
# Window_SubSkillCommand
#==============================================================================
class Window_SubSkillCommand < Window_ActorCommand
  def initialize
    super
    self.openness = 0
    deactivate
    @actor = nil
  end

  def window_width
    return 128
  end

  def visible_line_number
    return [4, @list.size].min
  end

  def make_command_list
    return unless @actor
    make_stype_list if $imported["YEA-BattleCommandList"]
    add_skill_commands
  end

  def make_stype_list
    return unless @actor
    @stype_list = []
    for command in @actor.battle_commands
      case command.upcase
      when /SKILL TYPE[ ](\d+)/i
        add_skill_type_command($1.to_i)
      when /SKILL[ ](\d+)/i
        add_skill_id_command($1.to_i)
      else; next
      end
    end
  end
  
  def add_skill_commands
    add_skill_commands_new
  end
  
  def setup(actor)
    @actor = actor
    clear_command_list
    make_command_list
    refresh
    select(0)
    move(x, y, width, fitting_height(visible_line_number))
    activate
    open
  end
end

#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
  alias karanum_subskill_createallwindows create_all_windows
  def create_all_windows
    karanum_subskill_createallwindows
    create_subskill_command_window
  end
  
  def create_subskill_command_window
    @subskill_command_window = Window_SubSkillCommand.new
    @subskill_command_window.viewport = @info_viewport
    @subskill_command_window.set_handler(:skill,  method(:on_subskill_ok))
    @subskill_command_window.set_handler(:cancel, method(:on_subskill_cancel))
    @subskill_command_window.x = @actor_command_window.x
    @subskill_command_window.width = @actor_command_window.width
  end
  
  def command_skill
    @subskill_command_window.setup(BattleManager.actor)
  end
  
  def on_skill_cancel
    @skill_window.hide
    @status_window.show
    @subskill_command_window.activate
  end
  
  alias karanum_subskill_actorok on_actor_ok
  def on_actor_ok
    @subskill_command_window.close
    karanum_subskill_actorok
  end
  
  alias karanum_subskill_enemyok on_enemy_ok
  def on_enemy_ok
    @subskill_command_window.close
    karanum_subskill_enemyok
  end
  
  def on_subskill_ok
    @status_window.hide
    @skill_window.actor = BattleManager.actor
    @skill_window.stype_id = @subskill_command_window.current_ext
    @skill_window.refresh
    @skill_window.show.activate
  end
  
  def on_subskill_cancel
    @subskill_command_window.deactivate
    @subskill_command_window.close
    @actor_command_window.activate
  end
end 

 

 

 

This makes a sub-menu with all skill types an actor can use when you select the Skills command in battle.

 

It should work with Yanfly's Battle Engine and Battle Command List scripts unless I overlooked something. It might be a bit grumpy about other scripts that change the battle menu, but this is about as good as I can get it without knowing what scripts cause issues.

Edited by Karanum

Share this post


Link to post
Share on other sites

As of right now, compatibility is perfect. One issue that I'm having, is that it's displaying 2 of the same Skill Types.

Skill Type 3 is "Attack", it's suppose to be a Pseudo-Attack command that opens up to more basic actions along with the default Attack skill.

However, I wasn't able to create a custom command to use as a gateway to access the sub-menu. So I tried using "Skill Type 3", "Attack".

 

The main command has been rounded down to 3 commands: "Attack" "Guard" "Item" and opens the Sub-Menu "Attack" "Attack" "S-Type1" "S-Type2" "S-Type3" when I open the "Attack" from the Main Command. I was wondering how I could fix this small nuisance, since it's not really an obstruction.

 

I know I'm not entitled to anything here and I'm highly grateful for your help. (Right now, I've modified the BattleStatus to change to the amount of Party Members in the Party. I'm trying to get the Actor_Command window to come up exactly next to the window - since there's a gap. The Sub-Menu also appears a little to the right of the Main Command and gets clipped on it's right side outside the program window. I'm trying to fix this now. It's nothing for you to fix, just a heads up. I'll post an image once I'm done fixing it.) Thank you again  :lol:

 

Edit:

Fixed my dilemma. The only nuisance is the duplicate skill types appearing in the sub-menu.

Edited by AJNR

Share this post


Link to post
Share on other sites

Small question about the duplicate skill type... Does it happen to be the first one in the database skill type list and are you using battle test? If so, it's a similar issue to what I've found on my end where every actor had a skill type they shouldn't have, which was fixed when I entered a battle in-game. (Not sure if that's the problem though, just guessing)

 

I would probably be able to make it so that it ignores certain skill types because you won't ever find any skills for that type, such as with the pseudo-Attack one, if you want. It would also give me an excuse to synchronize the position of the sub-menu with the ActorCommand window.

Share this post


Link to post
Share on other sites

"Attack" is Skill Type #3 (Skill Type #1 is "Passive" and does not occur in Battle, but I haven't given it to any Actors neither). But the Skill Type "Attack" is the first Skill-Type within the Features for the Actors - followed by their 3 other skill types. I tested it in Debug and executed a Battle and it still displayed duplicates of "Attack",

 

Also, "Attack" is one of the commands in Yanfly's Battle Command. Being: "Skill Type 3" "Guard" "Items"

 

I would be more than happy if you have the time to create that addition to the script. Probably an Array of Locked Skills (or just the specific types) - I don't know, I'm not good at creating scripts from scratch. And finally, you don't need to fix the position to the ActorCommand Window - I've already fixed it. But you can insert it to a seperate version that you can submit to the Script Archives of this Forum.

 

Thanks a bunch!

Share this post


Link to post
Share on other sites

Alright, I made some quick edits to the script, the spoiler in my previous post has the updated version of the code. What exactly the problem is confuses me a bit, but this update should allow you to get rid of the extra Attack command in the sub-menu.

Share this post


Link to post
Share on other sites

This seems like something I'd like to try using, but I'm not sure I understand how the window is called. How does one open this subwindow?

 

It should automatically be opened if you select the Skill Command of the window. If you're using Yanfly's Battle Command, I'm guessing the First Skill Type in the Command Window is the gateway to opening the sub-menu

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×