RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

[VX] [REQUEST] Hidden States

Started by zerothedarklord, December 23, 2011, 02:42:33 AM

0 Members and 1 Guest are viewing this topic.

zerothedarklord

Using a talent tree system, I'm setting up a tree entirely comprised of passive bonuses for the character. Unfortunately, I can only find a script that adds stats by % to max health and max mp (for all other stats, it must be a flat number, and I want % increases). I found a way around it, which is to have the abilities add states that increases the stats by %, except now my problem is that I'm gonna have like 3089475238589342757438524385723489752348975894758972389758942307534897542375089378934589 states active on the player at once. Can anyone write me a script that'll let me hide states through use of a tag?

Example:
State: Titan Strength
Effect: Increases attack by 5%
(under states, change the attack benefit to 105%)
note tag box: <hidden>, or (hidden), or [hidden]


Can anyone whip this up real quick, or provide another way to do it?

pacdiggity

Sounds pretty simple. I'll give it a crack.
it's like a metaphor or something i don't know

zerothedarklord

#2
holy shit that was fast. Thanks a bunch man.

While you're at it, can you write me, or point me to a script that allows the display of more info?
What I mean is, for example, the database's "description" box for skills and items doesn't give a lot of room, but when you look at it ingame, it appears to take up only 1 line of an at least 2 - 3 line box. Is there anyway I can get it to give me more room to add longer/more in-depth descriptions?

Example:
(not exact, but just to give you the idea)
Spell: Inferno Shield
Description: Wraps the user in a fiery shield, increasing fire resistance, ca            <- and then it cuts off

What I want:
Description: Wraps the user in a fiery shield, increasing fire resistance, causing damage when struck physically, and increasing fire damage dealt by 50%. 5 Turn Duration. 9 Turn Cooldown.

pacdiggity

Put this at the top of your materials list. Use \hidden in the notebox to hide a state.
# Put \hidden in the notebox of a state you want to be hidden.
# By Pacman, 23/12/11, for zerothedarklord
# (http://rmrk.net/index.php/topic,44675.new.html)
# It is advised to put this script at the top of your materials list.

class RPG::State
  def hidden?
    return !self.note[/\\HIDDEN/i].nil?
  end
end

class Window_Base
  def draw_actor_state(actor, x, y, width = 96)
    count = 0
    for state in actor.states
      next if state.hidden?
      draw_icon(state.icon_index, x + 24 * count, y)
      count += 1
      break if (24 * count > width - 24)
    end
  end
end


As for your other thing, I think KGC had a script for that...
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/   ?       Additional Help Window Functions - KGC_HelpExtension       ? VX ?
#_/   ?                       Last Update: 2007/12/19                         ?
#_/   ?                    Translation by Mr. Anonymous                       ?
#_/   ? KGC Site:                                                             ?
#_/   ? http://f44.aaa.livedoor.jp/~ytomy/                                    ?
#_/   ? Translator's Blog:                                                    ?
#_/   ? http://mraprojects.wordpress.com                                      ?
#_/----------------------------------------------------------------------------
#_/  Installation: Requires and is inserted above KGC_DrawFormatText.
#_/============================================================================
#_/  Additional Help Window functions.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#=============================================================================#
#                               ? Customization ?                             #
#=============================================================================#

module KGC
module HelpExtension
  # The number of rows (lines) the help window can display.
  #  Rows are divided with the | character in the item/skill's description.
  ROW_MAX = 1

  # Button used when status window of shop screen scrolls.
  SHOP_STATUS_SCROLL_BUTTON = Input::A
end
end

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

$imported = {} if $imported == nil
$imported["HelpExtension"] = true

#==============================================================================
# ? Window_Help
#==============================================================================

class Window_Help < Window_Base
  attr_reader :row_max
  #--------------------------------------------------------------------------
  # ? Object initialization
  #--------------------------------------------------------------------------
  alias initialize_KGC_HelpExtension initialize
  def initialize
    @row_max = 1

    initialize_KGC_HelpExtension
  end
  #--------------------------------------------------------------------------
  # ? The number of lines setting
  #--------------------------------------------------------------------------
  def row_max=(value)
    @row_max = [value, 1].max
    self.height = WLH * @row_max + 32
    create_contents

    # Content restoration
    text = @text
    align = @align
    @text = @align = nil
    set_text(text, align)
  end
  #--------------------------------------------------------------------------
  # ? Text setting
  #   Text: Character string displayed in window
  #    Align: Alignment(0. left justification, 1 center just., 2 right just.)
  #--------------------------------------------------------------------------
  def set_text(text, align = 0)
    if text != @text or align != @align
      self.contents.clear
      self.contents.font.color = normal_color
      font_buf = self.contents.font.clone
      # \N[x] Converts to an integer.
      buf = text.gsub(/\\N(\[\d+\])/i) { "\\__#{$1}" }
      lines = buf.split(/(?:[|]|\\n)/i)
      lines.each_with_index { |l, i|
        # Convert \N[x] returns and draws.
        l.gsub!(/\\__(\[\d+\])/i) { "\\N#{$1}" }
        self.contents.draw_format_text(4, i * WLH, self.width - 40, WLH, l, align)
      }
      self.contents.font = font_buf
      @text = text
      @align = align
    end
  end
