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.
Composite Character Sets / Visual Equipment

0 Members and 2 Guests are viewing this topic.

*
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
Composite Characters/Visual Equipment
Version: 1.2b
Author: modern algebra
Date: December 5, 2009

Version History


  • <Version 1.2b> 12.05.2009 - Very small oversight fixed - if you have been experiencing lag with this script, it might be a good idea to get this new version. There is no functional difference however.
  • <Version 1.2> 05.29.2009 - Number of Changes, including an easy wrapper for changing base graphics for actors, as well as a away to set priority for charsets, thus allowing for greater customizability
  • <Version 1.0> 07.05.2008 - Original Release

Description


This script allows you to create character sets from multiple character sheets, layering them on top of each other. It also allows you to set character graphics to armors and weapons, and these character sets will be layered on top of the character, thus making it a Visual Equipment script as well.

Features

  • Easy configuration
  • Hundreds of unique characters can be made from a limited set of resources.
  • Allows you to set hue for character sheets, meaning each resource can have hundreds of distinct colours.
  • Allows any weapon or armor to have any number of character sets stacked onto the character upon equip.
  • Events and Actors can also be set up so that they are composed of multiple character sets
  • Can set a priority for graphics, thus allowing you to determine what graphics should be drawn first
  • Can change base graphics for the actor with script calls

Screenshots


All character sets seen composed of this one character sheet, with all resources taken from the character generator here: http://www.famitsu.com/freegame/tool/chibi/index1.html


For more rips from that site, please see: http://rmrk.net/index.php/topic,31574.0.html

Instructions

Please see inside script for detailed instructions.

Script


Code: [Select]
#==============================================================================
#  Composite Characters / Visual Equipment
#  Version 1.2b
#  Author: modern algebra (rmrk.net)
#  Date: December 5, 2009
#  Original Release Date: July 5, 2008
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Place this script in between Materials and Main in the Script Editor
#
#    Basically, to work this script you need to do two things. 1) Setup your
#  actors default character sets - you will see a full set of instructions at
#  line xx. Now, to set a graphic for an armor or weapon, all you need to do
#  is place this code in the Notes box of the item:
#
#    \CG[<Name of Character Set>, <index in character set>, <hue>, <z>]
#
#  If you leave out index, it defaults to 0 and if you leave out hue, it also
#  defaults to 0. You can put more than one graphic to an armor or weapon and
#  they will stack by priority (z). Things with lower priority are drawn first.
#
#    Setting up an Event is similar - all you need to do is place a comment at
#  the very beginning of the event and put in the same code to generate a
#  composite character set for the event. Same rules apply, and remember, you
#  can stack character sets.
#
#  EXAMPLES:
#    \cg[Actor1, 2]        # Character Set = Actor1 : index = 2 : hue = 0 : z = 0
#    \CG[Evil]             # Character Set = Evil   : index = 0 : hue = 0 : z = 0
#    \cG[Actor2, 3, 50, 2] # Character Set = Actor2 : index = 3 : hue = 50 : z = 2
#
#    You can now remove and add graphics to the actor using the following codes
#  in a script call:
#
#   remove_graphic_from_actor (actor_id, index)
#   remove_graphic_from_actor (actor_id, graphic_name, graphic_index, graphic_hue)
#   add_graphic_to_actor (actor_id, graphic_name, graphic_index, graphic_hue, index)
#
#  where:
#    actor_id      : the ID of the actor whose graphic you are changing
#    index         : the index of the graphic in the actor's composite_character
#    graphic_name  : the name of the character set
#    graphic_index : the index of the character file in the set
#    graphic_hue   : the hue of the graphic
#
#    Also, the Change Actor Graphic event command now adds character sets to
#  the current set. You can clear an actor's character set with the code:
#
#    clear_character_graphic (actor_id)
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Compatibility:
#
#    Unfortunately, I did need to overwrite some methods for this script, and
#  as such there are likely to be compatibility problems. I know that my
#  Extra Movement Frames Script certainly will not work with this script, and
#  any script that tampers with the way a character set is drawn will also
#  likely encounter problems. Now, this is not to say that any script that
#  draws a character set will be incompatible - as long as that scripter uses
#  the draw_actor_graphic method of Window_Base it should work fine - it is
#  only scripts that change the way a character set is drawn that will cause
#  problems. Also, I tamper with the load_gamedata method of Window_SaveFile,
#  and so if another script overwrites that then there will again be
#  compatibility issues. If you find a script that seems to cause problems,
#  please post at the topic at rmrk.net and I will try my best to assist you.
#
#    Diedrupo's Caterpillar Script does not work immediately. A fix is posted
#  in this script's topic at rmrk.net.
#    Tankentai Sideview Battle System will not use composite character sprites
#  without a fix. That fix is also posted in this script's topic at rmrk.net
#==============================================================================

#==============================================================================
# *** module Cache
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - composite_character
#==============================================================================

module Cache
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Composite Character
  #    char_array : An array holding the names of all parts of a graphic
  #``````````````````````````````````````````````````````````````````````````
  #  Composes a single character bitmap out of all the ones given.
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.composite_character (char_array)
    @cache = {} if @cache == nil
    # Blank bitmap if there is nothing in the array.
    @cache[char_array] = Bitmap.new (32, 32) if char_array.empty?
    # If not in the cache
    if !@cache.include? (char_array) || @cache[char_array].disposed?
      # Create a template bitmap
      bitmap = Bitmap.new (32, 32)
      # Add in all other graphics
      char_array.each { |i|
        name, index, hue = i[0], i[1], i[2]
        # Bypass self.character in order to allow for setting hue
        bmp = load_bitmap ("Graphics/Characters/", name, hue)
        sign = name[/^[\!\$]./]
        # Get the width and height of the single character
        if sign != nil && sign.include? ('$')
          wdth, hght = bmp.width, bmp.height
        else
          wdth = bmp.width / 4
          hght = bmp.height / 2
        end
        # Expand bitmap if necessary
        if bitmap.width < wdth || bitmap.height < hght
          # Recreate bitmap
          temp_bmp = bitmap.dup
          bitmap = Bitmap.new ([temp_bmp.width, wdth].max, [temp_bmp.height, hght].max)
          bitmap.blt (0, 0, temp_bmp, temp_bmp.rect)
          temp_bmp.dispose
        end
        # Draw new character graphic onto bitmap
        src_rect = Rect.new ((index%4)*wdth, (index/4)*hght, wdth, hght)
        bitmap.blt (0, 0, bmp, src_rect)
      }
      @cache[char_array] = bitmap
    end
    return @cache[char_array]
  end
end

#==============================================================================
# ** RPG::BaseItem
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - character_graphics
#==============================================================================

class RPG::BaseItem
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Character Graphics
  #``````````````````````````````````````````````````````````````````````````
  #  Retrieves Character Graphics from Note Field
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def character_graphics
    graphics = []
    # Retrieve Note Field
    text = self.note.dup
    while text.sub! (/\\cg\[([^,\]]+),*\s*(\d*),*\s*(\d*),*\s*(\d*)\]/i) { '' } != nil
      a = [$1.to_s, ($2 != nil ? $2.to_i : 0), ($3 != nil ? $3.to_i : 0), ($4 != nil ? $4.to_i : 0)]
      graphics.push (a)
    end
    return graphics
  end
end

#==============================================================================
# ** Game_Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new methods - composite_character, clear_character
#    aliased methods - initialize, change_equip, set_graphic
#    new public instance variables - ma_composite_character, ma_return_composite
#==============================================================================

