RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[VXA] Skill Menu With Horizontal Skill-Type Commands

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 72
RMRK Junior
~ Skill Menu With Horizontal Skill-Type Commands ~
just a personal modification to the Skill Menu with
the intention of using a Multiple Skill-Types script with it

Author
Seiryuki

Description
This is a personal script with some poor coding. While I never intended to post this, someone may find it useful.

 - This script modifies the layout of the Skill Menu to show the skill-type commands in a horizontal bar instead of the default vertical list.
 - This script also allows you to specify what skill-types to hide using actor's notetags.
Use <hideskilltypes x> in actor notebox to hide skill-types. Replace x with the skill-type ID number. Add more IDs separated by commas to hide more skill-types:
<hideskilltypes x, x, x>.
 - My intention is to use this script with a Multiple Skill-Types Per Skill script to provide the functionality that I want.

Compatibility
 - Incompatible with YEA - Skill Menu script.
 - Incompatible with other scripts that modify the Skill Menu's windows.

Instructions
 - This script is plug-n-play (place above Main and below Materials in Script Editor).
 - Some customisation can be done in the Customisation section of the script's header.

Screenshots



Script
Code: [Select]
#=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=
#--------------- Skill Scene With Horizontal Skill-Type Commands ---------------
#=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=
# Author:   Seiryuki
# Date:     2012-Jan-24
# Version:  1.2
# Type:     RGSS3/VXA
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# • UPDATE:
# ¤ v1.2 (2012-Jan-26) - added SKILL_SCENE_MIN_COLUMNS
# ¤ v1.1 (2012-Jan-25) - show/hide params in skill_status window.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# • DESCRIPTION:
# ¤ This script modifies the layout of the Skill Menu to show the skill-type
#   commands in a horizontal bar instead of the default vertical list.
# ¤ This script also allows you to specify what skill-types to hide using
#   actor's notetags.
#    Use <hideskilltypes x> in actor's notebox to hide skill-types from
# showing up in the Skill Menu. Replace x with the skill-type ID number.
#    Add more IDs separated by commas to hide more skill-types:
#   <hideskilltypes x, x, x>.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# • INSTRUCTIONS:
# ¤ Plug-n-play - Place this script above Main and below Materials.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# • COMPATIBILITY:
# ¤ Incompatible with YEA - Skill Menu script.
# ¤ Incompatible with other scripts that modify the Skill Menu's windows.
# ¤ Works well with FenixFyreX's Multiple Skill-Types or KreadEx's Multiple
#   Skill-Types. Place above whichever of those scripts you decide to use.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# • CUSTOMISATION:
#-------------------------
SKILL_SCENE_MAX_COLUMNS = 0 #if 0, all columns autofit into screen's width.

#if an actor has 1, 2 or 3 visible skill-types, it tends to look ugly
#when doing the autofit (SKILL_SCENE_MAX_COLUMNS=0). SKILL_SCENE_MIN_COLUMNS
#would fix that by forcing a min amount of columns if the number of visible
#skill-types fall below that amount:
SKILL_SCENE_MIN_COLUMNS = 4 #applies if SKILL_SCENE_MAX_COLUMNS=0

SKILL_SCENE_COMMAND_ROWS = 1 #visible_line_number for skill-type commands.

SKILL_SCENE_SPACING = 4 #spacing between columns. default=8.

SKILL_SCENE_SHOW_PARAMS = true #whether to show actor parameters.

#params: 2=atk, 3=def, 4=mat, 5=mdf, 6=agi, 7=luk
SKILL_SCENE_PARAMS = [2, 3, 4, 5, 6,] #shows if SKILL_SCENE_SHOW_PARAMS=true
#-------------------------
# End of Customisation
#-------------------------
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#--------------- MODIFY BELOW ONLY IF YOU KNOW WHAT YOU ARE DOING --------------
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=


#===============================================================================
# • Use <hideskilltypes x, x, x> in actor notebox to hide skill-types.
#===============================================================================
class RPG::Actor < RPG::BaseItem
  def hide_skill_types
    types = []
@note.split(/[\r\n]+/).each do |line|
case line
when /<hideskilltypes[ ]*(\d+(?:\s*,\s*\d+)*)>/i
        $1.scan(/\d+/).each {|i| types.push(i.to_i)}
end
end#loop
    return types#returns array of skill-type IDs specified in notetag
  end#def
end#class
#===============================================================================



