[Review]DoubleX RMVXA State Counters

Purpose
Displays the state icons with remaining turns on their battler sprites

Configuration
  1.      # Sets if this script needs to create the actor sprites at the start of
  2.       # battles
  3.       # This script won't display the actor sprites by itself
  4.       # It should be set as false if other custom scripts already do that
  5.       # It can't be changed once set
  6.       # Example: To use this script to create the actor sprites at the start of
  7.       #          battles, set this as true
  8.       CREATE_ACTOR_SPRITE = false
  9.  
  10.       # Sets if the state icons are displayed for actor sprites as well
  11.       # It only works with scripts supporting actor sprite displays in battles
  12.       # It's used at:
  13.       # 1. Game_Battler
  14.       #    - return nil unless enemy? || #{ACTOR_SPRITE} in
  15.       #      state_counters_battler_sprite
  16.       # 2. Sprite_Battler
  17.       #    - @state_counters = {} if @battler && (@battler.enemy? ||
  18.       #      #{ACTOR_SPRITE}) in initialize
  19.       #    - return unless @battler && (@battler.enemy? || #{ACTOR_SPRITE}) in
  20.       #      create_state_counter
  21.       # Example: To display the state icon for actor sprites as well, set this
  22.       #          as "true"
  23.       ACTOR_SPRITE = "false"
  24.  
  25.       # Sets the state icon xy offsets from its battler sprite
  26.       # It's used at:
  27.       # 1. State_Counter_Sprite
  28.       #    - xy_offset = #{XY_OFFSET} in update_pos
  29.       # The state priority index can be referneced by @index
  30.       # It must return an array of real numbers and should return an array of
  31.       # integers
  32.       # Example: To set the state icon xy offsets as the value of
  33.       #          variables with id a and b respectively, set this as
  34.       #          "[$game_variables[a], $game_variables]"
  35.       XY_OFFSET = "[24 * (@index % 2 - 0.5), -24 * (@index / 2) - 20]"
  36.  
  37.       # Sets the state icon z position
  38.       # It's used at:
  39.       # 1. State_Counter_Sprite
  40.       #    - z_pos = #{Z} in update_pos
  41.       # It must return a non-negative real number and should return a
  42.       # non-negative integer
  43.       # Example: To set the state icon z position as the value of variable
  44.       #          with id x, set this as "$game_variables[x]"
  45.       Z = "125"
  46.  
  47.       # Sets the state remaining turn text color
  48.       # It's used at:
  49.       # 1. State_Counter_Sprite
  50.       #    - color = #{TEXT_COLOR} in update_text_font
  51.       # It must return a color
  52.       # Example: To set the state remaining turn text color's rgba values as r,
  53.       #          g, b and a, set this as "Color.new(r, g, b, a)"
  54.       TEXT_COLOR = "Color.new(0, 0, 0, 255)"
  55.  
  56.       # Sets the state remaining turn text size
  57.       # It's used at:
  58.       # 1. State_Counter_Sprite
  59.       #    - size = #{TEXT_SIZE} in update_text_font
  60.       # It must return a positive real number and should return a natural number
  61.       # Example: To set the state remaining turn text size as the value of
  62.       #          variable with id x, set this as "$game_variables[x]"
  63.       TEXT_SIZE = "16"
  64.  
  65.       # Sets the state remaining turn text x and y positions
  66.       # It's used at:
  67.       # 1. State_Counter_Sprite
  68.       #    - text_xy = #{TEXT_XY} in update_turn
  69.       # It must return an array of real numbers and should return an array of
  70.       # integers
  71.       # Example: To set the state remaining turn text x and y positions as the
  72.       #          value of variables with id a and b respectively, set this as
  73.       #          "[$game_variables[a], $game_variables[b]]"
  74.       TEXT_XY = "[12, 0]"
Expand to see the code.


[b]Games Using This Script

None so far

Prerequisites
Abilities:
1. Some RGSS3 scripting proficiency to fully utilize this script

Terms Of Use
You shall keep this script's Script Info part's contents intact
You shalln't claim that this script is written by anyone other than DoubleX or his aliases
None of the above applies to DoubleX or his aliases

Instructions
1. Open the script editor and put this script into an open slot between Materials and Main, save to take effect.

Authors
DoubleX

Changelog
  1. #    v1.00e(GMT 1300 19-9-2015):                                               |
  2. #    1. Fixed lacking the spriteset viewport reader and iconset loader bug     |
  3. #    2. Further increased this script's compatibility                          |
  4. #    v1.00d(GMT 0800 16-9-2015):                                               |
  5. #    1. Fixed duplicate actor sprite creations at the start of battles bug     |
  6. #    2. Increased this script's compatibility and readability                  |
  7. #    v1.00c(GMT 1500 14-4-2015):                                               |
  8. #    1. Improved this script's robustness                                      |
  9. #    v1.00b(GMT 1100 11-4-2015):                                               |
  10. #    1. Fixed the state remaining turn display bug when a state's reapplied    |
  11. #    v1.00a(GMT 0900 11-4-2015):                                               |
  12. #    1. 1st version of this script finished                                    |
Expand to see the code.


Download Link
http://pastebin.com/pPvJCrmx

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=78864