class Game_Actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_accessor :ma_composite_character
  attr_accessor :ma_return_composite
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initalization
  #`````````````````````````````````````````````````````````````````````````
  #  Initializes stacked_character variable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_arclght_vsual_equip_init_4t6h initialize
  def initialize (id)
    # Run Original Method
    modalg_arclght_vsual_equip_init_4t6h (id)
    @ma_composite_character = []
    @ma_return_composite = false
    case @actor_id
    #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    # EDITABLE REGION
    #|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
    #  An actor will automatically have whatever you set in the database
    #  as a bottom layer for him, but if you need to have other character
    #  sets piled on top, then put them in this format:
    #
    #  when <actor_id>
    #    @ma_composite_character.push (['graphic_name', index, hue, z])
    #      *for as many graphics as you want - first ones drawn first. If you
    #       want to know what each is, see the Instructions in the header.
    #       The z value allows you to set priority. So, something with -1
    #       z will be drawn below anything with a greater z value
    #/////////////////////////////////////////////////////////////////////
    when 1 # 1st Actor
      # Create Hair Sprite
      @ma_composite_character.push (['VisEquipSample', 1, 100])
    when 3 # 3rd Actor
      # Create skin sprite with different hue
      @ma_composite_character.push (['VisEquipSample', 0, 20])
      # Create Hair Sprites
      @ma_composite_character.push (['VisEquipSample', 2, 75])
      @ma_composite_character.push (['VisEquipSample', 3, 75])
    #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    # END EDITABLE REGION
    #/////////////////////////////////////////////////////////////////////
    end
    @ma_composite_character.each { |i|
      i[1] = 0 if i[1] == nil
      i[2] = 0 if i[2] == nil
      i[3] = 0 if i[3] == nil
    }
    @ma_composite_character.unshift ([@character_name, @character_index, 0, -1]) if @character_name != ''
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Composite Character
  #``````````````````````````````````````````````````````````````````````````
  #  Returns Graphic Array for the actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def composite_character
    armor_graphics = []
    weapon_graphics = []
    # Body Armor, then Helmet, then Shield, then all others
    dup_armors = armors.dup
    for i in 0...2
      j = 2 - i
      armor_graphics += dup_armors[j].character_graphics if dup_armors[j] != nil
      dup_armors.delete_at (j)
    end
    # If there is some multi-equip script, will get accessories and rest in order
    dup_armors.each { |armr| armor_graphics += armr.character_graphics if armr != nil }
    weapons.each { |wpn| weapon_graphics += wpn.character_graphics if wpn != nil }
    cg = @ma_composite_character + armor_graphics + weapon_graphics
    cg.sort! { |a, b| a[3] <=> b[3] }
    return cg
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Change Graphics
  #     character_name  : new character graphic filename
  #     character_index : new character graphic index
  #     face_name       : new face graphic filename
  #     face_index      : new face graphic index
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_cgve_st_grphic_evnt_6ht3 set_graphic
  def set_graphic(character_name, character_index, face_name, face_index)
    old_char_name, old_char_index = @character_name, @character_index
    # Run Original Method
    ma_cgve_st_grphic_evnt_6ht3 (character_name, character_index, face_name, face_index)
    # Find old character name
    count = 0
    @ma_composite_character.each { |char|
      count += 1
      break if char[0] == old_char_name && char[1] == old_char_index
    }
    # Put in new character directly after old one
    @ma_composite_character.insert (count, [@character_name, @character_index, 0, -1])
    $game_player.refresh
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Clear Graphic
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def clear_graphic
    @ma_composite_character.clear
    @ma_composite_character.push ([@character_name, @character_index, 0, -1])
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Character Name
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modrnalgbra_comp_char_retrn_charctrnm_6gd4 character_name
  def character_name
    # If asking for composite character, return it instead
    if @ma_return_composite
      @ma_return_composite = false
      return self.composite_character
    end
    return modrnalgbra_comp_char_retrn_charctrnm_6gd4
  end
end

#==============================================================================
# ** Game_Character
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new instance variable - composite_character
#==============================================================================

class Game_Character
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_reader :composite_character
end

#==============================================================================
# ** Game_Event
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - setup
#==============================================================================

class Game_Event
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Event page setup
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias malgbr_rclgh_req_comp_char_setup_5msk setup
  def setup(new_page)
    malgbr_rclgh_req_comp_char_setup_5msk (new_page)
    # Create Composite Character
    @composite_character = []
    @composite_character.push ([@character_name, @character_index, 0, -1]) unless @character_name.nil?
    # If page == nil, return
    return if @page == nil
    # Retrieve  first line comments
    comments = []
    @page.list.each { |i| i.code == 108 || i.code == 408 ? comments.push (i) : break }
    # Evaluate comments for \CG codes
    comments.each { |i|
      text = i.parameters[0].dup
      while text.sub! (/\\cg\[([^,\]]+),*\s*(\d*),*\s*(\d*),*\s*(\d*)\]/i) { '' } != nil
        a = [$1.to_s, ($2 != nil ? $2.to_i : 0), ($3 != nil ? $3.to_i : 0), ($4 != nil ? $4.to_i : 0)]
        @composite_character.push (a)
      end
    }
    # Sort Composite Characters by z value.
    @composite_character.sort! { |a, b| a[3] <=> b[3] }
  end
end

#==============================================================================
# ** Game_Player
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - refresh
#==============================================================================

class Game_Player
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Refresh
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mdalg_arc_comp_character_find_rfrsh_8kwi refresh
  def refresh
    mdalg_arc_comp_character_find_rfrsh_8kwi
    return if $game_party.members.empty?
    @composite_character = $game_party.members[0].composite_character
  end
end

#==============================================================================
# ** Game_Interpreter
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - clear_character_graphic
#==============================================================================

class Game_Interpreter
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Clear Character Graphic
  #    actor_id : the ID of the actor to be cleared
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def clear_character_graphic (actor_id)
    $game_actors[actor_id].clear_graphic
    $game_player.refresh
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Remove Graphic From Character
  #    actor_id : the ID of the actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def remove_graphic_from_actor (actor_id, *args)
    actor = $game_actors[actor_id]
    if args[0].is_a? (Integer)
      index = args[0]
    else
      index = 0
      # Find index of the specified character set
      for composite in actor.ma_composite_character
        if (args[0] != nil || args[0] == composite[0]) &&
             (args[1] != nil || args[1] == composite[1]) &&
             (args[2] != nil || args[2] == composite[2])
          break
        end
        index += 1
      end
    end
    # Delete graphic from array
    actor.ma_composite_character.delete_at (index)
    $game_player.refresh
    return index
  end
 
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Add Graphic To Character
  #    actor_id                        : the ID of the actor
  #    char_name, char_index, char_hue : character graphic specifications
  #    index                           : where to insert the new graphic
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def add_graphic_to_actor (actor_id, char_name, char_index = 0, char_hue = 0, z = 0, index = nil)
    actor = $game_actors[actor_id]
    index = actor.ma_composite_character.size if index.nil?
    actor.ma_composite_character.insert (index, [char_name, char_index, char_hue, z])
    $game_player.refresh
  end
end

#==============================================================================
# ** Sprite_Character
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - update_bitmap
#==============================================================================

class Sprite_Character
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Transfer Origin Bitmap
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modern_alg_arclightrequest_visual_equip_bmp_update update_bitmap
  def update_bitmap
    if @tile_id != @character.tile_id or
       @character_name != @character.character_name or
       @character_index != @character.character_index ||
       @composite_character != @character.composite_character
      @tile_id = @character.tile_id
      @character_name = @character.character_name
      @character_index = @character.character_index
      @composite_character = @character.composite_character
      if @tile_id > 0
        sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32;
        sy = @tile_id % 256 / 8 % 16 * 32;
        self.bitmap = tileset_bitmap(@tile_id)
        self.src_rect.set(sx, sy, 32, 32)
        self.ox = 16
        self.oy = 32
      else
        if @composite_character == nil
          # Regular Character Picture
          self.bitmap = Cache.character(@character_name)
          sign = @character_name[/^[\!\$]./]
          if sign != nil and sign.include?('$')
            @cw = bitmap.width / 3
            @ch = bitmap.height / 4
          else
            @cw = bitmap.width / 12
            @ch = bitmap.height / 8
          end
        else
          self.bitmap = Cache.composite_character(@composite_character)
          @cw = self.bitmap.width / 3
          @ch = self.bitmap.height / 4
        end
          self.ox = @cw / 2
          self.oy = @ch
      end
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Transfer Origin Rectangle
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_src_rect
    if @tile_id == 0
      index = 0
      pattern = @character.pattern < 3 ? @character.pattern : 1
      sx = (index % 4 * 3 + pattern) * @cw
      sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
      self.src_rect.set(sx, sy, @cw, @ch)
    end
  end
end

#==============================================================================
# ** Window_Base
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    overwritten method - draw_character_graphic
#==============================================================================

class Window_Base 
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Actor Walking Graphic
  #     actor : actor or comp character array
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_actor_graphic(actor, x, y)
    composite_character = actor.is_a? (Array) ? actor : actor.composite_character
    bitmap = Cache.composite_character (composite_character)
    cw = bitmap.width / 3
    ch = bitmap.height / 4
    rect = Rect.new (cw, 0, cw, ch)
    self.contents.blt (x - (cw / 2), y - ch, bitmap, rect)
  end
end

#==============================================================================
# ** Window_SaveFile
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    overwritten_methods - draw_party_characters
#==============================================================================

class Window_SaveFile < Window_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Party Characters
  #     x : Draw spot X coordinate
  #     y : Draw spot Y coordinate
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_party_characters(x, y)
    for i in 0...@characters.size
      draw_actor_graphic (@characters[i][0], x + i * 48, y)
    end
  end
end

#==============================================================================
# ** Scene_File
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - write_save_data
#==============================================================================

class Scene_File
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Write Save Data
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modrnbra_wrt_svdata_comp_chactes_63gb5 write_save_data
  def write_save_data (*args)
    # Set it to return composite characters
    $game_party.members.each { |actor| actor.ma_return_composite = true }
    # Run Original Method
    modrnbra_wrt_svdata_comp_chactes_63gb5 (*args)
  end
end

#==============================================================================
# ** Scene_Equip (For compatibility with KGC
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - terminate
#==============================================================================

class Scene_Equip
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Terminate
  #     updates game_player equipment
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_trmnte_cg_equipment_k8g9c terminate
  def terminate
    # RUn Original Method
    modalg_trmnte_cg_equipment_k8g9c
    $game_player.refresh
  end
end

Addons

