[RGSS2] ATS 3.0c Compatibility with Comp Faces

Hello,

I have these two scripts that are incompatible with each other. I've been trying to get them to work, but I'm running out of options. These are for RGSS2 / RPG Maker VX.

I'm trying to use Comp Faces within the Advanced Text System by utilizing the face graphic created in the Comp faces script and drawing it in ATS.

It works in another script by calling draw_actor_face(actor, 8, 32) and it grabs the face with the updated graphics. But when I try to utilize that in ATS, no face shows up. Any idea how to get them both working together so that I can use updated composite faces in ATS?

Advanced Text System (by Modern Algebra)


Spoiler: Comp Faces 1.0
Code:
#==============================================================================
#  Composite Faces/Layer Face Graphics
#  Version 1.0
#  By Mangomight
#  Date: October 27, 2012
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Place this script below Materials, and below Composite Character
#   if it's in use.

#    The script assumes that the images to look for is located in the
#   Graphics/Faces/ folder.
#
#============================================================================#
# * Setting up (Actors)
#============================================================================#
#
#    To begin with, you can set up the default Face-set for your actors
#   at line 223.
#  
#   Then, to have an actor equip new graphics via armors or weapons, all
#   you need to do is putting this comment in its notefield;
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#   \FG[<Name of Face Set>, <index in face set>, <hue>, <z>]
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#  EXAMPLES:
#    \fg[Actor1, 2]        # Face Set = Actor1 : index = 2 : hue = 0 : z = 0
#    \FG[Evil]             # Face Set = Evil   : index = 0 : hue = 0 : z = 0
#    \fG[Actor2, 3, 50, 2] # Face Set = Actor2 : index = 3 : hue = 50 : z = 2
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
#  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 (Events)
#============================================================================#
#
#    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 face graphic for the event. How to display the Event's Face
#  Graphic in a message is explained below.
#
#============================================================================#
# * Displaying the Faces in messages
#============================================================================#
#
#  To display an event's face graphic, you'd just have to use this
# code in a Script Call;
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#  show_event_face_graphic (event_id)
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#  ..event_id "0" means 'this' event, and 1, 2..etc is the id
#  of 'an' event. If not set, defaults to 0.
#
# To display an Actor's face graphic in messages is very similar;
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#  show_actor_face_graphic (actor_id)
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#  Where actor_id is the id of an actor. Defaults to the first
#  actor if not set.
#
#  * Note that the face-graphic you specify will only appear if
#  the Message's Face Graphic is empty. It'll then be continuesly
#  displayed until it's interrupted by another Face Graphic or
#  when the message is closed.
#
#   You can also you use this code to stop showing the current
#  graphic;
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#  stop_showing
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#============================================================================#
# * Adding & Removing Face-sets via Script Call
#============================================================================#
#
#  To remove graphics from an actor;
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#   remove_face_graphic (actor_id, index)
#   remove_face_graphic (actor_id, graphic_name, graphic_index)
#   remove_face_graphic (actor_id, graphic_name, graphic_index, graphic_hue)
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#
#  Adding graphics to an actor;
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# add_face_graphic (actor_id, graph_name, graph_index, graph_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_face set
#    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
#
#    Same as for Composite Character, the Change Graphic event command
#   adds Graphics to the current set, you can clean the set with the code:
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#    clear_character_graphic (actor_id)
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#   Note that this cleans both the Composite Face and Composite
#  Character arrays at the same time.
#
#<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~<>~~#
# * If you'd find any bugs or compability issues with this script, please
#  report them at rmrk.net and I'll try my best to help you.
#
#<>~~<>~~<>~~<>~~<>~~<>~~<>~~<>~~<>~~<>~~<>~~<>~~<>~~<>~~<>~~<>~~<>~~<>~~<>~~#
#==============================================================================