#===============================================================================
# • Overwrites the Help window initialize method.
#===============================================================================
class Window_Help < Window_Base
  alias skill_initialize initialize
  def initialize(line_number = 2, xpos = 0, ypos = 0)
    super(xpos, ypos, Graphics.width, fitting_height(line_number))
  end
end#class
#===============================================================================



#===============================================================================
# • Overwrites initialize method to accomodate the new look.
# • Overwrites the refresh method with a new simple status.
# • Overwrites the window_width to be Graphics.width to fit the horizontal
# look of the skill-type commands and to add some more info.
#===============================================================================
class Window_SkillStatus < Window_Base
  def initialize(x, y)
    super(x, y, window_width, fitting_height(2))
    @actor = nil
  end
 
  def refresh
    contents.clear
    return unless @actor
    draw_actor_face(@actor, 0, -20)
    draw_actor_simple_status2(@actor, 108, 0)
  end
 
  def window_width
    Graphics.width
  end
end#class
#===============================================================================



#===============================================================================
# • New simple status method that also shows some stats.
#===============================================================================
class Window_Base < Window
  def draw_actor_simple_status2(actor, x, y)
    draw_actor_name(actor, x, y)
    draw_actor_level(actor, x - 8, y + line_height * 1)
    #draw_actor_class(actor, x + 70, y)
    draw_actor_icons(actor, x + 68, y + line_height * 1)
    draw_actor_hp(actor, x + 170, y)
    draw_actor_mp(actor, x + 170, y + line_height * 1)
    if SKILL_SCENE_SHOW_PARAMS && (SKILL_SCENE_PARAMS.length != 0)
      xposCounter = 0
      for param in SKILL_SCENE_PARAMS do
        if ((param > 1) && (param < 8))
          draw_param_name(x + 310 + xposCounter, y, param)
          draw_current_param(x + 310 + xposCounter, y + line_height * 1, param)
          xposCounter = xposCounter + 40
        end#if
      end#for
    end#if
  end#def

  def draw_param_name(x, y, param_id)
    change_color(system_color)
    draw_text(x, y, 80, line_height, Vocab::param(param_id))
  end
 
  def draw_current_param(x, y, param_id)
    change_color(normal_color)
    draw_text(x, y, 32, line_height, @actor.param(param_id), 2)
  end
end#class
#===============================================================================



#===============================================================================
# • New Scene_Skill menu that makes use of the horizontal skill-type commands.
#===============================================================================
class Scene_HorzSkill < Scene_ItemBase
  def start
    super
    create_status_window
    create_help_window
    create_horz_command_window(@help_window.y + @help_window.height)
    create_item_window(@command_window.y + @command_window.height)
  end

  def create_status_window
    @status_window = Window_SkillStatus.new(0, 0)
    @status_window.viewport = @viewport
    @status_window.actor = @actor
  end

  def create_help_window
    @help_window = Window_Help.new(2, 0, @status_window.height)
    @help_window.viewport = @viewport
  end

  def create_horz_command_window(wy)
    @command_window = Window_HorzSkillCommand.new(0, wy)
    @command_window.viewport = @viewport
    @command_window.help_window = @help_window
    @command_window.actor = @actor
    @command_window.set_handler(:skill,    method(:command_skill))
    @command_window.set_handler(:cancel,   method(:return_scene))
    @command_window.set_handler(:pagedown, method(:next_actor))
    @command_window.set_handler(:pageup,   method(:prev_actor))
  end

  def create_item_window(wy)
    wx = 0
    ww = Graphics.width
    wh = Graphics.height - wy
    @item_window = Window_SkillList.new(wx, wy, ww, wh)
    @item_window.actor = @actor
    @item_window.viewport = @viewport
    @item_window.help_window = @help_window
    @item_window.set_handler(:ok,     method(:on_item_ok))
    @item_window.set_handler(:cancel, method(:on_item_cancel))
    @command_window.skill_window = @item_window
  end

  def user
    @actor
  end

  def command_skill
    @item_window.activate
    @item_window.select_last
  end

  def on_item_ok
    @actor.last_skill.object = item
    determine_item
  end

  def on_item_cancel
    @item_window.unselect
    @command_window.activate
  end

  def play_se_for_item
    Sound.play_use_skill
  end

  def use_item
    super
    @status_window.refresh
    @item_window.refresh
  end

  def on_actor_change
    #The next two lines refreshes the command window so that
    #col_max will be set to actor's max amount of skill-types
    #if set to autofit (SKILL_SCENE_MAX_COLUMNS = 0 above).
    @command_window.dispose
    create_horz_command_window(@help_window.y + @help_window.height)
   
    @command_window.actor = @actor
    @status_window.actor = @actor
    @item_window.actor = @actor
    @command_window.activate
  end
 