Spoiler for Set Event Graphic to an Actor:
This is a simple little edit that allows you to change an event's graphic to that of an actor with a script call.
Code: [Select]
#==============================================================================
#    Set Event to Actor Graphic
#      Addon for Composite Character Sets / Visual Equipment
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: June 1, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#    Paste this into its own slot in the Script Editor, below Materials but
#   somewhere above Main
#
#    To set an event to actor graphic, use this code in a Script call (third
#   tab of event commands)
#      $game_map.events[event_id].set_to_actor (actor_id)
#          event_id : the ID of the event whose graphic you are changing
#          actor_id : the ID of the actor whose graphic you want the event to
#            have.
#
#    Remember, the event will retain whatever event settings it had originally,
#   including original pose, so if you want the event to be standing still
#   instead of with one leg out, you have to set it up with some graphic prior
#   to changing it by script and choose the pose you want the actor graphic to
#   be in.
#==============================================================================
# ** Game_Event
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - set_to_actor
#==============================================================================

class Game_Event
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set to Actor Graphic
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def set_to_actor (id)
    @composite_character = $game_actors[id].composite_character.dup
  end
end

Credit


  • modern algebra

Thanks

  • arclight, for the request

Support


Please post in this topic at rmrk for fastest support.

Known Compatibility Issues

Any scripts that play around with the way character sets are drawn will undoubtedly have some problems with this script. If you encounter any problems, please post the error and the script that is causing the problem and I will see if I can make them compatible.

Does not work with Dash Animation
Does not work with Extra Movement Frames

It ought to work with KGC Equip Extension

Spoiler for Composite Characters + Grid Inventory Compatibility Patch:
Equipment does not refresh upon exiting the Inventory, so this patch fixes that. Place it in its own section below the Grid Inventory script, but still above Main.

Code: [Select]
#==============================================================================
#  Composite Characters + Grid Inventory Compatibility Patch
#  Author: modern algebra
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#    Place this in its own slot beneath the Grid Inventory script
#==============================================================================
# ** Scene GridInventory
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - return_scene
#==============================================================================

class Scene_GridInventory
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Return Scene
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias monalg_compchar_gridinry_ptch_rtrnscn_2jj3 return_scene
  def return_scene (*args)
    # Run Original Method
    monalg_compchar_gridinry_ptch_rtrnscn_2jj3 (*args)
    $game_player.refresh
  end
end

Does not work with Diedrupo's Caterpillar script, but the fix is easy:
Spoiler for Fix:
Go into the Caterpillar script and you will see the following code around line 88:

Code: [Select]
  #--------------------------------------------------------------------------
  # * Setup
  #--------------------------------------------------------------------------
  def setup
    if @actor != nil     
      @character_name = $game_actors[@actor].character_name
      @character_index = $game_actors[@actor].character_index
    else
      @character_name = ""
      @character_index = 0
    end
    @opacity = 255
    @blend_type = 0
    @priority_type = 0
  end

replace it with:

Code: [Select]
  #--------------------------------------------------------------------------
  # * Setup
  #--------------------------------------------------------------------------
  def setup
    if @actor != nil     
      @composite_character = $game_actors[@actor].composite_character
    else
      @character_name = ""
      @character_index = 0
      @composite_character = nil
    end
    @opacity = 255
    @blend_type = 0
    @priority_type = 0
  end

It does not work with Tankentai Sideview Battle System. Please see this post for a compatibility fix for Version 3.3a. It will not work with animated battlers, but should draw regular sprites accurately if you are using them in battle.

In Shopoholic, it will not draw the composite character in Window_Shop_Details.
Spoiler for Fix:
At line 210 in Window_Shop_Details, replace:

Code: [Select]
    bitmap = Cache.character(actor.character_name)

with

Code: [Select]
    bitmap = Cache.composite_character(actor.composite_character)

Demo


See Attached for a technical demo. There is not much to it - it is solely so that you can look through and see how events, items, etc are set up.


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
« Last Edit: June 01, 2010, 08:37:14 PM by modern algebra »

**
Rep:
Level 85
Jack of all Trades
Thank you so much for the script. You're Awesome!!! With that done i'll begin making charsets for people to use. If i have another idea for enhancing VX i'll be sure you make a request via this site.  :D   Also... your script is doubly appreciated with me because i'm pondering the idea of learning RGSS2 scripting... (my native language is C++)... looking forward to examining the code.
« Last Edit: July 06, 2008, 09:14:18 AM by Arclight »
Arclight

A Jack of all Trades
An Ace of None

********
Shadow Knight
Rep:
Level 91
Ruin that brick wall!
Project of the Month winner for October 2008
Ingenious idea!
With this, a lot work can be saved indefinitely.

This opens a lot of new opportunities!
Great script MA, I love you. ;8
Be kind, everyone you meet is fighting a hard battle.

*
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
I am happy to have fulfilled the request. It was a fun request to take and I'm glad you liked it.

Thanks Leventhan.