#==============================================================================
# *** module Cache
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - composite_face
#==============================================================================
module Cache
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Composite Face
  #    face_array : An array holding the names of all parts of a graphic
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.composite_face (face_array)
    @cache = {} if @cache == nil
    @type = [] if @type == nil
    # Blank bitmap if there is nothing in the array.
    @cache[face_array] = Bitmap.new (128, 128) if face_array.empty?
    # Create a template bitmap
    bitmap = Bitmap.new (128, 128)
    # If not in the cache
    if [email protected]? (face_array) || @cache[face_array].disposed?
      # Add in all the graphics
      face_array.each { |i|
        name, index, hue = i[0], i[1], i[2]
        bmp = load_bitmap ("Graphics/Faces/", name, hue)
        wdth = bmp.width / 4
        hgth = bmp.height / 2
        rect = Rect.new((index%4)*wdth, (index/4)*hgth, wdth, hgth)
        bitmap.blt(0, 0, bmp, rect)
      }
      @cache[face_array] = bitmap
      # Type ensures it is a Face Graphic
      @type.push (face_array.flatten)
    end
    @cache[face_array]
  end
end

#==============================================================================
# ** RPG::BaseItem
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - face_graphics
#==============================================================================
class RPG::BaseItem
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Face Graphics
  #``````````````````````````````````````````````````````````````````````````
  #  Retrieves Face Graphics from Note Field
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

def face_graphics
  graphics = []
  # Retrieve Graphics from Note Field
  text = self.note.dup
  while text.sub!(/\\fg\[([^,\]]+),*\s*(\d*),*\s*(\d*),*\s*(\d*)\]/i, '') != nil
    graphics.push([$1.to_s, $2.to_i, $3.to_i, $4.to_i])
  end
  graphics
end
end


#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  Summary of Changes:
#    aliased_method - initialize
#==============================================================================
class Game_Actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_accessor :hair_sprites
  attr_accessor :mango_comp_face
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mangmght_vsual_equip_face_init initialize
  def initialize (id)
    # Run Original Method
    mangmght_vsual_equip_face_init (id)
    @mango_comp_face = []
    @hair_sprites = []
    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>
    #    @mango_comp_face.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; put "x = hair_sprite" as comment in order
      # to remove the hair-graphic when helmet is equipped.
      @mango_comp_face.push (['![2]Player-Male-Skin01', 1, 0, 1])
      #<Insert Here>
    when 3 # 3rd Actor
      # Create Hair Sprite
      @mango_comp_face.push (['LayerFaceGraphics = hair_sprite', 2, 65])
      # Create Shirt Sprite
      @mango_comp_face.push (['LayerFaceGraphics', 6, 175])
      #<Insert Here>
    #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    # END EDITABLE REGION
    #/////////////////////////////////////////////////////////////////////
    end
    @mango_comp_face.each { |i|
      i.push 0 while i.size < 4
      while i[0].sub!(/(\s*=\s*hair_sprite)/i) { '' } != nil
        @hair_sprites.push (i)
      end
    }
    if @ma_composite_character != nil
      @ma_composite_character.each { |i|
        while i[0].sub!(/(\s*=\s*hair_sprite)/i) { '' } != nil
          @hair_sprites.push (i)
        end
      }
    end
    @mango_comp_face.unshift ([@face_name, @face_index, 0, -1]) if @face_name != ''
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Composite Face
  #``````````````````````````````````````````````````````````````````````````
  #  Returns Graphic Array for the actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def composite_face
    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].face_graphics if dup_armors[j]
      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.face_graphics if armr }
    weapons.each { |wpn| weapon_graphics += wpn.face_graphics if wpn }
    fg = @mango_comp_face + armor_graphics + weapon_graphics
    # If a helmet is equipped, temporarily removes the hair-sprite.
    fg.delete_if { |i| @hair_sprites.include?(i) && armors[1] }
    fg.sort! { |a, b| a[3] <=> b[3] }
    fg
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Composite Character
  #     aliased to fix the Hair Sprite-'bug'
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  if self.method_defined?(:composite_character)
    alias_method (:old_comp_char, :composite_character)
    def composite_character
      cg = old_comp_char
      cg.delete_if { |i| @hair_sprites.include?(i) && armors[1] }
      cg
    end
  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 man125_go_set_graphic set_graphic
  def set_graphic (*args)
    old_face_name, old_face_index = @face_name, @face_index
    # Run Original Method
    man125_go_set_graphic (*args)
    # Find old character name
    count = 0
    @mango_comp_face.each { |i|
      count += 1
      break if i[0] == old_face_name && i[1] == old_face_index
    }
    @mango_comp_face.insert (count, [@face_name, @face_index, 0, -1])
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Clear Graphic
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def clear_graphic
    # Clears the composite character array
    if @ma_composite_character
      @ma_composite_character.clear
      @ma_composite_character.push ([@character_name, @character_index, 0, -1])
    end
    # Clears the composite face array
    @mango_comp_face.clear
    @hair_sprites.clear
    @mango_comp_face.push ([@face_name, @face_index, 0, -1])
  end