end

#==================================End Class===================================#

#==============================================================================
# ? Scene_Item
#==============================================================================
class Scene_Item < Scene_Base
  #--------------------------------------------------------------------------
  # ? Beginning processing
  #--------------------------------------------------------------------------
  alias start_KGC_HelpExtension start
  def start
    start_KGC_HelpExtension

    adjust_window_size
  end
  #--------------------------------------------------------------------------
  # ? Adjustment of window size
  #--------------------------------------------------------------------------
  def adjust_window_size
    @help_window.row_max = KGC::HelpExtension::ROW_MAX
    @item_window.y = @help_window.height
    @item_window.height = Graphics.height - @help_window.height
    @item_window.refresh
  end
end

#==================================End Class===================================#

#==============================================================================
# ? Scene_Skill
#==============================================================================

class Scene_Skill < Scene_Base
  #--------------------------------------------------------------------------
  # ? Beginning processing
  #--------------------------------------------------------------------------
  alias start_KGC_HelpExtension start
  def start
    start_KGC_HelpExtension

    adjust_window_size
  end
  #--------------------------------------------------------------------------
  # ? Adjustment of window size
  #--------------------------------------------------------------------------
  def adjust_window_size
    @help_window.row_max = KGC::HelpExtension::ROW_MAX
    @status_window.y = @help_window.height
    dy = @help_window.height + @status_window.height
    @skill_window.y = dy
    @skill_window.height = Graphics.height - dy
    @skill_window.refresh
  end
end

#==================================End Class===================================#

#==============================================================================
# ? Scene_Equip
#==============================================================================

class Scene_Equip < Scene_Base
  #--------------------------------------------------------------------------
  # ? Beginning processing
  #--------------------------------------------------------------------------
  alias start_KGC_HelpExtension start
  def start
    start_KGC_HelpExtension

    adjust_window_size
  end
  #--------------------------------------------------------------------------
  # ? Adjustment of window size
  #--------------------------------------------------------------------------
  def adjust_window_size
    @help_window.row_max = KGC::HelpExtension::ROW_MAX
    @equip_window.y = @help_window.height
    @status_window.y = @help_window.height
    resize_item_windows
  end
  #--------------------------------------------------------------------------
  # ? Size change of item window
  #--------------------------------------------------------------------------
  def resize_item_windows
    @item_windows.each { |w|
      dy = @help_window.height + @equip_window.height
      w.y = dy
      w.height = Graphics.height - dy
      w.refresh
    }
  end
end

#==================================End Class===================================#

#==============================================================================
# ? Scene_Shop
#==============================================================================

class Scene_Shop < Scene_Base
  #--------------------------------------------------------------------------
  # ? Beginning processing
  #--------------------------------------------------------------------------
  alias start_KGC_HelpExtension start
  def start
    start_KGC_HelpExtension

    adjust_window_size
  end
  #--------------------------------------------------------------------------
  # ? Adjustment of window size
  #--------------------------------------------------------------------------
  def adjust_window_size
    @help_window.row_max = KGC::HelpExtension::ROW_MAX
    @command_window.y = @help_window.height
    @gold_window.y = @help_window.height
    dy = @help_window.height + @command_window.height
    @dummy_window.y = @buy_window.y = @sell_window.y =
      @number_window.y = @status_window.y = dy
    @dummy_window.height = @buy_window.height =
      @sell_window.height = @number_window.height =
      @status_window.height = Graphics.height - dy
    @dummy_window.create_contents
    @number_window.create_contents
  end
  #--------------------------------------------------------------------------
  # ? Frame Update
  #--------------------------------------------------------------------------
  alias update_KGC_HelpExtension update
  def update
    if !@command_window.active &&
        Input.press?(KGC::HelpExtension::SHOP_STATUS_SCROLL_BUTTON)
      super
      update_menu_background
      update_scroll_status
      return
    else
      @status_window.cursor_rect.empty
    end

    update_KGC_HelpExtension
  end
  #--------------------------------------------------------------------------
  # ? Processing status window scroll
  #--------------------------------------------------------------------------
  def update_scroll_status
    @status_window.cursor_rect.width = @status_window.contents.width
    @status_window.cursor_rect.height = @status_window.height - 32
    @status_window.update
    if Input.press?(Input::UP)
      @status_window.oy = [@status_window.oy - 4, 0].max
    elsif Input.press?(Input::DOWN)
      max_pos = [@status_window.contents.height -
        (@status_window.height - 32), 0].max
      @status_window.oy = [@status_window.oy + 4, max_pos].min
    end
  end