**
Rep: +0/-0Level 85
This Script is amazing, I spent approximately 50 hours creating an event system to do something similar. I do have a question though. I am currently trying to make a character generator using this script, is there any way to have the hue and index areas in @composite_character.push (['graphic_name', index, hue] reference a variable in RMVX instead of a constant. (i.e. @composite_character.push (['graphic_name', variable 0001, variable 0002]) I am fairly new to scripting and am not sure how this process works. Any help would be GREATLY appreciated :)

*
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
No, I actually do not have that type of feature installed  :'(

Sorry. I could add it though.

**
Rep: +0/-0Level 85
That would be amazing, if its not too much work. I tried to do it, but since I know nothing about scripting it didn't work too well.

**
Rep:
Level 86
Sooo... how exactly do you rip the sprites from that website?
Great script, BTW

*
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
Well, it's not particularly easy, but there are a few ways. As far as I know, they don't have a download pack or anything like that. You just have to find the hosted images and save them. So, look at the page info media and you should find what you're looking for.

**
Rep:
Level 86
Ok, I've got the sprites.
P.S.: I found out how to do it ^_^
(http://www.famitsu.com/freegame/tool/chibi/image/ym/body/1_red.png) ect.
But another question... (sorry XD)
I have armour, and it's graphics are for Males.
I want this armour to be only usable by males because the clothing looks pretty messed up on a girl sprite   :-\
Do you know any way to achieve this?
« Last Edit: August 23, 2008, 09:45:19 AM by Evilnms »

*
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
Sure, just make it so that you have separate classes for each character, and two of each armour entry as well and make it so that only the male characters have the class that can wear male armour.

So, if you have a Paladin class that both a man and woman can have, then make two Paladin classes in the Database - one who wears male armour and one who wears female armour.

**
Rep: +0/-0Level 84
This is great!

I´m testing it out right now and have a question. Is this compatible with Equip Extension by KGC?
Because when I try it out it doesn´t work, but when I remove the KGC script it works fine.

The problem is that with the Equip Extension it gives no error, the visual equipment just isn´t ... well, visual.
Composite_Character works, though.

It would be so nice if theese two scripts would work together!

Good job!

KGC_EquipExtension:


Spoiler for:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/   ?                Skill CP System - KGC_SkillCPSystem               ? VX ?
#_/   ?                      Last Update: 2008/09/06                          ?
#_/   ?            Translated and Extended Updates by Mr. Anonymous           ?
#_/   ? KGC Site:                                                             ?
#_/   ? http://f44.aaa.livedoor.jp/~ytomy/                                    ?
#_/   ? Translator's Blog:                                                    ?
#_/   ? http://mraprojects.wordpress.com                                      ?
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/         This script has two functions equipment-related functions.
#_/   The first function is the ability to create moire 'slots' for equipment,
#_/  such as separating Boots and Gauntlets from mere 'accessories'.
#_/  It is possible to also create additional equipment slots. See the customize
#_/  block for more details.
#_/ 
#_/   The second function is an "EP" (Equipment Point) System, which allows you
#_/  to designate how many 'points' an item costs to successfully equip. A
#_/  character's total EP expenditure is increased upon leveling up.
#_/  This introduces more strategy-oriented character customization.
#_/----------------------------------------------------------------------------
#_/                        ? Instructions For Usage ?
#_/  To make use of these functions, you must insert the tag into the desired
#_/   item's "Notes" box located in the Armor tab of the database. For example,
#_/   you want the Leather Boots to be bound to the "Legs" slot and cost
#_/   2 EP to equip. Insert <equipkind Legs>, press enter, then add <EP 2>
#_/ 
#_/                                ? Tags ?
#_/  <equipkind EquipType>
#_/   Where EquipType = The name of the type of equipment. See EXTRA_EQUIP_KIND
#_/                                                        below.
#_/  <EP Amount>
#_/   Where Amount = The desired amount of EP the item requires to equip.
#_/
#_/
#_/                           ? Script Commands ?
#_/  These commands are used in "Script" function in the third page of event
#_/   commands under "Advanced".
#_/
#_/  * set_actor_equip_type(ActorID, [EquipType])
#_/     Allows you to manually specify an actor's equipment slots. a
#_/      Ex. set_actor_equip_type(2, [0, 2, 3, 3, 3])
#_/      If "nil"(without quotations) is appointed to EquipType, the default
#_/      EQUIP_TYPE (see below) is used. Trust me, it's useful!
#_/
#_/  * change_actor_equipment(ActorID, equipslot_index, ItemID)
#_/     Allows you to change the equipment of a specified actor.
#_/      equipslot_index works by finding the equipment slot number, which is
#_/      different from EQUIP_TYPE. Setting ItemID to 0 will remove the item.
#_/                   With the default setup, we see:
#_/      0=Weapon 1=Shield 2=Headgear 3=Armor 4=Accessory 5=Legs 6=Arms
#_/
#_/                         So, for an example:
#_/                  change_actor_equipment(1, 3, 15)
#_/ Would change Ralph's(Actor01 in the database) armor to Chainmail(By default)
#_/                                           
#_/    
#_/============================================================================
#_/ Installation: This script must be inserted below KCG_ExtendedEquipScene
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

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

module KGC
  module EquipExtension
  #           ? Extended Equipment Classification Names ?
  #  You may designate the names of additional equipment slots here.
  #   Each time you designate a new equipment slot, it is assigned a number.
  #   The first four equipment types (Shield, Helmet, Armor, and Accessory) are
  #   given as 1, 2, 3, 4, respectively. Then the values below are assigned in
  #   order. By default "Legs" and "Arms" would be 4 and 5. It is possible
  #   to add additional slots.
  #  Example: EXTRA_EQUIP_KIND = ["Legs", "Arms", "Skill Book"]
  EXTRA_EQUIP_KIND = ["Armar", "Ben", "Hals", "Finger", "Rygg", "Midja"]

  #                     ? Equipment Placement ?
  #  This allows you to arrange the equip slots as you see fit on the equipment
  #   menu. Note the order listed below.
  #                  ** Equipment Classification Summary **
  # 0.Shield  1.Headgear  2.Armor  3.Accessory  4. "Legs"  5."Arms"
  #  Note that these can be changed as desired. By default, we've enabled two
  #   accessory slots at the end, instead of one. If you plan on adding extra
  #   equip slots, the category's cooresponding number must be inserted in the
  #   brackets [] below.
  EQUIP_TYPE = [0, 1, 2, 4, 5, 6, 9, 8, 7, 7, 3]

  #                       ? EP (Equip Point) System ?
  #  These settings are for the Equipment Point Limit System.
  #   This toggle allows you to use the EP system if set to true.
  #   If set to false, the EP system will be disabled.
  USE_EP_SYSTEM = false
  # VOCAB_EP appears once a character gains EP from battle. (Not Tested)
  VOCAB_EP   = "EP"
  # VOCAB_EP_A appears above the EP gauge.
  VOCAB_EP_A = "EP"
  # This toggle allows you to display the EP gauge in the actor status window.
  SHOW_STATUS_EP = false

  #                          ? Default EP Cost ?
  #  Allows you to change the default amount an item costs to equip in EP.
  #   (When not otherwise specified.)
  DEFAULT_EP_COST   = 1
  #  This toggle allows you to hide the EP cost of an item if its cost is 0.
  #   true = hide
  #   false = show
  HIDE_ZERO_EP_COST = true

  #                        ? EP Values & Level Gain ?
  #  Maximum EP that can be spent equipping items.
  EP_MAX = 20
  # Characters begin with this amount of EP.
  EP_MIN = 5
  # ? EP Level Gain
  #  This is the formula for the amount of EP gained upon leveling up.
  #  The result of this formula is automatically converted to an integer.
  EP_CALC_EXP = "level * 0.3 + 4"
  # ? Individual Actor EP Level Gain
  PERSONAL_EP_CALC_EXP = [] # <- Do not alter or remove!
  #  Below here, you may specify formulas for individual actors that dictates
  #   the amount of EP they recieve upon leveling up. Like EP_CALC_EXP, the
  #   result is converted to an integer.
  #  Format: PERSONAL_EP_CALC_EXP[ActorID] = "Formula"
  #  The format is just like EP_CALC_EXP, except each actor is defined after
  #   PERSONAL_EP_CALC_EXP in brackets [].
  #  Any actor not specified uses the EP_CALC_EXP formula.
  #  Example:
  # PERSONAL_EP_CALC_EXP[1] = "level * 0.5 + 5"
  #                 ? Insert Personal EP Calculations Below Here ?
  PERSONAL_EP_CALC_EXP[1] = "level * 0.5 + 5"
 
 
 
  #                 ? Insert Personal EP Calculations Above Here ?
 
  #                        ? EP Gauge Colorization ?
  #  Allows you to change the color of the EP gauges.
  #  The color can also be determined by a red, green, and blue values.
  #  Example: GAUGE_NORMAL_START_COLOR = Color.new(255, 0, 0)  <- This is red.
  #   This method of color assignment is much like Tint Screen event command.
  #
  #  This affects the color of number that represents EP cost.
  EP_COST_COLOR        = 23
  #  This is the fill color for the early phase of the guage.
  EP_GAUGE_START_COLOR = 28
  #  This is the fill color for the late phase of the guage. (When full)
  EP_GAUGE_END_COLOR   = 29
  end
end

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

#=================================================#
#                    IMPORT                       #
#=================================================#

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

#=================================================#

module KGC::EquipExtension
  # Unless the EP system is used...
  unless USE_EP_SYSTEM
    SHOW_STATUS_EP = false
    HIDE_ZERO_EP_COST = true
  end

#==============================================================================
# ? KGC::EquipExtension::Regexp
#==============================================================================
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
#                          Note Field Tag Strings                             #
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
#  Whatever word(s) are after the separator ( | ) in the following lines are
#   what are used to determine what is searched for in the "Note" section of
#   an item or armor.

  #  Regular expressions defined
  module Regexp
    # Base Item Module
    module BaseItem
      #  EP Tag String
      EP_COST = /<EP\s*(\d+)>/i
      #  Item Type Tag String
      # Special note: I cannot get this tag to work right. If anyone knows how
      # this works or if it's bugged, please let me know.
      EQUIP_TYPE = /<(?:EQUIP_TYPE|equiptype)\s*(\d+(?:\s*,\s*\d+)*)>/
    end

    #  Base Armor Module
    module Armor
      #  Armor Type Tag String
      EQUIP_KIND = /<(?:EQUIP_KIND|equipkind)\s*(.+)>/i
    end
   
  end
end

#=================================================#

#==============================================================================
# ? KGC::Commands
#==============================================================================

module KGC
module Commands
  module_function
  #--------------------------------------------------------------------------
  # ? ??????????
  #--------------------------------------------------------------------------
  def restore_equip
    (1...$data_actors.size).each { |i|
      actor = $game_actors
      actor.restore_equip
    }
  end
  #--------------------------------------------------------------------------
  # ? ?????????????
  #     actor_id   : ???? ID
  #     equip_type : ?????
  #--------------------------------------------------------------------------
  def set_actor_equip_type(actor_id, equip_type = nil)
    actor = $game_actors[actor_id]
    return if actor == nil
    actor.equip_type = equip_type
  end
  #--------------------------------------------------------------------------
  # ? ??????????
  #     actor_id   : ???? ID
  #     index      : ???? (0?)
  #     item_id    : ?? or ?? ID (0 ???)
  #--------------------------------------------------------------------------
  def change_actor_equipment(actor_id, index, item_id)
    actor = $game_actors[actor_id]
    return if actor == nil
    actor.change_equip_by_id(index, item_id)
  end
end
end

class Game_Interpreter
  include KGC::Commands
end

#=================================================#

#==============================================================================
# ? Vocab
#==============================================================================

module Vocab
  # EP
  def self.ep
    return KGC::EquipExtension::VOCAB_EP
  end

  # EP (?)
  def self.ep_a
    return KGC::EquipExtension::VOCAB_EP_A
  end

  # ?????
  def self.extra_armor(index)
    return KGC::EquipExtension::EXTRA_EQUIP_KIND[index]
  end
end

#=================================================#

#==============================================================================
# ? RPG::BaseItem
#==============================================================================

class RPG::BaseItem
  #--------------------------------------------------------------------------
  # ? ?????????????
  #--------------------------------------------------------------------------
  def create_equip_extension_cache
    @__ep_cost = KGC::EquipExtension::DEFAULT_EP_COST
    @__equip_type = []

    self.note.split(/[\r\n]+/).each { |line|
      case line
      when KGC::EquipExtension::Regexp::BaseItem::EP_COST
        # ?? EP
        @__ep_cost = $1.to_i
      when KGC::EquipExtension::Regexp::BaseItem::EQUIP_TYPE
        # ?????
        @__equip_type = []
        $1.scan(/\d+/) { |num|
          @__equip_type << num.to_i
        }
      end
    }

    # EP ???????????? EP = 0
    @__ep_cost = 0 unless KGC::EquipExtension::USE_EP_SYSTEM
  end
  #--------------------------------------------------------------------------
  # ? ?? EP
  #--------------------------------------------------------------------------
  def ep_cost
    create_equip_extension_cache if @__ep_cost == nil
    return @__ep_cost
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  def equip_type
    create_equip_extension_cache if @__equip_type == nil
    return @__equip_type
  end
end

#=================================================#

#==============================================================================
# ? RPG::Armor
#==============================================================================

class RPG::Armor < RPG::BaseItem
  #--------------------------------------------------------------------------
  # ? ?????????????
  #--------------------------------------------------------------------------
  def create_equip_extension_cache
    super
    @__kind = -1

    self.note.split(/[\r\n]+/).each { |line|
      if line =~ KGC::EquipExtension::Regexp::Armor::EQUIP_KIND
        # ????
        e_index = KGC::EquipExtension::EXTRA_EQUIP_KIND.index($1)
        next if e_index == nil
        @__kind = e_index + 4
      end
    }
  end

unless $@
  #--------------------------------------------------------------------------
  # ? ??
  #--------------------------------------------------------------------------
  alias kind_KGC_EquipExtension kind
  def kind
    create_equip_extension_cache if @__kind == nil
    return (@__kind == -1 ? kind_KGC_EquipExtension : @__kind)
  end
end

end

#=================================================#

#==============================================================================
# ? Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ? ??????????
  #--------------------------------------------------------------------------
  attr_writer   :equip_type               # ?????
  #--------------------------------------------------------------------------
  # ? ??????
  #     actor_id : ???? ID
  #--------------------------------------------------------------------------
  alias setup_KGC_EquipExtension setup
  def setup(actor_id)
    actor = $data_actors[actor_id]
    @extra_armor_id = []

    setup_KGC_EquipExtension(actor_id)

    restore_equip
  end
  #--------------------------------------------------------------------------
  # ? MaxEP ??
  #--------------------------------------------------------------------------
  def maxep
    calc_exp = KGC::EquipExtension::PERSONAL_EP_CALC_EXP[self.id]
    if calc_exp == nil
      calc_exp = KGC::EquipExtension::EP_CALC_EXP
    end
    n = Integer(eval(calc_exp))
    return [[n, ep_limit].min, KGC::EquipExtension::EP_MIN].max
  end
  #--------------------------------------------------------------------------
  # ? EP ??
  #--------------------------------------------------------------------------
  def ep
    n = 0
    equips.compact.each { |item| n += item.ep_cost }
    return [maxep - n, 0].max
  end
  #--------------------------------------------------------------------------
  # ? EP ????
  #--------------------------------------------------------------------------
  def ep_limit
    return KGC::EquipExtension::EP_MAX
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def equip_type
    if @equip_type.is_a?(Array)
      return @equip_type
    else
      return KGC::EquipExtension::EQUIP_TYPE
    end
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  def armor_number
    return equip_type.size
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #--------------------------------------------------------------------------
  def extra_armor_number
    return [armor_number - 4, 0].max
  end
  #--------------------------------------------------------------------------
  # ? ?? ID ??????
  #--------------------------------------------------------------------------
  def extra_armor_id
    @extra_armor_id = [] if @extra_armor_id == nil
    return @extra_armor_id
  end
  #--------------------------------------------------------------------------
  # ? ?????????????
  #--------------------------------------------------------------------------
  alias armors_KGC_EquipExtension armors
  def armors
    result = armors_KGC_EquipExtension

    # ???????????
    extra_armor_number.times { |i|
      armor_id = extra_armor_id
      result << (armor_id == nil ? nil : $data_armors[armor_id])
    }
    return result
  end
  #--------------------------------------------------------------------------
  # ? ????? (?????????)
  #     equip_type : ????
  #     item       : ?? or ?? (nil ??????)
  #     test       : ?????? (???????????????????)
  #--------------------------------------------------------------------------
  alias change_equip_KGC_EquipExtension change_equip
  def change_equip(equip_type, item, test = false)
    change_equip_KGC_EquipExtension(equip_type, item, test)

    # ????????????
    if extra_armor_number > 0
      item_id = item == nil ? 0 : item.id
      case equip_type
      when 5..armor_number  # ?????
        @extra_armor_id = [] if @extra_armor_id == nil
        @extra_armor_id[equip_type - 5] = item_id
      end
    end

    restore_battle_skill if $imported["SkillCPSystem"]
    restore_passive_rev  if $imported["PassivSkill"]
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #     item : ?????? or ??
  #    ??????????????????????????
  #--------------------------------------------------------------------------
  alias discard_equip_KGC_EquipExtension discard_equip
  def discard_equip(item)
    last_armors = [@armor1_id, @armor2_id, @armor3_id, @armor4_id]

    discard_equip_KGC_EquipExtension(item)

    curr_armors = [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
    return unless item.is_a?(RPG::Armor)  # ?????
    return if last_armors != curr_armors  # ???????

    # ????????
    extra_armor_number.times { |i|
      if extra_armor_id == item.id
        @extra_armor_id = 0
        break
      end
    }

    restore_battle_skill if $imported["SkillCPSystem"]
    restore_passive_rev  if $imported["PassiveSkill"]
  end
  #--------------------------------------------------------------------------
  # ? ?? ID ???
  #     class_id : ????? ID
  #--------------------------------------------------------------------------
  alias class_id_equal_KGC_EquipExtension class_id=
  def class_id=(class_id)
    class_id_equal_KGC_EquipExtension(class_id)

    return if extra_armor_number == 0  # ????????

    # ?????????????
    for i in 5..armor_number
      change_equip(i, nil) unless equippable?(equips)
    end
  end
  #--------------------------------------------------------------------------
  # ? EP ???????
  #     equip_type : ????
  #     item       : ?? or ??
  #--------------------------------------------------------------------------
  def ep_condition_clear?(equip_type, item)
    return true if item == nil  # nil ?????? OK

    curr_item = equips[equip_type]
    offset = (curr_item != nil ? curr_item.ep_cost : 0)
    return false if self.ep < (item.ep_cost - offset)   # EP ??

    return true
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  def restore_equip
    return if @__last_equip_type == equip_type

    # ???????????????
    last_equips = equips
    last_hp = self.hp
    last_mp = self.mp
    if $imported["SkillCPSystem"]
      last_battle_skill_ids = battle_skill_ids.clone
    end

    # ?????
    last_equips.each_index { |i| change_equip(i, nil) }

    # ????????????
    last_equips.compact.each { |item| equip_legal_slot(item) }
    self.hp = last_hp
    self.mp = last_mp
    if $imported["SkillCPSystem"]
      last_battle_skill_ids.each_with_index { |s, i| set_battle_skill(i, s) }
    end
    @__last_equip_type = equip_type.clone
    Graphics.frame_reset
  end
  #--------------------------------------------------------------------------
  # ? ?????????????
  #     item : ?? or ??
  #--------------------------------------------------------------------------
  def equip_legal_slot(item)
    if item.is_a?(RPG::Weapon)
      if @weapon_id == 0
        # ?? 1
        change_equip(0, item)
      elsif two_swords_style && @armor1_id == 0
        # ?? 2 (??????)
        change_equip(1, item)
      end
    elsif item.is_a?(RPG::Armor)
      if !two_swords_style && item.kind == equip_type[0] && @armor1_id == 0
        # ????? (????????)
        change_equip(1, item)
      else
        # ??????????
        list = [-1, @armor2_id, @armor3_id, @armor4_id]
        list += extra_armor_id
        # ?????????????????
        equip_type.each_with_index { |kind, i|
          if kind == item.kind && list == 0
            change_equip(i + 1, item)
            break
          end
        }
      end
    end
  end
end

#=================================================#

#==============================================================================
# ? Window_Base
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # ? EP ???????
  #     actor : ????
  #--------------------------------------------------------------------------
  def ep_color(actor)
    return knockout_color if actor.maxep > 0 && actor.ep == 0
    return normal_color
  end
  #--------------------------------------------------------------------------
  # ? EP ????? 1 ???
  #--------------------------------------------------------------------------
  def ep_gauge_color1
    color = KGC::EquipExtension::EP_GAUGE_START_COLOR
    return (color.is_a?(Integer) ? text_color(color) : color)
  end
  #--------------------------------------------------------------------------
  # ? EP ????? 2 ???
  #--------------------------------------------------------------------------
  def ep_gauge_color2
    color = KGC::EquipExtension::EP_GAUGE_END_COLOR
    return (color.is_a?(Integer) ? text_color(color) : color)
  end
  #--------------------------------------------------------------------------
  # ? EP ???
  #     actor : ????
  #     x     : ??? X ??
  #     y     : ??? Y ??
  #     width : ?
  #--------------------------------------------------------------------------
  def draw_actor_ep(actor, x, y, width = 120)
    draw_actor_ep_gauge(actor, x, y, width)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 30, WLH, Vocab::ep_a)
    self.contents.font.color = ep_color(actor)
    xr = x + width
    if width < 120
      self.contents.draw_text(xr - 40, y, 40, WLH, actor.ep, 2)
    else
      self.contents.draw_text(xr - 90, y, 40, WLH, actor.ep, 2)
      self.contents.font.color = normal_color
      self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
      self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxep, 2)
    end
    self.contents.font.color = normal_color
  end
  #--------------------------------------------------------------------------
  # ? EP ??????
  #     actor : ????
  #     x     : ??? X ??
  #     y     : ??? Y ??
  #     width : ?
  #--------------------------------------------------------------------------
  def draw_actor_ep_gauge(actor, x, y, width = 120)
    gw = width * actor.ep / [actor.maxep, 1].max
    gc1 = ep_gauge_color1
    gc2 = ep_gauge_color2
    self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
    self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  end
  #--------------------------------------------------------------------------
  # ? ?? EP ???
  #     item    : ?? or ??
  #     rect    : ??????
  #     enabled : ????
  #--------------------------------------------------------------------------
  def draw_equipment_ep_cost(item, rect, enabled = true)
    return if item == nil
    # ?? EP 0 ????????
    return if KGC::EquipExtension::HIDE_ZERO_EP_COST && item.ep_cost == 0

    color = KGC::EquipExtension::EP_COST_COLOR
    self.contents.font.color = (color.is_a?(Integer) ?
      text_color(color) : color)
    self.contents.font.color.alpha = enabled ? 255 : 128
    self.contents.draw_text(rect, item.ep_cost, 2)
  end
end

#=================================================#

#==============================================================================
# ? Window_Equip
#==============================================================================

class Window_Equip < Window_Selectable
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @data = @actor.equips.clone
    @item_max = [@data.size, @actor.armor_number + 1].min
    create_contents

    # ???????
    self.contents.font.color = system_color
    if @actor.two_swords_style
      self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon1)
      self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::weapon2)
    else
      self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon)
      name = armor_slot_name(@actor.equip_type[0])
      self.contents.draw_text(4, WLH * 1, 92, WLH, name)
    end
    for i in 1...@actor.armor_number
      name = armor_slot_name(@actor.equip_type)
      self.contents.draw_text(4, WLH * (i + 1), 92, WLH, name)
    end

    # ??????
    rect = Rect.new(92, 0, self.width - 128, WLH)
    @item_max.times { |i|
      rect.y = WLH * i
      draw_item_name(@data, rect.x, rect.y)
      draw_equipment_ep_cost(@data, rect)
    }
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #     kind : ??
  #--------------------------------------------------------------------------
  def armor_slot_name(kind)
    case kind
    when 0..3
      return eval("Vocab.armor#{kind + 1}")
    else
      return Vocab.extra_armor(kind - 4)
    end
  end