end
 
#==============================================================================
# ** Game_Character
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new instance variable - composite_face
#==============================================================================

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

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

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

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

class Game_Interpreter
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_reader :events_id, :actors_id, :display_actor_face_msg,
              :display_event_face_msg
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * 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 Face Graphic From Character
  #    actor_id : the ID of the actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def remove_face_graphic (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 face set
      for composite in actor.mango_comp_face
        break if args == composite.first(args.size)
        index += 1
      end
    end
    # Delete graphic from the arrays
    a = actor.mango_comp_face.delete_at (index)
    actor.hair_sprites.delete(a)
    index
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Add Graphic To actor
  #    actor_id                           : the ID of the actor
  #    graph_name, graph_index, graph_hue : graphic specifications
  #    index                              : where to insert the new graphic
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def add_face_graphic (actor_id, graph_name, graph_index = 0, graph_hue = 0, z = 0, index = nil)
    actor = $game_actors[actor_id]
    index = actor.mango_comp_face.size unless index
    while graph_name.sub!(/(\s*=\s*hair_sprite)/i) { '' } != nil
      actor.hair_sprites.push [graph_name, graph_index, graph_hue, z]
    end
    actor.mango_comp_face.insert (index, [graph_name, graph_index, graph_hue, z])
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Add Graphic To Character
  #    aliased method (for composite character fix)
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  if self.method_defined?(:add_graphic_to_actor)
    alias_method (:old_add_graph_to_actr, :add_graphic_to_actor)
    def add_graphic_to_actor (*args)
      while args[1].sub!(/(\s*=\s*hair_sprite)/i) { '' } != nil
        $game_actors[args[0]].hair_sprites.push (args[1..4])
      end
      # Run Original Method
      old_add_graph_to_actr (*args)
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Display Actor's Face Graphic in Message
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def show_actor_face_graphic (actor_id = 1)
    @display_actor_face_msg = true
    @display_event_face_msg = false
    @actors_id = $game_actors[actor_id]
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Display Event's Face Graphic in Message
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def show_event_face_graphic (event_id = 0)
    @display_event_face_msg = true
    @display_actor_face_msg = false
    @events_id = get_character(event_id)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Stop showing the face graphic in Message
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def stop_showing
    @display_actor_face_msg = false
    @display_event_face_msg = false
  end
end

#==============================================================================
# ** Window_Base
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    overwritten method - draw_actor_face
#    new method - draw_event_face
#==============================================================================
class Window_Base < Window
 
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Actor Face Graphic
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     size  : Display size
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_actor_face(actor, x, y, size = 128)
    bitmap = Cache.composite_face (actor.composite_face)
    rect = Rect.new(0, 0, size, size)
    self.contents.blt(x, y, bitmap, rect)
    bitmap.dispose
  end

  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Event Face Graphic
  #     event : event
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     size  : Display size
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_event_face(event, x, y, size = 96)
    bitmap = Cache.composite_face (event.composite_face)
    rect = Rect.new(0, 0, size, size)
    self.contents.blt(x, y, bitmap, rect)
    bitmap.dispose
  end
end  

#==============================================================================
# ** Window_Message
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - new_page, dispose
#==============================================================================