end

#==================================End Class===================================#

#==============================================================================
# ? Scene_Battle
#==============================================================================

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # ? Beginning of skill selection
  #--------------------------------------------------------------------------
  alias start_skill_selection_KGC_HelpExtension start_skill_selection
  def start_skill_selection
    start_skill_selection_KGC_HelpExtension

    adjust_skill_window_size
  end
  #--------------------------------------------------------------------------
  # ? Size adjustment of skill window
  #--------------------------------------------------------------------------
  def adjust_skill_window_size
    @help_window.row_max = KGC::HelpExtension::ROW_MAX
    @skill_window.y = @help_window.height
    @skill_window.height = Graphics.height -
      (@help_window.height + @status_window.height)
    @skill_window.refresh
  end
  #--------------------------------------------------------------------------
  # ? Beginning of item selection
  #--------------------------------------------------------------------------
  alias start_item_selection_KGC_HelpExtension start_item_selection
  def start_item_selection
    start_item_selection_KGC_HelpExtension

    adjust_item_window_size
  end
  #--------------------------------------------------------------------------
  # ? Size adjustment of item window
  #--------------------------------------------------------------------------
  def adjust_item_window_size
    @help_window.row_max = KGC::HelpExtension::ROW_MAX
    @item_window.y = @help_window.height
    @item_window.height = Graphics.height -
      (@help_window.height + @status_window.height)
    @item_window.refresh
  end
end

#==================================End Class===================================#
Credit KGC. It requires this script to work as well.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/   ?              Special Text Formatting - KGC_DrawFormatText        ? VX ?
#_/   ?                       Last update : 2007/12/19                        ?
#_/   ?                     Translation by Mr. Anonymous                      ?
#_/   ? KGC Site:                                                             ?
#_/   ? http://f44.aaa.livedoor.jp/~ytomy/                                    ?
#_/   ? Translator's Blog:                                                    ?
#_/   ? http://mraprojects.wordpress.com                                      ?
#_/----------------------------------------------------------------------------
#_/  Installation: Insert this script above main.
#_/============================================================================
#_/  Specialized text display.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

$imported = {} if $imported == nil
$imported["DrawFormatText"] = true

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

class Bitmap
  @@__dummy_window = Window_Base.new(-64, -64, 64, 64)
  @@__dummy_window.visible = false
  #--------------------------------------------------------------------------
  # ? Format specification character drawing
  #--------------------------------------------------------------------------
  def draw_format_text(x, y, width, height, text, align = 0)
    str = convert_special_characters(text)
    dx = 0
    buf = Bitmap.new(Graphics.width * 2, Window_Base::WLH)
    buf.font = self.font.clone
    loop {
      c = str.slice!(/./m)    # following letter the acquisition case c when nil
     case c
      when nil                 # When no character present where it should draw
        break
      when "\x01"                       # \C[n]  (Character color change)
        str.sub!(/\[([0-9]+)\]/, "")
        buf.font.color = @@__dummy_window.text_color($1.to_i)
        next
      else                              # Else draw usual character
        buf.draw_text(dx, 0, 40, Window_Base::WLH, c)
        c_width = buf.text_size(c).width
        dx += c_width
      end
    }
    self.font = buf.font.clone
    # The buffer is transmitted in the window.
    dest = Rect.new(x, y, [width, dx].min, height)
    src = Rect.new(0, 0, dx, Window_Base::WLH)
    offset = width - dx
    case align
    when 1  # Center justification
      dest.x += offset / 2
    when 2  # Right justification
      dest.x += offset
    end
    stretch_blt(dest, buf, src)
    buf.dispose
  end
  #--------------------------------------------------------------------------
  # ? Conversion of special characters
  #--------------------------------------------------------------------------
  def convert_special_characters(str)
    text = str.dup
    text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
    text.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
    text.gsub!(/\\C\[([0-9]+)\]/i) { "\x01[#{$1}]" }
    text.gsub!(/\\G/)              { $game_party.gold }
    text.gsub!(/\\\\/)             { "\\" }
    return text
  end
end
it's like a metaphor or something i don't know

zerothedarklord

damn that was fast dude, you're a beast. thanks a bunch!