unless $imported["ExtendedEquipScene"]
  #--------------------------------------------------------------------------
  # ? ????? 1 ????????
  #--------------------------------------------------------------------------
  def cursor_pagedown
    return if Input.repeat?(Input::R)
    super
  end
  #--------------------------------------------------------------------------
  # ? ????? 1 ???????
  #--------------------------------------------------------------------------
  def cursor_pageup
    return if Input.repeat?(Input::L)
    super
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def update
    super
    return unless self.active

    if Input.repeat?(Input::RIGHT)
      cursor_pagedown
    elsif Input.repeat?(Input::LEFT)
      cursor_pageup
    end
  end
end

end

#=================================================#

#==============================================================================
# ? Window_EquipItem
#==============================================================================

class Window_EquipItem < Window_Item
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def refresh
    @item_enabled = []
    super
    @data.each { |item| @item_enabled << enable?(item) }
  end
  #--------------------------------------------------------------------------
  # ? ????????????????
  #     item : ????
  #--------------------------------------------------------------------------
  def include?(item)
    return true if item == nil
    if @equip_type == 0
      return false unless item.is_a?(RPG::Weapon)
    else
      return false unless item.is_a?(RPG::Armor)
      return false unless item.kind == @equip_type - 1
    end
    return @actor.equippable?(item)
  end
  #--------------------------------------------------------------------------
  # ? ??????????????????
  #     item : ????
  #--------------------------------------------------------------------------
  def enable?(item)
    return false unless @actor.equippable?(item)                      # ????
    return false unless @actor.ep_condition_clear?(@equip_type, item)  # EP ??

    return true
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #     index : ????
  #--------------------------------------------------------------------------
  def draw_item(index)
    super(index)   
    rect = item_rect(index)
    item = @data[index]

    # ??????????
    cw = self.contents.text_size(sprintf(":%2d", 0)).width
    rect.width -= cw + 4
    draw_equipment_ep_cost(item, rect, enable?(item))
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #     equip_type : ????
  #--------------------------------------------------------------------------
  def simple_refresh(equip_type)
    # ???????????
    last_equip_type = @equip_type
    @equip_type = equip_type

    @data.each_with_index { |item, i|
      # ????????????????
      if enable?(item) != @item_enabled
        draw_item(i)
        @item_enabled = enable?(item)
      end
    }
    # ???????
    @equip_type = last_equip_type
  end