end#class
#===============================================================================



#===============================================================================
# • Adds windows' variables to the Window_Selectable class to allow use for
# other classes.
#===============================================================================
class Window_Selectable < Window_Base
  def status_window=(status_window)
    @status_window = status_window
  end
 
  def command_window=(command_window)
    @command_window = command_window
  end
 
  def item_window=(item_window)
    @item_window = item_window
  end
end#class
#===============================================================================



#===============================================================================
# • The horizontal skill-type commands window.
#===============================================================================
class Window_HorzSkillCommand < Window_HorzCommand
  attr_reader   :skill_window

  def initialize(x, y)
    super(x, y)
    @actor = nil
  end
 
  def visible_line_number
    return SKILL_SCENE_COMMAND_ROWS
  end

  def actor=(actor)
    return if @actor == actor
    @actor = actor
    refresh
    select_last
  end
 
  def col_max
    if SKILL_SCENE_MAX_COLUMNS > 0
      return SKILL_SCENE_MAX_COLUMNS
    elsif SKILL_SCENE_MAX_COLUMNS == 0
      vis_col = get_visible_col
      if (vis_col == nil) or (SKILL_SCENE_MIN_COLUMNS < 0)
        return 4 #if something goes wrong, return 4 columns.
      elsif (vis_col < SKILL_SCENE_MIN_COLUMNS) && (SKILL_SCENE_MIN_COLUMNS > 0)
        return SKILL_SCENE_MIN_COLUMNS
      else
        return vis_col
      end
    else
return 4 #if SKILL_SCENE_MAX_COLUMNS < 0
    end
  end

  def spacing
    return SKILL_SCENE_SPACING
  end
 
  def window_width
    return Graphics.width
  end
 
  #new method
  def get_visible_col
    @visible_col = 0
    return unless @actor
    @actor.added_skill_types.sort.each do |stype_id|
      if show_skill_type?(stype_id) #checks if to hide skill-type
        @visible_col = @visible_col + 1
      end
    end
    return @visible_col
  end
 
  def make_command_list
    return unless @actor
    @actor.added_skill_types.sort.each do |stype_id|
      name = $data_system.skill_types[stype_id]
      if show_skill_type?(stype_id) #checks if to hide skill-type
        add_command(name, :skill, true, stype_id)
      end
    end
  end
 
  #New Method: whether to hide skill-type?
  #Uses notebox tags. See top of script.
  def show_skill_type?(type)
    #$data_actors[@actor.id].hide_skill_types, or, as Zetu said:
    list = @actor.actor.hide_skill_types
    for i in list do
      if i == type
        return false
      end
    end
    return true
  end

  def update
    super
    @skill_window.stype_id = current_ext if @skill_window
  end

  def skill_window=(skill_window)
    @skill_window = skill_window
    update
  end

  def select_last
    skill = @actor.last_skill.object
    if skill
      select_ext(skill.stype_id)
    else
      select(0)
    end
  end
end#class
#===============================================================================



#===============================================================================
# • Draw the new Scene_Skill.
#===============================================================================
class Scene_Menu < Scene_MenuBase
  def on_personal_ok
    case @command_window.current_symbol
    when :skill
      SceneManager.call(Scene_HorzSkill)
    when :equip
      SceneManager.call(Scene_Equip)
    when :status
      SceneManager.call(Scene_Status)
    end#when
  end#def
end#class
#===============================================================================

#=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=
#----------------------------- END OF SCRIPT -----------------------------------
#=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=•=

Notes
If anyone wishes to contribute on making the script better, I'll be glad to hear it. One thing on my mind would be a way to separate the hide_skill_type functionality from the scene itself while maintaining compatibility. However, I'm not sure how to go about it as it seems to be difficult.
Anybody is free to make modifications, just post the modified script in this topic.
« Last Edit: May 07, 2012, 06:20:34 PM by Seiryuki »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
That is a pretty design Seiryuki. I will try and take a look at the coding later, but it looks nice.

**
Rep:
Level 72
RMRK Junior
Well, I haven't found a way to separate the HideSkillType functionality, so I guess this is pretty much a final, proper version...for now. It still feels like two-scripts-in-one to me, but anyways, this can be added to the master script list.

I still welcome any ideas on splitting the mentioned functionalities or even better coding overall.

Thanks.