class Window_Message < Window_Selectable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * New Page
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mngo124_mt_nw_pge512 new_page
  def new_page
    mngo124_mt_nw_pge512
    if $game_message.face_name.empty?
      if $game_map.interpreter.display_actor_face_msg
        actor = $game_map.interpreter.actors_id
        if actor != nil
          draw_actor_face(actor, -10, -20, 128)
          @contents_x = 112
        else
          $game_map.interpreter.stop_showing
        end
      elsif $game_map.interpreter.display_event_face_msg
        event = $game_map.interpreter.events_id
        if event != nil
          draw_event_face(event, 0, 0)
          @contents_x = 112
        else
          $game_map.interpreter.stop_showing
        end
      end
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * New Line
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma64_go_nw_line642 new_line
  def new_line
    ma64_go_nw_line642
    event_face = $game_map.interpreter.display_event_face_msg
    actor_face = $game_map.interpreter.display_actor_face_msg
    if $game_message.face_name.empty?
      @contents_x = event_face || actor_face ? 112 : 0
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Dispose
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mn_go_mt42_dspose14 dispose
  def dispose
    mn_go_mt42_dspose14
    # Makes sure the graphic won't re-appear after closing message.
    $game_map.interpreter.stop_showing
  end
end
Okay, so I know the script may be time-consuming to implement, does anyone have any advice on how I can just show the Comp faces not restricted by RPG Maker's little face borders, so I can show the full face?
Can you upload a demo? That way I won't lose the script files. 😀
Yep, here's a demo!
Sorry for the late response but would appreciate if you could take a look at it!
Can you upload a demo? That way I won't lose the script files. 😀
Also here's a demo of just the ATS 3.0 (I included it in the above demo, but it does have some examples of chat dialogue within events if you wanted to check those out)
After playing around with it bit more, I'm 80% sure the method will be to adjust the set_face method in ATS.


Spoiler: def set_face (face_file, index = 0)
Ruby:
 def set_face (face_file, index = 0)
    clear
    name = face_file.dup
    loop do
      # Make face and store in @face_sprites unless invalied
      face = Sprite_MessageFace.new (name, index, self.viewport) rescue break
      @face_sprites.push (face)
      break unless $game_message.animate_faces
      # If face_file has a number appended, add all of it's animations
      if name[/\_(\d+)$/i] != nil
        name.sub! (/(\d+)$/) { ($1.to_i + 1).to_s }
      elsif name[/^\!\[(\d+)\]./] != nil # If name has exclamation code
        # Take all animations from the same face file
        index += 1
        break if index == $1.to_i
      else
        break
      end
    end
    @active_face = 0
    @face_sprites[@active_face].visible = true if @face_sprites[@active_face]
    @busy = true
    remake_window
  end

Since this is called in draw_face

Spoiler: def draw_face (face_file, face_index, *args)
Ruby:
  def draw_face (face_file, face_index, *args)
    @face_window.set_face (face_file, face_index)
    set_face_position
    @face_window.z = self.z + $game_message.face_z
  end

Only thing I reckon that needs to be done is passing through the bitmap in set_face, which might need to be added in Sprite_MessageFace class
Spoiler: class Sprite_MessageFace < Sprite_Base
Ruby:
class Sprite_MessageFace < Sprite_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize (face_file, face_index, viewport = nil)
    super (viewport)
    wdth, hght = $game_message.face_width, $game_message.face_height
    face = Cache.face (face_file)
    if face_file[/^\$/] != nil # SINGLE
      wdth = face.width if wdth <= 0
      wdth = [face.width, wdth].min
      hght = face.height if hght <= 0
      hght = [face.height, hght].min
      rect = Rect.new((face.width-wdth) / 2, (face.height-hght) / 2, wdth, hght)
    else
      # Resize if face smaller than allotted size
      wdth = face.width / 4 if wdth <= 0
      wdth = [face.width / 4, wdth].min
      hght = face.height / 2 if hght <= 0
      hght = [face.height / 2, hght].min
      rect = Rect.new(0, 0, wdth, hght)
      rect.x = (face_index % 4) * wdth + ((face.width / 4) - wdth) / 2
      rect.y = (face_index / 4) * hght + ((face.height / 2) - hght) / 2
    end
    self.bitmap = Bitmap.new (rect.width, rect.height)
    self.bitmap.blt(0, 0, face, rect)
    self.mirror = $game_message.face_mirror
    self.blend_type = $game_message.face_blend_type
    self.visible = false
    self.opacity = $game_message.face_fadein ? 0 : $game_message.face_opacity
    $game_message.face_width, $game_message.face_height = rect.width, rect.height
  end