end

#=================================================#

#==============================================================================
# ? Window_EquipStatus
#==============================================================================

class Window_EquipStatus < Window_Base
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  alias refresh_KGC_EquipExtension refresh
  def refresh
    refresh_KGC_EquipExtension

    draw_actor_ep(@actor, 120, 0, 56) if KGC::EquipExtension::USE_EP_SYSTEM
  end
end

#=================================================#

#==============================================================================
# ? Window_Status
#==============================================================================

class Window_Status < Window_Base

if KGC::EquipExtension::SHOW_STATUS_EP
  #--------------------------------------------------------------------------
  # ? ???????
  #     x : ??? X ??
  #     y : ??? Y ??
  #--------------------------------------------------------------------------
  alias draw_basic_info_KGC_EquipExtension draw_basic_info
  def draw_basic_info(x, y)
    draw_basic_info_KGC_EquipExtension(x, y)

    draw_actor_ep(@actor, x + 160, y + WLH * 4)
  end
end

  #--------------------------------------------------------------------------
  # ? ??????
  #     x : ??? X ??
  #     y : ??? Y ??
  #--------------------------------------------------------------------------
  def draw_equipments(x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 120, WLH, Vocab::equip)

    item_number = [@actor.equips.size, @actor.armor_number + 1].min
    item_number.times { |i|
      draw_item_name(@actor.equips, x + 16, y + WLH * (i + 1))
    }
  end
end

#=================================================#

#==============================================================================
# ? Window_ShopStatus
#==============================================================================

class Window_ShopStatus < Window_Base
  #--------------------------------------------------------------------------
  # ? ?????????????????
  #     actor : ????
  #     x     : ??? X ??
  #     y     : ??? Y ??
  #--------------------------------------------------------------------------
  def draw_actor_parameter_change(actor, x, y)
    return if @item.is_a?(RPG::Item)
    enabled = actor.equippable?(@item)
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = enabled ? 255 : 128
    self.contents.draw_text(x, y, 200, WLH, actor.name)
    if @item.is_a?(RPG::Weapon)
      item1 = weaker_weapon(actor)
    elsif actor.two_swords_style and @item.kind == 0
      item1 = nil
    else
      index = actor.equip_type.index(@item.kind)
      item1 = (index != nil ? actor.equips[1 + index] : nil)
    end
    if enabled
      if @item.is_a?(RPG::Weapon)
        atk1 = item1 == nil ? 0 : item1.atk
        atk2 = @item == nil ? 0 : @item.atk
        change = atk2 - atk1
      else
        def1 = item1 == nil ? 0 : item1.def
        def2 = @item == nil ? 0 : @item.def
        change = def2 - def1
      end
      self.contents.draw_text(x, y, 200, WLH, sprintf("%+d", change), 2)
    end
    draw_item_name(item1, x, y + WLH, enabled)
  end
end

#=================================================#

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

class Scene_Equip < Scene_Base
  #--------------------------------------------------------------------------
  # ? ??
  #--------------------------------------------------------------------------
  EQUIP_TYPE_MAX = KGC::EquipExtension::EXTRA_EQUIP_KIND.size + 5
  #--------------------------------------------------------------------------
  # ? ?????????
  #     actor_index : ??????????
  #     equip_index : ????????
  #--------------------------------------------------------------------------
  alias initialize_KGC_EquipExtension initialize
  def initialize(actor_index = 0, equip_index = 0)
    initialize_KGC_EquipExtension(actor_index, equip_index)

    unit = ($imported["LargeParty"] ?
      $game_party.all_members : $game_party.members)
    actor = unit[actor_index]
    @equip_index = [@equip_index, actor.armor_number].min
  end
  #--------------------------------------------------------------------------
  # ? ????????????
  #--------------------------------------------------------------------------
  alias create_item_windows_KGC_EquipExtension create_item_windows
  def create_item_windows
    create_item_windows_KGC_EquipExtension

    kind = equip_kind(@equip_index)
    EQUIP_TYPE_MAX.times { |i|
      @item_windows.visible = (kind == i)
    }
  end
  #--------------------------------------------------------------------------
  # ? ????????????
  #--------------------------------------------------------------------------
  def update_item_windows
    kind = equip_kind(@equip_window.index)
    for i in 0...EQUIP_TYPE_MAX
      @item_windows.visible = (kind == i)
      @item_windows.update
    end
    @item_window = @item_windows[kind]
    @item_window.simple_refresh(@equip_window.index)
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #     index : ?????????
  #--------------------------------------------------------------------------
  def equip_kind(index)
    if index == 0
      return 0
    else
      return @actor.equip_type[index - 1] + 1
    end
  end

unless $imported["ExtendedEquipScene"]
  #--------------------------------------------------------------------------
  # ? ?????????????
  #--------------------------------------------------------------------------
  def update_status_window
    if @equip_window.active
      @status_window.set_new_parameters(nil, nil, nil, nil)
    elsif @item_window.active
      temp_actor = Marshal.load(Marshal.dump(@actor))
      temp_actor.change_equip(@equip_window.index, @item_window.item, true)
      new_atk = temp_actor.atk
      new_def = temp_actor.def
      new_spi = temp_actor.spi
      new_agi = temp_actor.agi
      @status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi)
    end
    @status_window.update
  end
