The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: modern algebra on August 01, 2009, 04:45:42 AM

Title: Show Variable-Based Stats in Status Screen
Post by: modern algebra on August 01, 2009, 04:45:42 AM
Show Variable-Based Stats
Version: 1.0
Author: modern algebra
Date: August 1, 2009

Version History



Description


This script allows you to display the values of variable-based stats in the status menu of an actor. Thus, if you assign, say, a luck stat to each actor that determines how often they win the lotto, and you save this stat in a variable, then this script allows you to show that stat right below the other parameters the actor has, such as ATK, DEF, AGI, and SPI.

Features


Screenshots

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg189.imageshack.us%2Fimg189%2F9278%2Fsvsscreen1.png&hash=bb319d6ee4bd941e10dbbe1d5df86c7677e60ec3)

Instructions

Place this script above Main and below Materials. Read the descriptions in the EDITABLE REGION starting at line 34 for instructions on how to configure the script.

Script


Code: [Select]
#==============================================================================
#    Show Variable-Based Stats
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: August 1, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This script allows you to display the values of variable-based stats in
#   the status menu of an actor. Thus, if you assign, say, a luck stat
#   to each actor that determines how often they win the lotto, and you save
#   this stat in a variable, then this script allows you to show that stat
#   right below the other parameters the actor has, such as ATK, DEF, AGI,
#   and SPI.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Place this script above Main and below Materials.
#
#    Read the descriptions in the EDITABLE REGION starting at line 34 for
#   instructions on how to configure the script.
#==============================================================================

#==============================================================================
#  *** ModernAlgebra
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This module holds configuration data for my scripts
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new constants - SVS_PARAMETER_BASE_VARIABLES, SVP_PARAMETER_NAMES
#==============================================================================

module ModernAlgebra
  #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  #  EDITABLE REGION
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  # SVP_PARAMETER_BASE_VARIABLES holds the base variables for each stat.
  #  What that means is it should be the ID of the variable that tracks that
  #  parameter for the actor with ID 1 (Ralph by default). The script then
  #  assumes that the variables that track that stat increases in succession.
  #  So if Variable 18 tracks the stat for Ralph, then Variable 19 will track
  #  it for Ulrika, Variable 20 will track it for Bennett and so on until all
  #  actors are accounted for.
  SVP_PARAMETER_BASE_VARIABLES = [14, 34]
  # SVP_PARAMETER_NAMES holds the names you are giving each new stat, and the
  #  indices should correspond exactly to the position of its base variable in
  #  SVP_PARAMETER_BASE_VARIABLES
  SVP_PARAMETER_NAMES = ["LUK", "CHA"]
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  #  END EDITABLE REGION
  #//////////////////////////////////////////////////////////////////////////
end

#==============================================================================
# ** Window Status
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - draw_parameters
#==============================================================================

class Window_Status
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Parameters
  #     x : Draw spot X coordinate
  #     y : Draw spot Y coordinate
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mdrnalg_shwvrblestts_drwprms_7bx2 draw_parameters
  def draw_parameters(x, y, *args)
    # Run Original Method
    mdrnalg_shwvrblestts_drwprms_7bx2 (x, y, *args)
    y += 4*WLH
    # Draw all Variable-based stats
    for i in 0...ModernAlgebra::SVP_PARAMETER_BASE_VARIABLES.size
      # Draw Parameter Name
      contents.font.color = system_color
      contents.draw_text (x, y, 120, WLH, ModernAlgebra::SVP_PARAMETER_NAMES[i])
      # Get Variable Stat
      var_id = ModernAlgebra::SVP_PARAMETER_BASE_VARIABLES[i] + @actor.id - 1
      # Draw Stat
      contents.font.color = normal_color
      contents.draw_text (x + 120, y, 36, WLH, $game_variables[var_id].to_s, 2)
      # Advance y
      y += WLH
    end
  end
end

Credit



Support


Please post in this topic if you have any questions or encounter any problems with this script.

Known Compatibility Issues

It won't work with many exotic Status Scenes.

Demo


Not necessary, as it is self-explanatory from the screenshot.


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
Title: Re: Show Variable-Based Stats in Status Screen
Post by: Kokowam on August 09, 2009, 01:35:07 AM
COOL. These are always nice to have because you might have a mini-game or something that deals with, like, another type of currency and yeah. idk. You could go crazy with this. :O