end
[/SPOILER]

One thought I had was to load the entire array from composite faces in Sprite_MessageFace, but not sure how to go about this.

Something that confused me is this, the face is drawn in def new_page without even using a draw_face method, but instead just loading in the $game_message.face_name and index. When a method already exists to use Actors Face, I've tried commenting out that method, and it still works, so which makes me think that this "def new_page" is what I need to load the composite faces in.

Spoiler: def new_page (*args)
Ruby:
alias malba_advts3_nwpge_7uj2 new_page
  def new_page (*args)
    if !$game_message.do_not_start || !@starting
      if @text.sub! (/\A\x17<(\d+)>/, "") != nil
        actor = $game_actors[$1.to_i]
          if !actor.nil?
          $game_message.face_name = actor.face_name
          $game_message.face_index = actor.face_index
        end
      end


other method that can be commented out:

when "\x17" # Use Actor Face
@text.sub! (/<(\d+)>/, "")
$game_message.face_name = $game_actors[$1.to_i].face_name
$game_message.face_index = $game_actors[$1.to_i].face_index
draw_face ($game_message.face_name, $game_message.face_index)
set_name_position



So if I can just pass 'bitmap = Cache.composite_face (actor.composite_face)' somewhere in this, it can possibly work?
You see, Modern Algebra is not the typical newbie, and he earned some good reputation among the people from the same era. Actually, he's come up with interesting scripts (for other people at least). The problem is that the ATS, especially this one for VX, sucks. It's not really a lost cause but has a TERRIBLE design. Some people tried to give him pieces of advice, and they had good intentions, yet, his execution was poor. His code ended up being convoluted for no good reason.

First of all, this argument maniac has been redefining methods as if they always were supposed to get N number of arguments. This happens even if the default method he's modifying accepts NO parameter at all. He didn't do it once or twice but almost EVERYWHERE. It's a laughable practice indeed. Especially true because it makes method calls slower than those that get 0 or a specific and invariable amout of parameters only.

Ruby:
class Game_Message
  def clear
    malg_ats3_clr_msg_9lo1
    @do_not_start = @do_not_refresh
    @choices = []
    @disabled_choices = []
    @skip_choices = []
    @help_choices = []
    @ignored_codes = []
    return if @do_not_start
     # Run Original Method
    @alignment = 0
    @appending_text = false
    @character = -1
    @char_ref = 0
    @override_run = false
    @highlight = -1
    @underline = false
    Game_ATS.constants.each do |name|
      base_name = name.downcase
      m_name = "@#{base_name}"
      instance_variable_set(m_name, $game_ats.send(base_name.to_sym))
    end
  end
end

Then I had to include this fix to make sure it could not fail while loading the Game_Message class once or twice. And this just means that I have only scratched the surface of what might be wrong with his coding style (when he crafted scripts for VX back in those days).

Now you know why I was not really motivated to work on this help request...
Fair enough, yeah this script is probably the most confusing I've worked with. I was able to restore functionality in his path_finding script after few hours of testing, surprised that script was released with a bug so big that deemed it unusable, but eventually made it work. Most of my other scripts that contained incompatibility issues were able to be fixed quite easily except this one.

So Plan B, is there a way to get the Comp faces bigger? I have tried adjusting the Window_Base draw_face and draw_actor_face to allow for 128px instead of 96, but seems to be cutting it off still.
Well, a typical VX window is 128 pixels high BUT it loses some 32 pixels because of the way it cuts out every single window widget found in the Window.png file and how it automatically reduces the self.contents size to 96 pixels by default. Since rewriting the window script in Ruby would make it perform sort of badly, your best option would be to set the window's height to 160 instead.

EDIT

Another option could be to create a secondary window like a gold window but used as a face container instead.
Forgot to update but ended up making a window like you said, thanks for the suggestion as it worked out a lot easier. I also made a nice fade-in effect similarly to how the windows work in ATS.

Original thread: https://forums.rpgmakerweb.com/threads/rgss2-ats-3-0c-compatibility-with-comp-faces.158302/