end

  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  alias update_item_selection_KGC_EquipExtension update_item_selection
  def update_item_selection
    if Input.trigger?(Input::C)
      # ????????
      index = @equip_window.index
      item = @item_window.item
      unless item == nil ||
          (@actor.equippable?(item) && @actor.ep_condition_clear?(index, item))
        Sound.play_buzzer
        return
      end
    end

    update_item_selection_KGC_EquipExtension
  end
end

#=================================================#

#==============================================================================
# ? Scene_File
#==============================================================================

class Scene_File < Scene_Base
  #--------------------------------------------------------------------------
  # ? ???????????
  #     file : ??????????????? (??????)
  #--------------------------------------------------------------------------
  alias read_save_data_KGC_EquipExtension read_save_data
  def read_save_data(file)
    read_save_data_KGC_EquipExtension(file)

    KGC::Commands.restore_equip
    Graphics.frame_reset
  end
end

EDIT: nevermind, moved the scripts around a bit.... It´s working now. Thanks for
a fun script.
« Last Edit: November 11, 2008, 08:08:56 PM by Jensen »

**
Rep: +0/-0Level 87
Hey I was wonder how did you change your characters skin if oyu wnted to do it through an event?

*
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
Yeah, sort of. You just need to change it to a new page.

**
Rep: +0/-0Level 87
I get an error when i try and add the Equip Extension by KGC it says the stack lvl is too deep how do you fix this?

thanks in advance

*
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
First try putting my script below the kgc one in the editor. If that doesn't work, I have no idea what the KGC script looks like, so I'll need to see it. Preferably, I'd like you to upload a project with the error in it.

*
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
There was a little bug in the script included in the demo and so I have reuploaded the fixed version of this demo. This bug consisted of an error where the up row of the sprite would not show up if it were a single file (starts with $). I apologize for this bug. If you had gotten the script straight from the code box, then you would not get this bug as that had been fixed from the day I put it up, so it is only necessary to re-get the script if you took it directly from the demo and you plan on using single-file sprites.

**
Rep:
Level 84
Koalas are awesome
1st of all, great script!
But, I too would like to use both this and KGC's Equip Extension... I have the two scripts attached to this post.

Thanks,
Miget man12
Spoiler for BIG:
A mini-biography-ish thing of meI am learning to script with Ruby/RGSS2, I think I'm getting pretty good at it :)
Oh yeah, and I know Latin, that count's for something, doesn't it?
This is amazing, can you raed it?
Quote
Olny 55% of plepoe can raed this.
I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it whotuit a pboerlm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Azanmig huh? yaeh and I awlyas tghuhot slpeling was ipmorantt! Spelling is important!! :D
fi yuo cna raed tihs, palce it in yuor siantugre.
The Best Ruby Guide I've Found: Why's (poignant) guide to ruby

*
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
I'll look into it. I like your map.

*
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
OK, I have posted below a version of the script that should be compatible with KGC - at least it should not cause the stack error. Please report back to me if there are any problems:

Code: [Select]
#==============================================================================
#  Composite Characters / Visual Equipment
#  Version 1.0 (KGC COMPATIBLE VERSION)
#  Author: modern algebra (rmrk.net)
#  Date: July 5, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Instructions:
#
#    Place this script in between Materials and Main in the Script Editor
#
#    To set a graphic for an armor or weapon, all you need to do is place this
#  code in the Notes box of the item:
#
#    \CG[<Name of Character Set>, <index in character set>, <hue>]
#
#  If you leave out index, it defaults to 0 and if you leave out hue, it also
#  defaults to 0. You can put more than one graphic to an armor or weapon and
#  they will stack, first one on bottom last one on top.
#
#    Setting up an Event is similar - all you need to do is place a comment at
#  the very beginning of the event and put in the same code to generate a
#  composite character set for the event. Same rules apply, and remember, you
#  can stack character sets.
#
#  EXAMPLES:
#    \cg[Actor1, 2]     # Character Set = Actor1 : index = 2 : hue = 0
#    \CG[Evil]          # Character Set = Evil   : index = 0 : hue = 0
#    \cG[Actor2, 3, 50] # Character Set = Actor2 : index = 3 : hue = 50
#
#  Setting up your Actors is similar - see line 151 for details.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Compatibility:
#
#    Unfortunately, I did need to overwrite some methods for this script, and
#  as such there are likely to be compatibility problems. I know that my
#  Extra Movement Frames Script certainly will not work with this script, and
#  any script that tampers with the way a character set is drawn will also
#  likely encounter problems. Now, this is not to say that any script that
#  draws a character set will be incompatible - as long as that scripter uses
#  the draw_actor_graphic method of Window_Base it should work fine - it is
#  only scripts that change the way a character set is drawn that will cause
#  problems. Also, I tamper with the load_gamedata method of Window_SaveFile,
#  and so if another script overwrites that then there will again be
#  compatibility issues. If you find a script that seems to cause problems,
#  please post at the topic at rmrk.net and I will try my best to assist you.
#==============================================================================

#==============================================================================
# *** module Cache
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    new method - composite_character
#==============================================================================

module Cache
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Composite Character
  #    char_array : An array holding the names of all parts of a graphic
  #--------------------------------------------------------------------------
  #  Composes a single character bitmap out of all the ones given.
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.composite_character (char_array)
    @cache = {} if @cache == nil
    # Blank bitmap if there is nothing in the array.
    @cache[char_array] = Bitmap.new (32, 32) if char_array.empty?
    # If not in the cache
    if !@cache.include? (char_array) || @cache[char_array].disposed?
      # Create a template bitmap
      bitmap = Bitmap.new (32, 32)
      # Add in all other graphics
      char_array.each { |i|
        name, index, hue = i[0], i[1], i[2]
        # Bypass self.character in order to allow for setting hue
        bmp = load_bitmap ("Graphics/Characters/", name, hue)
        sign = name[/^[\!\$]./]
        # Get the width and height of the single character
        if sign != nil && sign.include? ('$')
          wdth, hght = bmp.width, bmp.height
        else
          wdth = bmp.width / 4
          hght = bmp.height / 2
        end
        # Expand bitmap if necessary
        if bitmap.width < wdth || bitmap.height < hght
          # Recreate bitmap
          temp_bmp = bitmap.dup
          bitmap = Bitmap.new ([temp_bmp.width, wdth].max, [temp_bmp.height, hght].max)
          bitmap.blt (0, 0, temp_bmp, temp_bmp.rect)
          temp_bmp.dispose
        end
        # Draw new character graphic onto bitmap
        src_rect = Rect.new ((index%4)*wdth, (index/4)*hght, wdth, hght)
        bitmap.blt (0, 0, bmp, src_rect)
      }
      @cache[char_array] = bitmap
    end
    return @cache[char_array]
  end
end

#==============================================================================
# ** RPG::BaseItem
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    new method - character_graphics
#==============================================================================

class RPG::BaseItem
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Character Graphics
  #--------------------------------------------------------------------------
  #  Retrieves Character Graphics from Note Field
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def character_graphics
    graphics = []
    # Retrieve Note Field
    text = self.note.dup
    while text.sub! (/\\cg\[([\w\s]+),*\s*(\d*),*\s*(\d*)\]/i) { '' } != nil
      graphics.push ([$1.to_s, $2.to_i, $3.to_i])
    end
    return graphics
  end
end


#==============================================================================
# ** Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    new method - composite_character
#    aliased_method - initialize, change_equip
#==============================================================================

class Game_Actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_writer :composite_character
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initalization
  #-------------------------------------------------------------------------
  #  Initializes stacked_character variable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_arclght_vsual_equip_init_4t6h initialize
  def initialize (id)
    # Run Original Method
    modalg_arclght_vsual_equip_init_4t6h (id)
    @composite_character = []
    case @actor_id
    #---------------------------------------------------------------------
    # EDITABLE REGION
    #|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
    #  An actor will automatically have whatever you set in the database
    #  as a bottom layer for him, but if you need to have other character
    #  sets piled on top, then put them in this format:
    #
    #  when <actor_id>
    #    @composite_character.push (['graphic_name', index, hue])
    #      *for as many graphics as you want - first ones drawn first. If you
    #       want to know what each is, see the Instructions in the header.
    #----------------------------------------------------------------------
    when 1 # 1st Actor
      # Create Hair Sprite
      @composite_character.push (['VisEquipSample', 1, 100])
    when 3 # 3rd Actor
      # Create skin sprite with different hue
      @composite_character.push (['VisEquipSample', 0, 20])
      # Create Hair Sprites
      @composite_character.push (['VisEquipSample', 2, 75])
      @composite_character.push (['VisEquipSample', 3, 75])
    #----------------------------------------------------------------------
    # END EDITABLE REGION
    #----------------------------------------------------------------------
    end
    @composite_character.each { |i|
      i[1] = 0 if i[1] == nil
      i[2] = 0 if i[2] == nil
    }
    @composite_character.unshift ([@character_name, @character_index, 0]) if @character_name != ''
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Composite Character
  #--------------------------------------------------------------------------
  #  Returns Graphic Array for the actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def composite_character
    armor_graphics = []
    weapon_graphics = []
    # Body Armor, then Helmet, then Shield, then all others
    dup_armors = armors.dup
    for i in 0...2
      j = 2 - i
      armor_graphics += dup_armors[j].character_graphics if dup_armors[j] != nil
      dup_armors.delete_at (j)
    end
    # If there is some multi-equip script, will get accessories and rest in order
    dup_armors.each { |armr| armor_graphics += armr.character_graphics if armr != nil }
    weapons.each { |wpn| weapon_graphics += wpn.character_graphics if wpn != nil }
    return @composite_character + armor_graphics + weapon_graphics
  end
