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 Faces/Layer Face Graphics

0 Members and 2 Guests are viewing this topic.

**
Rep:
Level 66
RMRK Junior
Composite Faces/Layer Face Graphics
Version 1.0
Author: Mangomight
Date: 27-10-2012




This script seemed to be wanted, so I thought, why not? :P
Released in October 27 2012

Description


This script allows Actors, and Events aswell to have a Face Graphics made out of multiple sprites, stacked by priority. The ideas and functions is pretty much the same as in Composite Character, you can set graphics to armors and weapons and then have them displayed to an Actor's Face Graphic. Having the customized Graphics displayed in messages requires nothing more than a script call.


Features

  • Easy Configuration
  • Can create hundreds of unique Face Graphics out of a few.
  • Any armor or weapon can be added to an Actor's Face Graphic at equip.
  • Allows setting hue, making it possible to change each graphics color by a large variety.
  • Settable priority, allows determining which graphic should be drawn first.
  • Both Actors and Events can have these kind of Face Graphic applied.
  • Can change the graphics for an actor through script calls.
  • Can display the Faces in messages simply by using a script call.


Instructions

See inside the script.



Script

Code: [Select]
#==============================================================================
#  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, items, etc.
#   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 (96, 96) if face_array.empty?
    # Create a template bitmap
    bitmap = Bitmap.new (96, 96)
    # If not in the cache
    if !@type.include? (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)
    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*)\]/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 (['LayerFaceGraphics = hair_sprite', 1, 0])
      #<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 = 96)
    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, 0, 0)
          @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


Support


Please post if you find any bugs or compability issues.


Credit


  • Mangomight

Thanks

  • Infinate X, for the script request
  • Modern Algebra, for the Composite Character script, which this is based on.

Demo


See the attached file - demo also includes Composite Character



Restrictions
  • May NOT be included in commercial projects without express permission from the author.
  • Free for all non-commercial projects.
« Last Edit: April 20, 2013, 09:19:01 PM by Mangomight »

**
Rep: +0/-0Level 67
RPGVX Advanced (I Do Not Script Tough)
Awesome Man !
I have Been Waiting For This Script For So Long  :)
Love It !  ;D

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Nice! This seems very useful mango!

****
Rep:
Level 57
Miiiiaf =^+^=
GIAW 14: ParticipantParticipant - GIAW 11
Is it possible to use this ingame at the same time as MA's Composite Characters to create a character like in MMO's (WoW, MapleStory, FLYFF, ...)???
I'd really love it when people can create their own character out of some hairstyles, eyes, mouths, etc. and play...
« Last Edit: December 09, 2012, 10:20:20 AM by Amycha19 »


As blonde as can be!!!
Doesn't mean I'm the dumb one...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Spoiler for supporting!:


**
Rep:
Level 66
RMRK Junior
@Amycha19
I actually had that idea in mind, I even tried to do the whole thing a while ago, but then I realized my design and layout failed so bad that it became akward :-\ I didn't know whether it'd be worth it either. But it would be kinda cool though, cause I don't think there's no such thing in RPG Maker where you can create your own characters, besides from VX Ace. If there's anybody who'd like to share me a picture, a design or just some nice ideas of how it could look and/or be structured, I would greatly appreciate and hopefully get a start working on the project :)

****
Rep:
Level 57
Miiiiaf =^+^=
GIAW 14: ParticipantParticipant - GIAW 11
I just did this in less than 5 minutes, but it should give you structure of how to do it somehow...

Also, here's some explanation.
NAME should be able to work with the standard "name input" from VX.

To make it difficult I'd like to be able to set specified pictures in maps. What do I mean?
I'd like to make a maps being Hair, Eyes, Accs1, Accs2, Clothing, ... and call the items in there M1 (for male 1st of the row), F1, M2, F2, ... For the face picture and make m1, f1, m2, f2, ... for the character items... Though, that's not necessary for the eyes on a character though...


Gender is preset to male, if they change it, it will become a female base (both face and character).
Then as some people think some eyes belong to men more than to women... You should be able to somehow specify what is made for men or made for women... (maps or name of the pictures)
Then I'd like to have Races (others might want skin colour instead or whatever) this just specifies the ears and the skin colour I had in mind, so with me this changes the base again, with others it changes just the colour.
Then there's Eyes and such, which shouldn't be too hard to understand.

On the right side you can see your chosen face so far and the sprite that belongs to that face.


Since I won't be using equipped gear being visible on the character, there won't be anything else than the creation of the character at the beginning of the game in this for me... Or perhaps I could add in a hairdresser somewhere or whatever. Just make sure that every option can be turned off then (or something).
Also, as for images... Why not use the windowskin?

Is this explanation of what I want, enough for you to get a visual image in your head or something?
« Last Edit: December 09, 2012, 01:24:00 PM by Amycha19 »


As blonde as can be!!!
Doesn't mean I'm the dumb one...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Spoiler for supporting!:


**
Rep:
Level 66
RMRK Junior
Alright, I'll see when I have time for this, don't expect anything anytime soon though. I could also add that this will be a hellota-scripting ;P

****
Rep:
Level 57
Miiiiaf =^+^=
GIAW 14: ParticipantParticipant - GIAW 11
Alright, I'll see when I have time for this, don't expect anything anytime soon though. I could also add that this will be a hellota-scripting ;P
I know I know but it'll be worth it!! Also, take your time. For now I've just been making the game with a standard RTP character. I'm also going to add this, not to the demo, but in the final release. So, take your time :D


As blonde as can be!!!
Doesn't mean I'm the dumb one...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Spoiler for supporting!:


**
Rep: +0/-0Level 55
RMRK Junior
I'd like to use this in a commercial game I'm working on. Anything needed beyond credit?

****
Rep:
Level 57
Miiiiaf =^+^=
GIAW 14: ParticipantParticipant - GIAW 11
I'd like to use this in a commercial game I'm working on. Anything needed beyond credit?
You'd probably have to give him a free copy as well...


As blonde as can be!!!
Doesn't mean I'm the dumb one...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Spoiler for supporting!:


*
Rep:
Level 82
Because the script creator hasn't specified any of his own terms, any scripts hosted on RMRK.net adopt the following terms of use: http://rmrk.net/index.php/topic,45482.0.html

These terms explicitly state that you must seek direct permission from the original creator before you may use it in a commercial project.

Now, this particular user hasn't been on this forum since mid-December so I am unsure if you will get a response in a reasonable time. I would still send them a private message, however, as you do need their permission before you can use it in your commercial project. Whilst most scripters are happy to receive a personal free copy of the game, some may request royalties or have other requirements for use (such as advertising for example).

Without explicit permission you run the risk of breaching copyright laws and such, so it is imperative you do so.
(Why do I always feel like it's the end of the world and I'm the last man standing?)

**
Rep: +0/-0Level 55
RMRK Junior
You'll be credited and get a copy of the game (if it's successfully funded.)