public

Rpg Maker Developers Group

Simple enough for a child, powerful enough for a developer

2 Followers

Help needed with Graphic States script.

BMM Archive · July 15, 2026

Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.

Original Source

  • Original title: Help needed with Graphic States script.
  • Original author: Syltti
  • Original date: September 29, 2013
  • Source thread: https://forums.rpgmakerweb.com/threads/help-needed-with-graphic-states-script.18551/
  • Source forum path: Game Development Engines > Ruby Game System (RGSS) Scripts > RGSSx Script Support

Summary

This is a problem I've been struggling with for a little while now. I got this script for the sake of showing different actor graphics for transformations. I got half of it working. I can get my actor's faces to change, but not their battlers. This is what I mean: { "lightbox_close": "Close", "lightbox_next": "Next",

Archived First Post

This is a problem I've been struggling with for a little while now. I got this script for the sake of showing different actor graphics for transformations. I got half of it working. I can get my actor's faces to change, but not their battlers. This is what I mean:

Protected download

This particular screenshot is focused on Ariase (second actor). Her transformation changes her hair and eye color (both from black to red). You can see her face graphic has that change, but her battler still has black hair and eyes. A few more actors have such changes occur, so I'd like to get this working.

Here's the notetags Ariase has in her transformation State's notes:

actor battler gfx["Ariase-2" 0 8]
actor face gfx["AriaseEC" 0]

and here's the script:

##-----------------------------------------------------------------------------## State Graphics v1.3## Created by Neon Black#### For both commercial and non-commercial use as long as credit is given to## Neon Black and any additional authors.  Licensed under Creative Commons## CC BY 3.0 - http://creativecommons.org/licenses/by/3.0/.##----------------------------------------------------------------------------##                                                                              ####----------------------------------------------------------------------------####    Revision Info:## v1.3 - 8.17.2013##  Fixed an issue with character sprite changing## v1.2 - 3.16.2013##  Added stacking states functions## v1.1 - 3.15.2013##  Fixed bug related to death transitions## v1.0 - 3.15.2013##  Wrote and debugged main script##----------------------------------------------------------------------------##                                                                              ##$imported ||= {}                                                              ##$imported["Graphics_States"] = 1.3                                            ##                                                                              ####----------------------------------------------------------------------------####    Instructions:## Place this script in the script editor below "Materials" and above "Main".## This script allows states to change an actor or enemy's graphics.  This## change remains active as long as the battler is afflicted with the state.## If multiple states change graphics, the state with the highest priority## determines the graphic.  These changes are applied using script calls:#### battler gfx["name" 0]  -or-  enemy battler gfx["name" 0 1, 2, 3]  -or-## actor battler gfx["name" 0 1, 2, 3]##  - Sets a battlers graphic name and hue while the state is applied.  "name"##    is the file name and must be surrounded by quotes while 0 can be a number##    from 0-255 for the hue.  If this tag is prefixed with "actor" or "enemy"##    it must also include actor or enemy IDs at the end each separated by##    commas (such as the 1, 2, 3 in this example).  Note that actor/enemy tags##    take priority over the short tag, but higher priority states will always##    be applied first.## character gfx["name" 5]  -or-  face gfx["name" 5]  -or-## actor face gfx["name" 5 1, 2, 3]  -etc-##  - Changes the face or character walking sprites of the battler with this##    state.  Either of these can be prefixed with actor or enemy and work##    pretty much the same way as the battler gfx tags.  The only difference is##    that the number behind the name changes the index (from 0-7).  This has##    no effect on enemies without alternate scripts.## name change["name"]  -or-  enemy name change["name" 1, 2, 3]##  - Changes the name of the battler the that is applied to.  Works exactly##    like all the other tags except it does not have a second argument.#### This script can also function with CP's Stacking States.  States can have## different graphics for certain levels of stacks by adding a tag to the line## you want to only occur on that stack.  This tag is as follows:#### stack gfx[1]##  - Causes the line graphic to only occur when the stack condition is met.##    To use this tag, simply place the tag after any other tag in this script.##    You can use any number from 1 on up.  If this tag is not behind another##    tag, the tag is assumed to work on all levels.  Note that this tag takes##    priority over similar untagged lines.##----------------------------------------------------------------------------##                                                                              ####----------------------------------------------------------------------------####    Compatibility:## This script assumes that enemies cannot have faces and characters by default## so if it happens to interfere with another script, try placing this script## ABOVE the other script.  If that does not work, copy lines 111 to 142 and## overwrite lines 152 to 178 with them.##----------------------------------------------------------------------------##                                                                              ##                                                                              ####----------------------------------------------------------------------------#### The following lines are the actual core code of the script.  While you are## certainly invited to look, modifying it may result in undesirable results.## Modify at your own risk!###----------------------------------------------------------------------------class Game_BattlerBase  def state_graphic_bit(bit)  ## Gets the info from an array using the ID.    states.each do |state|      stack_pos = get_stack(state.id); ary = nil      id = enemy? ? -@enemy_id : @actor_id      if state.graphics_change.include?(id) &&         state.graphics_change[id].include?(bit)        ary = state.graphics_change[id][bit]      end      if state.graphics_change.include?(0) &&         state.graphics_change[0].include?(bit)        ary = state.graphics_change[0][bit] if ary.nil?      end            if ary        return ary[stack_pos] if ary[stack_pos]        return ary[0] if ary[0]      end    end    return nil  end   def get_stack(state) ## Gets the ID from the hash if Stack_States is used.    if ($imported["Stack_States"] || 0) >= 1.0      return state_stack(state)    else      return 1    end  endendclass Game_Battler < Game_BattlerBase  alias :cpgfxc_item_apply :item_apply  def item_apply(*args)    cpgfxc_item_apply(*args)    $game_player.refresh  endendclass Game_Actor < Game_Battler  ## If no replacement is found, use the old one.  alias :cpgfxc_state_face_name :face_name  alias :cpgfxc_state_face_index :face_index  alias :cpgfxc_state_character_name :character_name  alias :cpgfxc_state_character_index :character_index  alias :cpgfxc_state_battler_name :battler_name  alias :cpgfxc_state_battler_hue :battler_hue  alias :cpgfxc_state_name :name   def face_name    state_graphic_bitface) || cpgfxc_state_face_name  end   def face_index    state_graphic_bitface_ind) || cpgfxc_state_face_index  end   def character_name    state_graphic_bitchara) || cpgfxc_state_character_name  end   def character_index    state_graphic_bitchara_ind) || cpgfxc_state_character_index  end   def battler_name    @held_battler_name = state_graphic_bitbattler) if alive?    @held_battler_name || cpgfxc_state_battler_name  end   def battler_hue    state_graphic_bitbattler_hue) || cpgfxc_state_battler_hue  end   def name    state_graphic_bitname) || cpgfxc_state_name  endendclass Game_Enemy < Game_Battler  alias :cpgfxc_state_original_name riginal_name  alias :cpgfxc_state_battler_name :battler_name  alias :cpgfxc_state_battler_hue :battler_hue   def face_name    state_graphic_bitface)  end   def face_index    state_graphic_bitface_ind)  end   def character_name    state_graphic_bitchara)  end   def character_index    state_graphic_bitchara_ind)  end   def battler_name    @held_battler_name = state_graphic_bitbattler) if alive?    @held_battler_name || cpgfxc_state_battler_name  end   def battler_hue    state_graphic_bitbattler_hue) || cpgfxc_state_battler_hue  end   def original_name    state_graphic_bitname) || cpgfxc_state_original_name  end   def name    get_name = state_graphic_bitname)    (get_name ? get_name : @original_name) + (@plural ? letter : "")  endendclass Game_Interpreter  alias :cpgfxc_command_313 :command_313  def command_313    cpgfxc_command_313    $game_player.refresh  endendclass Sprite_Battler < Sprite_Base  alias :cpgfxc_state_init_visibility :init_visibility  alias :cpgfxc_state_initialize :initialize   def initialize(*args)    @first_run = true    cpgfxc_state_initialize(*args)  end   def init_visibility    if @first_run      cpgfxc_state_init_visibility      @first_run = false    else      cpgfxc_state_init_visibility unless !@battler_visible && @battler.alive?    end  endendmodule CPmodule STATEGFXACTOR  = /actor (battler|character|face) gfx\["(.+)" (\d+) ([\d, ]+)\]/iENEMY  = /enemy (battler|character|face) gfx\["(.+)" (\d+) ([\d, ]+)\]/iCOMMON = /(battler|character|face) gfx\["(.+)" (\d+)\]/iNAME   = /(actor |enemy )?name change\["(.+)"([\d, ]*)\]/iSTACK  = /stack gfx\[(\d+)\]/iendendclass RPG::State < RPG::BaseItem  ## REGEXPs and a few time savers.  def graphics_change    create_state_graphic_list if @graphics_change_hash.nil?    @graphics_change_hash  end   def create_state_graphic_list    @graphics_change_hash = {}    note.split(/[\r\n]+/).each do |line|      if line =~ CP::STATEGFX::STACK        stack_pos = $1.to_i      else stack_pos = 0 end      case line      when CP::STATEGFX::ACTOR        bit, num = get_bit_num_61513($1.to_s.downcase)        package_61513($2.to_s, $3.to_i, to_a_61513($4.to_s), bit, num, stack_pos)      when CP::STATEGFX::ENEMY        bit, num = get_bit_num_61513($1.to_s.downcase)        package_61513($2.to_s, $3.to_i, to_a_61513($4.to_s), bit, num, stack_pos, true)      when CP::STATEGFX::COMMON        bit, num = get_bit_num_61513($1.to_s.downcase)        package_61513($2.to_s, $3.to_i, [0], bit, num, stack_pos)      when CP::STATEGFX::NAME        case $1.to_s.downcase        when "actor "; ary, invert = to_a_61513($3.to_s), false        when "enemy "; ary, invert = to_a_61513($3.to_s), true        else; ary, invert = [0], false        end        package_61513($2.to_s, 0, ary, :name, nil, stack_pos, invert)      end    end  end   def get_bit_num_61513(state)    case state    when "battler";   bit, num = :battler, :battler_hue    when "character"; bit, num = :chara,   :chara_ind    when "face";      bit, num = :face,    :face_ind    else;             bit, num = nil,      nil    end    return [bit, num]  end   def package_61513(string, int, array, bit, num, pos = 0, inverse = false)    array.each do |id|      id = inverse ? -id.to_i : id.to_i      @graphics_change_hash[id] ||= {}      @graphics_change_hash[id][bit] ||= {}      @graphics_change_hash[id][bit][pos] = string      @graphics_change_hash[id][num] ||= {}      @graphics_change_hash[id][num][pos] = int    end  end   def to_a_61513(string)    string.split(/,/)  endend##-----------------------------------------------------------------------------## End of script.##-----------------------------------------------------------------------------
Thanks~

Downloads / Referenced Files

Log in to download

Log in, then follow the RPG Maker Developers Group to see these download links.

Log in to download

License / Terms Note

##-----------------------------------------------------------------------------## State Graphics v1.3## Created by Neon Black#### For both commercial and non-commercial use as long as credit is given to## Neon Black and any additional authors.  Licensed under Creative Commons## CC BY 3.0 - http://creativecommons.org/licenses/by/3.0/.##----------------------------------------------------------------------------##                                                                              ####----------------------------------------------------------------------------####    Revision Info:## v1.3 - 8.17.2013##  Fixed an issue with character sprite changing## v1.2 - 3.16.2013##  Added stacking states functions## v1.1 - 3.15.2013##  Fixed bug related to death transitions## v1.0 - 3.15.2013##  Wrote and debugged main script##----------------------------------------------------------------------------##                                                                              ##$imported ||= {}                                                              ##$imported["Graphics_States"] = 1.3                                            ##                                                                             ...

Referenced Images / Attachments

AriaseECTest.png
AriaseECTest.png
Creator Claims / Removal

If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.

#039#rpg-maker-archive#rgss-support

Replies (0)

No replies yet.

0 replies 1 view

Log in to reply.

User Avatar