end

#==============================================================================
# ** Game_Party
#==============================================================================
class Game_Party
  attr_reader :actors
end

#==============================================================================
# ** Game_Character
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    new instance variable - composite_character
#==============================================================================

class Game_Character
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_reader :composite_character
end

#==============================================================================
# ** Game_Event
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliased methods - setup
#==============================================================================

class Game_Event
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Event page setup
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias malgbr_rclgh_req_comp_char_setup_5msk setup
  def setup(new_page)
    malgbr_rclgh_req_comp_char_setup_5msk (new_page)
    # Create Composite Character
    @composite_character = []
    @composite_character.push ([@character_name, @character_index, 0]) unless @character_name.nil?
    # If page == nil, return
    return if @page == nil
    # Retrieve  first line comments
    comments = []
    @page.list.each { |i| i.code == 108 || i.code == 408 ? comments.push (i) : break }
    # Evaluate comments for \CG codes
    comments.each { |i|
      text = i.parameters[0].dup
      while text.sub! (/\\cg\[([\w\s]+),*\s*(\d*),*\s*(\d*)\]/i) { '' } != nil
        @composite_character.push ([$1.to_s, $2.to_i, $3.to_i])
      end
    }
  end
end

#==============================================================================
# ** Game_Player
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliased method - refresh
#==============================================================================

class Game_Player
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Refresh
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mdalg_arc_comp_character_find_rfrsh_8kwi refresh
  def refresh
    mdalg_arc_comp_character_find_rfrsh_8kwi
    if !$game_party.actors.empty?
      @composite_character = $game_party.members[0].composite_character
    end
  end
end

#==============================================================================
# ** Sprite_Character
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliased method - update_bitmap
#==============================================================================

class Sprite_Character
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Transfer Origin Bitmap
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modern_alg_arclightrequest_visual_equip_bmp_update update_bitmap
  def update_bitmap
    if @tile_id != @character.tile_id or
       @character_name != @character.character_name or
       @character_index != @character.character_index ||
       @composite_character != @character.composite_character
      @tile_id = @character.tile_id
      @character_name = @character.character_name
      @character_index = 0
      @composite_character = @character.composite_character
      if @tile_id > 0
        sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32;
        sy = @tile_id % 256 / 8 % 16 * 32;
        self.bitmap = tileset_bitmap(@tile_id)
        self.src_rect.set(sx, sy, 32, 32)
        self.ox = 16
        self.oy = 32
      else
        if @composite_character == nil
          # Regular Character Picture
          self.bitmap = Cache.character(@character_name)
          sign = @character_name[/^[\!\$]./]
          if sign != nil and sign.include?('$')
            @cw = bitmap.width / 3
            @ch = bitmap.height / 4
          else
            @cw = bitmap.width / 12
            @ch = bitmap.height / 8
          end
        else
          self.bitmap = Cache.composite_character(@composite_character)
          @cw = self.bitmap.width / 3
          @ch = self.bitmap.height / 4
        end
          self.ox = @cw / 2
          self.oy = @ch
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Update Transfer Origin Rectangle
  #--------------------------------------------------------------------------
  def update_src_rect
    if @tile_id == 0
      index = 0
      pattern = @character.pattern < 3 ? @character.pattern : 1
      sx = (index % 4 * 3 + pattern) * @cw
      sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
      self.src_rect.set(sx, sy, @cw, @ch)
    end
  end
end

#==============================================================================
# ** Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    overwritten method - draw_character_graphic
#==============================================================================

class Window_Base 
  #--------------------------------------------------------------------------
  # * Draw Actor Walking Graphic
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_actor_graphic(actor, x, y)
    bitmap = Cache.composite_character (actor.composite_character)
    cw = bitmap.width / 3
    ch = bitmap.height / 4
    rect = Rect.new (cw, 0, cw, ch)
    self.contents.blt (x - (cw / 2), y - ch, bitmap, rect)
  end
end

#==============================================================================
# ** Window_SaveFile
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    overwritten_methods - load_gamedata,
#==============================================================================

class Window_SaveFile < Window_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Load Partial Game Data
  #--------------------------------------------------------------------------
  #  The same as the original method with the exception that it gets all of
  #  that file's data up to @game_party - necessary for composite graphics
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def load_gamedata
    @time_stamp = Time.at(0)
    @file_exist = FileTest.exist?(@filename)
    if @file_exist
      file = File.open(@filename, "r")
      @time_stamp = file.mtime
      begin
        @characters     = Marshal.load(file)
        @frame_count    = Marshal.load(file)
        @last_bgm       = Marshal.load(file)
        @last_bgs       = Marshal.load(file)
        @game_system    = Marshal.load(file)
        @game_message   = Marshal.load(file)
        @game_switches  = Marshal.load(file)
        @game_variables = Marshal.load(file)
        # Bypass self-switches
        @game_self_switches = Marshal.load(file)
        # Bypass Actors
        @game_actors = Marshal.load(file)
        # Get Party
        @game_party = Marshal.load (file)
        @total_sec = @frame_count / Graphics.frame_rate
      rescue
        @file_exist = false
      ensure
        file.close
      end
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Party Characters
  #     x : Draw spot X coordinate
  #     y : Draw spot Y coordinate
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_party_characters(x, y)
    for i in 0...@game_party.actors.size
      draw_actor_graphic (@game_actors[@game_party.actors[i]], x + i * 48, y)
    end
  end
end

#==============================================================================
# ** Scene_Equip
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - terminate
#==============================================================================

class Scene_Equip
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Terminate
  #     updates game_player equipment
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_trmnte_cg_equipment_k8g9c terminate
  def terminate
    # RUn Original Method
    modalg_trmnte_cg_equipment_k8g9c
    $game_player.refresh
  end
end

Just replace the current slot you have with this one.

And yay for double posting.

**
Rep:
Level 84
Koalas are awesome
Thanks so much!
It works fine, this will make my game much more... complete.
Spoiler for BIG:
A mini-biography-ish thing of meI am learning to script with Ruby/RGSS2, I think I'm getting pretty good at it :)
Oh yeah, and I know Latin, that count's for something, doesn't it?
This is amazing, can you raed it?
Quote
Olny 55% of plepoe can raed this.
I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it whotuit a pboerlm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Azanmig huh? yaeh and I awlyas tghuhot slpeling was ipmorantt! Spelling is important!! :D
fi yuo cna raed tihs, palce it in yuor siantugre.
The Best Ruby Guide I've Found: Why's (poignant) guide to ruby

**
Rep: +0/-0Level 86
The "Change Actor Graphic" function doesn't work. My intro lets the players design their character but the function "Change Actor Graphic" on page 3 doesn't work when I use this script. It is critical that you could do a fix.

Thanks.

*
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
I like that you use the word "critical" seriously :P

Anyway, here, I prepared a fix. The way it works is that the command adds the newly set graphic to the character (I assume, since you are allowing the character to be designed, this is what you want - so if you have a body as the default character graphic, then using this command on say, a hair sprite will give him hair; you could then use it again and it would add another feature, etc...), and then I implemented another command that will clear away all other graphics for when you want to change the thing entirely. If you use the script vent command and type in:

clear_character_graphic (actor_id) - it will clear away all graphics except the one last added.

Code: [Select]
#==============================================================================
# ** Game Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - set_graphic
#==============================================================================

class Game_Actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Change Graphics
  #     character_name  : new character graphic filename
  #     character_index : new character graphic index
  #     face_name       : new face graphic filename
  #     face_index      : new face graphic index
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_cgve_st_grphic_evnt_6ht3 set_graphic
  def set_graphic(character_name, character_index, face_name, face_index)
    old_char_name, old_char_index = @character_name, @character_index
    # Run Original Method
    ma_cgve_st_grphic_evnt_6ht3 (character_name, character_index, face_name, face_index)
    # Find old character name
    count = 0
    @composite_character.each { |char|
      count += 1
      break if char[0] == old_char_name && char[1] == old_char_index
    }
    # Put in new character directly after old one
    @composite_character.insert (count, [@character_name, @character_index, 0])
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Clear Graphic
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def clear_graphic
    @composite_character.clear
    @composite_character.push ([@character_name, @character_index, 0])
  end
end

#==============================================================================
# ** Game_Interpreter
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - clear_character_graphic
#==============================================================================

class Game_Interpreter
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Clear Character Graphic
  #    actor_id : the ID of the actor to be cleared
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def clear_character_graphic (actor_id)
    $game_actors[actor_id].clear_graphic
    $game_player.refresh
  end
end

**
Rep: +0/-0Level 86
Er... so I asume that this fixes the function " Change Actor Graphic" or if your talking about something else. I see you said use this command so Im thinking " He forgot to tell me the command".

Could you add me to msn " k-yoshi@live.com"

Also, that script.. Could you add it to the script.
« Last Edit: March 13, 2009, 11:50:44 PM by xakiru »

*
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
Yeah, that's the one I'm talking about. It now works the way I outlined in the previous post.