Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Zangetsu

1
After a long time, I'm back to request help again :D I've gotten better at RPG Maker XP, but apparently not enough, because I am have some trouble. I have provided a script below, and now the problem!

What happens when I try to use this, is that when I open the game, for one second the window hovers over the final option (end game), and then it switches to the Option 1, which is new game. I do not use text in the windows, I have put the text into my title image I wonder if this is what causes the problem, but am not sure. At first, I thought it's okay, but as I keep playtesting it's very annoying. I would like to fix the script to make the problem go away.

This is the title screen:



And, because text is already on screen, there is no need for putting text in the actual command as script. If that makes sense?

So this is the script below as I have put it into the editor. Instructions are to paste above main. (It's the exactly same as the original, except I removed "New game" and other text commands in quote from "TEXTO_NEW_GAME" and the other commands for when you first open the title screen):

# Titlescreen Horizontal
# by lasso
#www.mundorpgmaker.com
module Config
#Configure o texto que aparece no lugar de New Game:
TEXTO_NEW_GAME = ""
#Configure o texto que aparece no lugar de Continue:
TEXTO_CONTINUE = ""
#Configure o texto que aparece no lugar de Shutdown:
TEXTO_SHUTDOWN = ""
end
class Window_Command < Window_Selectable
attr_accessor:column_max
end
class Scene_Title
def main
if $BTEST
battle_test
return
end
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
$game_system = Game_System.new
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
s1 = ""
s2 = ""
s3 = ""
@command_window = Window_Command.new(576, [s1, s2, s3])
@command_window.column_max = 3
@command_window.opacity = 0
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
@command_window.contents.draw_text(0, 2, 190, 32, Config::TEXTO_NEW_GAME)
@command_window.contents.draw_text(191, 2, 190, 32, Config::TEXTO_CONTINUE)
@command_window.contents.draw_text(383, 2, 190, 32, Config::TEXTO_SHUTDOWN)
@continue_enabled = false
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end
if @continue_enabled
@command_window.index = 1
else
@command_window.disable_item(1)
end
$game_system.bgm_play($data_system.title_bgm)
Audio.me_stop
Audio.bgs_stop
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@sprite.bitmap.dispose
@sprite.dispose
end
end
2
Script Requests / [RMXP] Editing On-Map Menu
February 13, 2016, 12:58:34 am
So, I'm using the On-Map Menu by Bigace360. I edited it a little to allow the menu to only open when there's a switch on and when a certain key is pressed. Also, the menu opens only when there are common events attached to items. To allow it to open with "O", I used Glitchfinder's Key Module.

This has worked well, and the menu can open anytime even when I have text appearing on the screen. I love this, and I want to keep it this way. However, the common event that I have attached is supposed to show a picture that the player can press "X" to exit from. But when I open the common event, the on-map menu closes, and the text continues running on screen. This is a problem.

What I would like to do is revise the script to have the menu remain open WHILE the common event runs. Then, you can press "X" to stop exit the picture and then return to the menu. The menu will not close until the common event is run, when "X" is pressed. The main objective is to allow the player to view the picture without the menu closing and without the text continuing.

That's what I'd like, if anyone can help me or direct me to how to create it (I only have a little bit of experience in JavaScript, not much), I'd be glad!

Thanks!

The script is below:

#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# ■ On-Map Item Menu [RMXP]                                       
# ■ Author: Bigace360   
# ■ Version: 1.0
# ■ Date: Jan. 17, 2013
# ■ Blog: http://bigaceworld.wordpress.com/
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#                               VERSION HISTORY                                #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# 01.17.2013 (v1.00) - Started and Finished Script
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#                                INTRODUCTION                                  #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# This script allows the player to access the on-map item menu by pressing the
# [Shift] button on the keyboard. The items that show up on the on-map item menu
# are only items that will begin common events.
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#                                  SECTIONS                                    #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#  ■ Game_Objects
# ** Warrior_Engine Module
# ** Game_Party
#
#  ■ Windows
# ** Window_Map_Item
#
#  ■ Scenes
# ** Scene_Map
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
# Credits/Thanks:
#   - Bigace360, for the script.
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#                     Script Conflicts and Compatability                       #
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# Compatibility
#   Requires the script 'Warrior Engine - XP Core Engine' v1.15 or higher
#
# ● Alias methods
#   class Scene_Map
#     def update
#
# ● Overwrite methods
#   class Scene_Map
#     def main
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
#===============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death,
# and/or halitosis so edit at your own risk.
#===============================================================================
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Warrior Engine (Setting module for the Warrior Engine)
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module Warrior_Engine
#=============================================================================
# ▼ Warning DO NOT TOUCH THIS MODULE, altering this will ruin any chances of
#   any script that requires this engine to run.
#
# For Configurations go to Module Core below this one.
#=============================================================================
module MESSAGE
#--------------------------------------------------------------------------
# * required
#   This method checks for the existance of the basic module and other
#   WARRIOR scripts required for this script to work, don't edit this
#--------------------------------------------------------------------------
def self.required(name, req, version, type = nil)
if !$ace_script[:ace_warrior_module]
msg = "The script '%s' requires the script\n"
msg += "'Warrior_Engine' v%s or higher above it to work properly\n"
msg += "Go to http://bigaceworld.wordpress.com/ to download this script."
print(sprintf(msg, self.script_name(name), version))
exit
else
self.required_script(name, req, version, type)
end
end
#--------------------------------------------------------------------------
# * script_name
#   Get the script name base on the imported value, don't edit this
#--------------------------------------------------------------------------
def self.script_name(name, ext = "WE")
name = name.to_s.gsub("_", " ").upcase.split
name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
name.join(" ")
end
end
end

$ace_script ||= {}
$ace_script[:on_map_item_menu] = 1.0
Warrior_Engine::MESSAGE.required(:on_map_item_menu, :ace_warrior_module, 1.15, :above)

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Game_Party
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Game_Party
def items
result = []
@items.keys.sort.each {|i| result << $data_items[i] if @items[i] > 0}
@weapons.keys.sort.each {|i| result << $data_weapons[i] if @weapons[i] > 0}
@armors.keys.sort.each {|i| result << $data_armors[i] if @armors[i] > 0}
return result
end
  def consume_item(item)
    lose_item(item.id, 1) if item.is_a?(RPG::Item) && item.consumable
  end
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Window_Map_Item
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Window_Map_Item < Window_Selectable
def initialize
super(180, 0, 300, 128)
@column_max = 1
select(0)
refresh
hide
deactivate
end
def line_height;       return 32;  end
def translucent_alpha; return 160; end
def standard_padding;  return 16;  end
def fitting_height(line_number)
(line_number * line_height) + (standard_padding * 2)
end
def visible_line_number
return [[128, @item_max].min, 2].max
end
def item; return @data[index]; end
def include?(item)
    return false if item.nil?
    return false unless item.is_a?(RPG::Item)
    return false if item.common_event_id == 0
    return true
end
def enable?(item); return $game_party.item_can_use?(item); end
def refresh
self.contents.dispose unless self.contents.nil?
self.contents = nil unless self.contents.nil?
    select(0) unless @starting
    @starting = true
@data = []
    make_item_list
@item_max = @data.size
    select([[self.index, @item_max-1].min, 0].max)
    self.height = fitting_height(visible_line_number)
    self.y = 300 - self.height
    self.z = 1000
self.contents = Bitmap.new(width - 32, row_max * 32) if @item_max > 0
@item_max.times {|i| draw_item(i)} if @item_max > 0
end
  def make_item_list
    $game_party.items.each {|item| next unless include?(item); @data << item}
  end
def draw_item(index)
rect = item_rect(index)
contents.clear_rect(rect)
item = @data[index]
return if item.nil?
    case item
    when RPG::Item   then number = $game_party.item_number(item.id)
    when RPG::Weapon then number = $game_party.weapon_number(item.id)
    when RPG::Armor  then number = $game_party.armor_number(item.id)
    end
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enable?(item.id))
draw_text(rect, sprintf(':%2d', number), 2)
end
def update_help; @help_window.set_text(item.nil? ? '' : item.description); end
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Scene_Map
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Scene_Map
def main
@spriteset = Spriteset_Map.new
@message_window = Window_Message.new
create_map_item_window
Graphics.transition
loop {Graphics.update; Input.update; update; break if $scene != self}
Graphics.freeze
terminate_map_item_window
@spriteset.dispose
@message_window.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
end
def create_map_item_window
@on_map_help_window = Window_Help.new
@on_map_item_window = Window_Map_Item.new
@on_map_item_window.help_window = @on_map_help_window
@on_map_help_window.hide
end
def terminate_map_item_window
return if @on_map_item_window.nil?
@on_map_item_window.dispose
@on_map_item_window = nil
@on_map_help_window.dispose
@on_map_help_window = nil
end
alias update_on_map_item_menu update unless $@
def update
update_on_map_item_menu
if !$game_system.map_interpreter.running?
map_item_window if Keys.trigger?(0x4F)
end
end
def map_item_window
    $game_switches[24] = true
disabled = true
$game_party.items.each do |item|
next unless item.is_a?(RPG::Item)
next unless item.common_event_id >= 0
disabled = false
break
end
return if disabled
$game_system.se_play($data_system.decision_se)
@on_map_item_window.refresh
@on_map_item_window.show.activate
@on_map_help_window.show
loop do
update_basic
@on_map_help_window.update
@on_map_item_window.update
if Keys.press?(0x50) or Keys.press?(0x0D)
$game_system.se_play($data_system.decision_se)
item = @on_map_item_window.item
        $game_switches[24] = true
$game_temp.common_event_id = item.common_event_id
$game_party.consume_item(item)
break
elsif Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
        $game_switches[24] = false
break
end
end
@on_map_item_window.hide.deactivate
@on_map_help_window.hide
    $game_switches[24] = false
loop do
break if @on_map_item_window.hide.deactivate
update_basic
@on_map_help_window.update
@on_map_item_window.update
end
end
def update_basic
Graphics.update
Input.update   
$game_map.update           
@spriteset.update             
end
end
3
I was worried since it looks like I'm posting way too much... I hope this was enough to make a new topic, and I'm sorry for not being active on the forums! I feel like I should help more, since everyone helps me so much. I'll be sure to do that soon.

So I was looking at my UMS and I added an SE to accompany the text. However, there's SE for every character and it's very annoying. I'd prefer it every three or so characters, and so this feature would be perfect:

#==============================================================================
# Text Sound Effect (version 2)
# NEW FEATURE: Switch to turn off sound effect
#------------------------------------------------------------------------------
# by Zerbu
#==============================================================================
module Text_Sound_Effect
  #--------------------------------------------------------------------------
  # Options
  #--------------------------------------------------------------------------
  # The sound effect to play
  MESSAGE_SOUND = RPG::SE.new("Knock", 70, 80)

  # The number of characters to display before each time the sound plays
  # The default is 3, it's recommended you keep it as this unless you
  # know what you're doing
  MESSAGE_SOUND_FRAMES = 3

  # Switch to disable sound effect
  # If you need to turn off the sound effect for any part of the game,
  # turn this switch on
  # Set to nil to disable this feature
  MESSAGE_SOUND_DISABLE = nil
 
end

class Window_Message < Window_Base
  include Text_Sound_Effect
  #--------------------------------------------------------------------------
  # alias method: process_characer
  #--------------------------------------------------------------------------
  alias textsound_process_character_normal process_character
  def process_character(c, text, pos)
    if !MESSAGE_SOUND_DISABLE or !$game_switches[MESSAGE_SOUND_DISABLE]
      #---
      if !defined?(@sound_frames)
        @sound_frames = 0
      end
      #---
      if @sound_frames == 0
        MESSAGE_SOUND.play
      end
      #---
      @sound_frames+=1
      #---
      if @sound_frames == MESSAGE_SOUND_FRAMES
        @sound_frames = 0
      end
      #---
    end
    textsound_process_character_normal(c, text, pos)
  end
  #---
end


If someone could create it to be based off the UMS script, which helps to show one character at a time in message boxes, I'd be grateful!

Again, I'll come around the forums more and look to contribute other than asking for help all the time. I apologise!

~Zangetsu
4
Wow, thank you for the information, everyone! KK20 especially since you've given me a lot of new information that I didn't understand before about RPG Maker XP. Truth be told I never knew that it could only write the text all at once, since from the get-go I've used Ccoa's UMS.

And now, thanks to Zexion, I only just realised UMS also has animated faces... I had to adjust the script a bit so that I could position it how I want, but now it's perfect for my needs. Thank you to everyone who helped!   :)
5
Hello! It's been a long time  :haha: Sorry that I posted in this forum a lot, it seems all the posts below are mine lately...

I'd like a script to be converted, however I don't RMXP code or RMVX Ace code... this is a bust system by modern algebra, here's the full link to their post: http://rmrk.net/index.php/topic,48031.0.html

I would like to be able to use this in the RMXP system. However, I need the proper code.  :wacko: I can't handle code, my brain just shuts down lol.

Here, the full code:

#==============================================================================
#    ATS: Face Options
#    Version: 1.0.3
#    Author: modern algebra (rmrk.net)
#    Date: 20 July 2013
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#   
#    This script allows you to control the face settings of a message. Not only
#   can you now give faces a talking animation and a blinking animation, but
#   this also lets you use bigger facesets, to set the faceset based on actor
#   ID or party ID, to encapsulate faces in their own windows, to set its
#   position, to fade it in or scroll it in, and much more. For a complete list
#   of features, be sure to read the Instructions starting at line 30 as well
#   as the Editable Region starting at line 176.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  ATS Series:
#
#    This script is part of the Advanced Text System series of scripts. These
#   scripts are based off the Advanced Text System for RMVX, but since RMVX Ace
#   has a much more sensibly designed message system, it is no longer necessary
#   that it be one large script. For that reason, and responding to feedback on
#   the ATS, I have split the ATS into multiple different scripts so that you
#   only need to pick up the components for the features that you want. It is
#   therefore easier to customize and configure.
#
#    To find more scripts in the ATS Series, please visit:
#      http://rmrk.net/index.php/topic,44525.0.html
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#   
#    Paste this script into its own slot in the Script Editor, above Main but
#   below Materials.
#
#    ~Animated Faces~
#
#    For talking animations, you need to do two things. Firstly, the
#   :animate_faces setting must be set to true. Secondly, the name of the
#   faceset must include the following code:
#
#        %[n]
#
#   where n is the number of poses in the animation. Ex: a faceset named
#   "Actor1%[4]" would have 4 poses. Starting from the selected index, the
#   face would show the first pose, then the second, then the third, then the
#   fourth, and then back to the first to repeat. You set the speed at which it
#   animates by changing the :chars_per_face setting.
#
#    To set a blinking animation, it does not matter whether :animate_faces is
#   true, and you do not need to use special filenames. Rather, you simply need
#   to identify a blink face. This can be done in two ways. First, you can do
#   it in a script call before the message. The important settings are
#   :blink_face_name and :blink_face_index. Where filenames can be long, it is
#   best to set it to a local variable first, like so:
#
#        n = "Actor1"
#        ats_next(:blink_face_name, n)
#        ats_next(:blink_face_index, 5)
#
#   Naturally, "Actor1" is the name of the faceset which houses the blinking
#   pose, and the index is 5 (so second row, second column). If the blinking
#   pose is located within the same faceset as the normal pose, then you only
#   need to set the :blink_face_index.
#
#    The second way to do it is with the following message code, included at
#   the very start of the message:
#
#      \fb{"Actor1", 5}
#
#   Again, change "Actor1" to whatever name you want the face to be, and 5 to
#   whatever index. Similarly, you can exclude the filename if it is the same
#   as the regular pose.
#
#    You can change the rate at which the face blinks by changing the
#   :frames_between_blinks and :frames_to_blink message settings. Read about
#   them at lines 185-189.
#
#    Finally, blinking also works with a talking animation, so if you are using
#   a talking animation it is a good idea to have a full set of blinking poses
#   as well. However, if you have only one, be sure that it is not in a faceset
#   identified as a talking animation (i.e. one with a %[n] code).
#
#
#    ~Large Faces~
#
#    For large faces, you can of course make a set of 8. However, if you want
#   to save each file separately, you can just make the very first character of
#   the filename a $. In other words, an image saved as "Actor3-3" would be a
#   regular faceset of 8 poses, while an image saved as "$Actor3-3" would be
#   an image holding only a single large face. If a file has both $ and %[n]
#   in its name, then it will treat it as a faceset with n poses, all aligned
#   horizontally. In other words, "$Actor3-3%[2]" would be a set with two
#   faces in, the first half of the image with one pose and the second with the
#   second pose. Naturally, it will animate if used in a message, so this
#   should only be done for large face talking animations.
#
#    You set large faces just as you would a normal face. If you want the whole
#   thing to be shown, you should make sure that the :face_width and
#   :face_height settings are both set to -1. If, on the other hand, you want
#   only to cut out the centre of the large face, you can change those values
#   to whatever proportions you want. So, for instance, setting :face_width to
#   128 and face_height to 160 would cut out a 128x160 section of the face and
#   show that.
#
#
#    ~All Other Face Settings~
#
#    There are a lot of configuration options in this script, and I direct you
#   to the Editable Region at line 176 for detailed comments on what each does
#   Here, I will just list them:
#
#          :animate_faces                     :face_scroll_x
#          :chars_per_face                    :face_scroll_y
#          :frames_between_blinks             :face_scroll_speed
#          :frames_to_blink                   :face_fadein
#          :blink_face_name                   :face_fade_speed
#          :blink_face_index                  :face_opacity
#          :face_x                            :face_blend_type
#          :face_x_offset                     :face_match_screen_tone
#          :face_y                            :face_tone
#          :face_y_offset                     :face_window
#          :face_width                        :face_padding
#          :face_height                       :face_win_opacity
#          :face_mirror                       :face_win_back_opacity
#          :face_overlap_allowed
#
#    As with other ATS scripts, you can change the value of these options in
#   game with the following codes in a script call:
#
#      ats_next(:message_option, x)
#      ats_all(:message_option, x)
#
#   Where :message_option is the symbol you want and x is the value you want
#   to change it to. ats_next will only change it for the very next message,
#   while ats_all will change it for every message to follow.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  List of Special Message Codes:
#
#    The following is a complete list of the message codes at your disposal.
#   Simply insert them into a Display Message command.
#
# \f{"filename":n} - set face to the one in "filename" at index n.
# \f{n}  - set face to the pose at index n within the current faceset.
# \fb{"filename":n} - set blink face to the one in "filename" at index n.
# \fb{n} - set blink face to the pose at index in within the current faceset.
# \af[n] - set face to the face of the actor with ID n in the database.
# \mf[n] - set face to the face of party member in index n. 1 is the leader.
# \fa[n] - plays animation with ID n on the face.
# \fam[n] - plays a mirror of animation with ID n on the face.
# \fx[n] - sets :face_x to n, where n is: L, C, R, or an integer. See line 198.
# \fy[n] - sets :face_y to n, where n is: A, U, T, C, B, D, or an integer. See
#         line 207.
# \fw    - turns :face_window to true for this message. See line 273.
# \fm    - turns :face_mirror to true for this message. See line 255.
# \ff    - turns :face_fadein to true for this message. See line 251.
# \fsx   - turns :face_scroll_x to true for this message. See line 242.
# \fsy   - turns :face_scroll_y to true for this message. See line 245.
#==============================================================================

$imported = {} unless $imported
$imported[:MA_ATS_FaceOptions] = true

#==============================================================================
# ** Game_ATS
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new public instance variables - animate_faces; chars_per_face;
#      frames_between_blinks; frames_to_blink; face_x; face_y; face_x_offset;
#      face_y_offset; face_width; face_height; face_scroll_x; face_scroll_y;
#      face_scroll_speed; face_fadein; face_fade_speed; face_mirror;
#      face_opacity; face_blend_type; face_tone; face_window; face_padding;
#      face_win_opacity; face_win_back_opacity; face_overlap_allowed;
#      blink_face_name; blink_face_index
#==============================================================================

class Game_ATS
  CONFIG ||= {}
  CONFIG[:ats_face_options] = {
  ats_face_options: true,
    #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    #  EDITABLE REGION
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
    #    ~Face Animation Settings~
    #
    #  :animate_faces - true or false. Set this to true if you want faces to
    # animate. Set it to false if you don't, but that should be rare since only
    # faces with a %[n] code will animate, where n is the number of frames in
    # the animation. No other faceset will animate. As such, this option should
    # only ever be set to false if you only want a single pose from a faceset
    # which with a %[n] code.
    animate_faces:         true,
    #  :chars_per_face - integer. When animating a face, this sets how many
    # letters should be drawn before switching to the next frame.
    chars_per_face:        8,
    #  :frames_between_blinks - x...y; x & y both integers. If using a blink
    # face, the time between blinks in frames. There are 60 frames in 1 second.
    frames_between_blinks: 180..300,
    #  :frames_to_blink - integer. Number of frames to show the blinking face.
    frames_to_blink:       12,
    #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
    #    ~Face Position and Size~
    #
    #  :face_x - integer, :L, :C, or :R. The X coordinate of the face. If an
    # integer, the face's x-coordinate is set directly to that position. You
    # can also set it so that it is automatically positioned according to the
    # position of the message window. If you set it to :L, it will be at the
    # left end of the message window, and if you set it to :R it will be at the
    # right end of the message window. If you set it to :C, it will be centred,
    # but naturally that setting should only ever be used if the Y position of
    # the face does not overlap with the message window.
    face_x:                :L,
    #  :face_y - integer, :A, :U, :T, :C, :B, or :D. The Y coordinate of the
    # face. If an integer, the face's y-coordinate is set directly to that
    # position. You can also set it so that it is automatically positioned
    # according to the position of the message window. If you set it to :U (Up),
    # the bottom of the face will be flush with the top border of the message
    # window. If you set it to :T (Top), then the top of the face will be flush
    # with the top border of the message window. If you set it to :C (Centre),
    # then the centre of the face will match the centre of the message window.
    # If you set it to :B (Bottom), then the bottom border of the face will be
    # flush with the bottom border of the message window. If you set it to
    # :D (Down), then the top of the face will be flush with the bottom border
    # of the message window. Finally, if you set it to :A (Automatic), then it
    # will be :C if the face is smaller than the message window, and otherwise
    # it will be :T if the message window is in the upper portion of the screen
    # or :B if the message window is in the lower portion of the screen. The
    # recommended value is :C if you are using regular facesets or :A if you
    # are using large facesets.
    face_y:                :A,
    #  :face_x_offset - integer. If using an automatic setting for :face_x,
    # this is added or subtracted from the x placement, as appropriate.
    face_x_offset:         0,
    #  :face_y_offset - integer. If using an automatic setting for :face_y,
    # this is added or subtracted from the y placement, as appropriate.
    face_y_offset:         0,
    #  :face_width - integer. The horizontal size of the face. If -1, it will
    # be set to the width of the face used. If less than the width of the face
    # used, it will take as much of the centre of the face as possible
    face_width:            -1,
    #  :face_height - integer. The vertical size of the face. If -1, it will be
    # set to the height of the face used. If less than the height of the face
    # used, it will take as much of the centre of the face as possible
    face_height:           -1,
    #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
    #    ~Face Settings~
    #
    #  :face_scroll_x - true or false. Whether the face should scroll in to
    # place horizontally
    face_scroll_x:         false,
    #  :face_scroll_y - true or false. Whether the face should scroll in to
    # place vertically
    face_scroll_y:         false,
    #  :face_scroll_speed - integer. The number of frames it takes to scroll
    # into position.
    face_scroll_speed:     15,
    #  :face_fadein - true or false. Whether face should fade in gradually.
    face_fadein:           false,
    #  :face_fade_speed - integer. The number of frames it takes to fade in.
    face_fade_speed:       15,
    #  :face_mirror - true or false. Whether the face should be flipped to face
    # the opposite direction.
    face_mirror:           false,
    #  :face_opacity - 0-255. The degree of transparancy of the face.
    face_opacity:          255,
    #  :face_blend_type - 0-2. 0 => Normal; 1 => Add; 2 => Subtract. This
    # should almost always be set to 0 as either other option changes the face
    # dramatically. However, it can be used for a ghost or darkness effect.
    face_blend_type:       0,
    #  :face_match_screen_tone - true or false. If true, the tone of the face
    # will be the same as that of the screen unless you set :face_tone to
    # something other than nil. Otherwise there will be no automatic setting.
    face_match_screen_tone: false,
    #  :face_tone - Tone.new(-255 - 255, -225 - 255, -255 - 255, -255 - 255) -
    # This allows you to blend a tone with the face. The values are
    # (red, green, blue, gray). It should usually be set to nil, but might be
    # useful for flashbacks or lighting effects, etc...
    face_tone:             nil,
    #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
    #    ~Face Window Settings~
    #
    #  :face_window - true or false. If true, face shown in its own window
    face_window:           false,
    #  :face_padding - integer. If using window, the size of the border.
    face_padding:          6,
    #  :face_win_opacity - 0-255. The total opacity of the face window
    face_win_opacity:      255,
    #  :face_win_back_opacity - 0-255. The back opacity of the face window
    face_win_back_opacity: 192,
    #  :face_overlap_allowed - true or false. If false, this will not permit
    # any overlap between the face's window and the regular window, and it
    # will resize the message window to avoid it. It should not be used unless
    # you are using either a flush left or flush right placement for the face
    # window. Recommended value is true.
    face_overlap_allowed:  true,
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
    #  END EDITABLE REGION
    #////////////////////////////////////////////////////////////////////////
    blink_face_name:       "",
    blink_face_index:      -1,
  }
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CONFIG[:ats_face_options].keys.each { |key| attr_accessor key }
end

#==============================================================================
#  Initialize Common ATS Data if no other ATS script interpreted first
#==============================================================================

if !$imported[:AdvancedTextSystem]
  #============================================================================
  # *** DataManager
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  Summary of Changes:
  #    aliased method - create_game_objects; make_save_contents;
  #      extract_save_contents
  #============================================================================
  module DataManager
    class << self
      alias modb_ats_crtgmobj_6yh7 create_game_objects
      alias mlba_ats_mksave_5tg9 make_save_contents
      alias ma_ats_extrcsvcon_8uj2 extract_save_contents
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Create Game Objects
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def self.create_game_objects(*args, &block)
      modb_ats_crtgmobj_6yh7(*args, &block)
      $game_ats = Game_ATS.new
      $game_ats.init_new_installs
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Make Save Contents
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def self.make_save_contents(*args, &block)
      contents = mlba_ats_mksave_5tg9(*args, &block)
      contents[:ats] = $game_ats
      contents
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Extract Save Contents
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def self.extract_save_contents(contents, *args, &block)
      ma_ats_extrcsvcon_8uj2(contents, *args, &block)
      $game_ats = contents[:ats] ? contents[:ats] : Game_ATS.new
      $game_ats.init_new_installs
    end
  end
 
  #============================================================================
  # ** Game_ATS
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  This class holds the default data for all scripts in the ATS series
  #============================================================================
 
  class Game_ATS
    def initialize; reset; end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Reset any or all installed ATS scripts
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def reset(script_name = nil)
      if script_name.is_a? (Symbol) # If script to reset specified
        CONFIG[script_name].each_pair { |key, value|
          self.send("#{key}=".to_sym, value)
          $game_message.send("#{key}=".to_sym, value)
        }
      else                          # Reset all ATS scripts
        CONFIG.keys.each { |script| reset(script) }
      end
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Initialize any newly installed ATS scripts
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def init_new_installs
      CONFIG.keys.each { |script| reset(script) unless self.send(script) }
    end
  end
 
  #============================================================================
  # ** Game_Message
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  Summary of Changes:
  #    aliased method - clear
  #============================================================================
 
  class Game_Message
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Clear
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    alias mlb_ats_clrats_5tv1 clear
    def clear(*args, &block)
      mlb_ats_clrats_5tv1(*args, &block) # Run Original Method
      return if !$game_ats
      Game_ATS::CONFIG.values.each { |installed|
        installed.keys.each { |key| self.send("#{key}=".to_sym, $game_ats.send(key)) }
      }
    end
  end
 
  #============================================================================
  # ** Game_Interpreter
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  Summary of Changes:
  #    new methods - ats_all; ats_next
  #============================================================================
 
  class Game_Interpreter
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * ATS All
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def ats_all(sym, *args, &block)
      $game_ats.send("#{sym}=".to_sym, *args, &block)
      ats_next(sym, *args, &block)
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * ATS Next
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def ats_next(sym, *args, &block)
      $game_message.send("#{sym}=".to_sym, *args, &block)
    end
  end

  $imported[:AdvancedTextSystem] = true
end

#==============================================================================
# ** Game_Message
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new public instance variables - animate_faces; chars_per_face;
#      frames_between_blinks; frames_to_blink; face_x; face_y; face_x_offset;
#      face_y_offset; face_width; face_height; face_scroll_x; face_scroll_y;
#      face_scroll_speed; face_fadein; face_fade_speed; face_mirror;
#      face_opacity; face_blend_type; face_tone; face_window; face_padding;
#      face_win_opacity; face_win_back_opacity; face_overlap_allowed;
#      blink_face_name; blink_face_index
#==============================================================================

class Game_Message
  Game_ATS::CONFIG[:ats_face_options].keys.each { |key| attr_accessor key }
end

#==============================================================================
# ** Sprite_ATS_Face
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This sprite shows a face graphic for messages.
#==============================================================================

class Sprite_ATS_Face < Sprite_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_reader :num_frames
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize(viewport = nil)
    super(viewport)
    self.bitmap = Bitmap.new(96, 96)
    @num_frames = 1
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Free
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def dispose(*args)
    bitmap.dispose if bitmap && !bitmap.disposed?
    super(*args)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Setup
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def setup(faces, blink_faces = [])
    if faces.empty? # No Face
      bitmap.clear   
      @num_frames = 1                                        # Clear Bitmap
    else
      bitmap.dispose if bitmap && !bitmap.disposed?          # Dispose old bitmap
      rect = Rect.new(0, 0, faces[0].width, faces[0].height) # Set Rect
      # Create Bitmap
      h = blink_faces.empty? ? rect.height : rect.height*2
      self.bitmap = Bitmap.new(rect.width*faces.size, h)
      @num_frames = faces.size
      # Draw all faces onto the bitmap
      for i in 0...@num_frames
        x = i*rect.width
        bitmap.blt(x, 0, faces[i], rect)
        bitmap.blt(x, rect.height, blink_faces[i % blink_faces.size], rect) if !blink_faces.empty?
      end
      src_rect.set(rect) # Set Source Rect
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Face Frame
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def set_column(index = 0)
    src_rect.x = index*src_rect.width
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Face Frame
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def set_row(index = 0)
    src_rect.y = index*src_rect.height
  end
end

#==============================================================================
# ** Window_ATS_Face
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This window displays a face graphic for messages.
#==============================================================================

class Window_ATS_Face < Window_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create Face
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def create_face(face_name, face_index)
    contents.clear
    draw_face(face_name, face_index, 0, 0)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Face Graphic
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_face(face_name, face_index, x, y, enabled = true, *args)
    bmp = Cache.face(face_name)
    fw, fh = bmp.width, bmp.height
    if face_name[/\A\$/] != nil # SINGLE
      if face_name[/\%\[\s*(\d+)\s*\]/] != nil
        fw /= $1.to_i
      else
        face_index = 0
      end
      cw, ch = contents.width - x, contents.height - y
      rect = Rect.new((face_index*fw) + ((fw - cw) / 2), (fh - ch) / 2, cw, ch)
      contents.blt(x, y, bmp, rect, enabled ? 255 : translucent_alpha)
    else
      fw /= 4
      fh /= 2
      rect = Rect.new(face_index % 4 * fw, face_index / 4 * fh, fw, fh)
      contents.blt(x, y, bmp, rect, enabled ? 255 : translucent_alpha)
    end
    bmp.dispose
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Resize Window
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def resize(w, h)
    self.width = w + (standard_padding*2)
    self.height = h + (standard_padding*2)
    create_contents
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Standard Padding
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def standard_padding
    $game_message.face_padding
  end
end

#==============================================================================
# ** Spriteset_ATS_Face
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This class creates and control the window and sprite for showing faces
#==============================================================================

class Spriteset_ATS_Face
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_reader   :face_window
  attr_reader   :face_sprite
  attr_reader   :x
  attr_reader   :y
  attr_reader   :z
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize(message_window, viewport = nil)
    @message_window = message_window
    @face_window = Window_ATS_Face.new(0, 0, 120, 120)
    @face_sprite = Sprite_ATS_Face.new(viewport)
    self.x, self.y, @dest_x, @dest_y = 0, 0, 0, 0
    @dest_scroll_x_speed, @dest_scroll_y_speed = 0, 0
    @dest_sprite_opacity, @dest_window_opacity = 255, 255
    @dest_s_fade_speed, @dest_w_fade_speed = 0, 0
    self.z = message_window.z + 1
    clear
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Free
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def dispose
    @face_window.dispose
    @face_sprite.dispose
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update
    @face_sprite.update
    @face_window.update
    @face_window.visible = !empty? && $game_message.face_window
    @face_sprite.visible = @face_window.open? if @face_window.visible
    update_scroll
    update_fade
    update_blink
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Scroll
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_scroll
    # Scroll X
    if @dest_x > self.x
      self.x = [self.x + @dest_scroll_x_speed, @dest_x].min
    elsif @dest_x < self.x
      self.x = [self.x + @dest_scroll_x_speed, @dest_x].max
    end
    # Scroll Y
    if @dest_y > self.y
      self.y = [self.y + @dest_scroll_y_speed, @dest_y].min
    elsif @dest_y < self.y
      self.y = [self.y + @dest_scroll_y_speed, @dest_y].max
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update fade
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_fade
    if @dest_sprite_opacity != face_sprite.opacity
      face_sprite.opacity += @dest_s_fade_speed
      face_sprite.opacity = @dest_sprite_opacity if face_sprite.opacity > @dest_sprite_opacity
    end
    if @dest_window_opacity != face_window.opacity
      face_window.opacity += @dest_w_fade_speed
      face_window.opacity = @dest_window_opacity if face_window.opacity > @dest_window_opacity
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Blink
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_blink
    if blinking?
      @blink_timer -= 1
      if @blink_timer <= 0
        @blink_status = (@blink_status + 1) % 2
        @face_sprite.set_row(@blink_status)
        @blink_timer = case @blink_status
        when 0
          fbb = $game_message.frames_between_blinks
          fbb.first + rand(fbb.last - fbb.first)
        when 1 then $game_message.frames_to_blink
        end
      end
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Clear
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def clear
    @face_name, @face_index, @blink_face_name, @blink_face_index = "", 0, "", 0
    @face_width, @face_height = 0, 0
    @active_face = -1
    @blink_status, @blink_timer = 0, 0
    @face_sprite.setup([])
    hide
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Refresh
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def refresh(face_name = @face_name, face_index = @face_index)
    @face_name, @face_index = face_name, face_index
    @blink_face_name, @blink_face_index = $game_message.blink_face_name, $game_message.blink_face_index
    return if empty?
    # If blink face partially set, set the other aspect.
    if $game_message.blink_face_index >= 0 && $game_message.blink_face_name.empty?
      $game_message.blink_face_name = face_name
    elsif !$game_message.blink_face_name.empty? && $game_message.blink_face_index < 0
      $game_message.blink_face_index = 0
    end
    @face_width = $game_message.face_width + $game_message.face_padding
    @face_height = $game_message.face_height + $game_message.face_padding
    resize_face(face_name, face_index)
    @face_sprite.setup(collect_faces, collect_faces($game_message.blink_face_name, $game_message.blink_face_index))
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Setup
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def setup(face_name = $game_message.face_name, face_index = $game_message.face_index)
    need_refresh = (@face_name != face_name || @face_index != face_index ||
      @blink_face_name != $game_message.blink_face_name ||
      @blink_face_index != $game_message.blink_face_index ||
      @face_width != ($game_message.face_width + $game_message.face_padding) ||
      @face_height != ($game_message.face_height + $game_message.face_padding))
    refresh(face_name, face_index) if need_refresh
    unless empty?
      @message_window.restore_overlap_width
      update_placement
      @message_window.adjust_placement_for_face
      @face_sprite.opacity = $game_message.face_opacity
      @face_window.opacity = $game_message.face_win_opacity
      # Only Scroll and Fade if a new face
      if need_refresh
        setup_scroll
        setup_fade
      end
      @face_sprite.mirror = $game_message.face_mirror
      @face_sprite.blend_type = $game_message.face_blend_type
      # Set Tone
      case $game_message.face_tone
      when Tone then @face_sprite.tone.set($game_message.face_tone)
      when Array then @face_sprite.tone.set(*$game_message.face_tone)
      else
        ($game_message.face_match_screen_tone ?
          @face_sprite.tone.set($game_map.screen.tone) :
          @face_sprite.tone.set(0, 0, 0, 0))
      end
      @face_window.back_opacity = $game_message.face_win_back_opacity
      fbb = $game_message.frames_between_blinks
      @blink_status = 0
      @blink_timer = fbb.first + rand(fbb.last - fbb.first) 
      show
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Setup Scroll
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def setup_scroll
    if $game_message.face_scroll_x
      self.x = (self.x + @face_window.width) > (Graphics.width - self.x) ?
        Graphics.width : -@face_window.width
      @dest_scroll_x_speed = (@dest_x - self.x) / $game_message.face_scroll_speed
    end
    if $game_message.face_scroll_y
      self.y = (self.y + @face_window.height) > (Graphics.height - self.y) ?
        Graphics.height : -@face_window.height
      @dest_scroll_y_speed = (@dest_y - self.y) / $game_message.face_scroll_speed
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Setup Fade
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def setup_fade
    if $game_message.face_fadein
      @face_sprite.opacity = 0
      @face_window.opacity = 0
      @dest_sprite_opacity = $game_message.face_opacity
      @dest_window_opacity = $game_message.face_win_opacity
      @dest_s_fade_speed = @dest_sprite_opacity / $game_message.face_fade_speed
      @dest_w_fade_speed = @dest_window_opacity / $game_message.face_fade_speed
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Collect Faces
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def collect_faces(face_name = @face_name, face_index = @face_index)
    return [] if !face_name || face_name.empty?
    faces = []
    # If face_file has animation code, add each frame
    num = $game_message.animate_faces && face_name[/\%\[\s*(\d+)\s*\]/] ? $1.to_i : 1
    for i in face_index...(face_index + num)
      @face_window.create_face(face_name, i)
      faces.push(@face_window.contents.dup)
    end
    @face_window.contents.clear
    return faces.compact
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Resize Face
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def resize_face(face_name, face_index = 0)
    # Get set size
    wdth, hght = $game_message.face_width, $game_message.face_height
    face = Cache.face(face_name)
    fw, fh = face.width, face.height
    face.dispose
    # Adjust face width and height if faceset not single
    if face_name[/\A\$/] == nil
      fw /= 4
      fh /= 2
    else
      fw /= $1.to_i if face_name[/\%\[\s*(\d+)\s*\]/]
    end
    wdth = wdth <= 0 ? fw : [fw, wdth].min
    hght = hght <= 0 ? fh : [fh, hght].min
    @face_window.resize([wdth, $game_message.face_width].max, [hght, $game_message.face_height].max)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Position
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_placement
    set_x_placement
    set_y_placement
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set X Position
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def set_x_placement
    # Update X
    side_offset = $game_message.face_x_offset
    side_offset += (@message_window.padding - $game_message.face_padding)
    @dest_x = case $game_message.face_x
    when Integer then $game_message.face_x - ($game_message.face_window ? 0 : $game_message.face_padding)
    when :l, :L then @message_window.x + side_offset
    when :c, :C then @message_window.x + ((@message_window.width -
      @face_window.width) / 2) + $game_message.face_x_offset
    when :r, :R then @message_window.x + @message_window.width -
      @face_window.width - side_offset
    end
    self.x = @dest_x unless $game_message.face_scroll_x
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Y Position
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def set_y_placement
    # Update Y
    fy = $game_message.face_y
    fy = fy.to_s.upcase.to_sym if fy.is_a?(Symbol)
    # Automatic Set
    if fy == :A
      if @face_window.height <= @message_window.height
        fy = :C # Centre if face smaller than message window
      elsif @message_window.y < (Graphics.height - @message_window.height) / 2
        fy = :T # Align with Top if message window above mid-screen
      else
        fy = :B # Align with Bottom otherwise
      end
    end
    w_pad = ($game_message.face_window ? 0 : $game_message.face_padding)
    @dest_y = case fy
    when Integer then fy - w_pad
    when :U, :AT then @message_window.y - @face_window.height +
      $game_message.face_y_offset + w_pad
    when :T, :BT then @message_window.y + $game_message.face_y_offset - w_pad
    when :C then @message_window.y + ((@message_window.height -
      @face_window.height) / 2) + $game_message.face_y_offset
    when :B, :AB then @message_window.y + @message_window.height -
      @face_window.height - $game_message.face_y_offset + w_pad
    when :D, :BB then @message_window.y + @message_window.height -
      $game_message.face_y_offset - w_pad
    end
    self.y = @dest_y unless $game_message.face_scroll_y
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Empty?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def empty?
    @face_name.empty?
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Animate Face?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def animate_face?
    !empty? && ($game_message.animate_faces && @face_sprite.src_rect.width < @face_sprite.bitmap.width)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Blinking?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def blinking?
    !empty? && ($game_message.blink_face_name && !$game_message.blink_face_name.empty?)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Scrolling?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def scrolling?
    !empty? && ((@dest_x != self.x) || (@dest_y != self.y))
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Fading
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def fading?
    !empty? && ((@dest_sprite_opacity != face_sprite.opacity) || (@dest_window_opacity != face_window.opacity))
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Next Face
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_next_face(direct = nil)
    return if @active_face == direct
    @active_face = direct ? direct : (@active_face + 1) % @face_sprite.num_frames
    @face_sprite.set_column(@active_face)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Screen Ranges
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def screen_ranges
    fx, fw = @dest_x, @face_window.width
    fy, fh = @dest_y, @face_window.height
    unless  $game_message.face_window
      fx += @face_window.padding
      fy += @face_window.padding
      fw -= 2*@face_window.padding
      fh -= 2*@face_window.padding
    end
    return (fx...(fx + fw)), (fy...(fy + fh))
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Show / Hide
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def show
    @face_sprite.visible = true
    @face_window.visible = $game_message.face_window
    if !@message_window.open?
      @face_window.openness = 0
      @face_window.open
    end
  end
  def hide
    @face_sprite.visible = false
    @face_window.visible = false
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Check if Visible?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def visible?
    @face_sprite.visible || @face_window.visible
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set X, Y
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  [:x, :y].each { |writer|
    define_method(:"#{writer}=") do |val|
      instance_variable_set(:"@#{writer}", val)
      @face_window.send(:"#{writer}=", val)
      @face_sprite.send(:"#{writer}=", val + $game_message.face_padding)
    end
  }
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Z
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def z=(val)
    @z = val + 1
    @face_window.z = val
    @face_sprite.z = val + 1
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Method Missing
  #    If method missing, call it on either sprite or window
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def method_missing(meth, *args, &block)
    # Face Sprite Check
    if @face_sprite && @face_sprite.respond_to?(meth)
      return @face_sprite.send(meth, *args, &block)
    # Face Window
    elsif @face_window && @face_window.respond_to?(meth)
      return @face_window.send(meth, *args, &block)
    else
      super
    end
  end
end

#==============================================================================
# ** Window_ChoiceList
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - update_placement
#    new method - screen_ranges
#==============================================================================

class Window_ChoiceList
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Placement
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maatsfo_updplacm_6yh2 update_placement
  def update_placement(*args)
    maatsfo_updplacm_6yh2(*args)
    @message_window.adjust_choice_placement_for_face
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Screen Ranges
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  unless method_defined?(:screen_ranges)
    def screen_ranges
      return ((self.x + self.padding)...(self.x + self.width - self.padding)),
        ((self.y + self.padding)...(self.y + self.height - self.padding))
    end
  end
end

#==============================================================================
# ** Window_ATS_Name (compatibility with ATS: Message Options)
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - screen_ranges
#==============================================================================

class Window_ATS_Name < Window_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Screen Ranges
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  unless method_defined?(:screen_ranges)
    def screen_ranges
      return ((self.x + self.padding)...(self.x + self.width - self.padding)),
        ((self.y + self.padding)...(self.y + self.height - self.padding))
    end
  end
end

#==============================================================================
# ** Window_Message
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - create_all_windows; new_page; process_escape_character
#    overwritten method - draw_face
#==============================================================================

class Window_Message
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create All Windows
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maatsfo_creatwins_3hn6 create_all_windows
  def create_all_windows(*args, &block)
    maatsfo_creatwins_3hn6(*args, &block) # Call Original Method
    @atsfo_face = Spriteset_ATS_Face.new(self)
    @atsmo_all_windows.push(@atsfo_face.face_window) if $imported[:ATS_MessageOptions]
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update All Windows
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maatsfo_updatewins_8jv3 update_all_windows
  def update_all_windows(*args, &block)
    maatsfo_updatewins_8jv3(*args, &block)
    @atsfo_face.update
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Dispose All Windows
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maatsfo_disposallwins_6xq1 dispose_all_windows
  def dispose_all_windows(*args, &block)
    maatsfo_disposallwins_6xq1(*args, &block)
    @atsfo_face.dispose
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Placement
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maatsfo_update_placement update_placement
  def update_placement(*args)
    restore_overlap_width
    maatsfo_update_placement(*args) # Call Original Method
    # Remove AF or PF code and process it
    text = $game_message.all_text.dup
    process_face_setting_codes(text)
    while text.slice!(/\A\\([AM]?FB?)(\[\d+\]|{\s*['"]?.*?['"]?[\s,;:]*\d*\s*})/i) != nil
      process_face_code($1, $2)
    end
    @atsfo_face.setup
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Restore Overlap Width
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def restore_overlap_width
    if @overlap_width_adjust
      self.x = @overlap_width_adjust[0]
      resize(@overlap_width_adjust[1], height)
      @overlap_width_adjust = nil
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Process Face Setting Codes
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def process_face_setting_codes(text)
    text.gsub!(/[\\\e]FX\[(\d+|[RLC])\]/i) {
      process_face_setting_code('FX', "[#{$1}]")
      ""
    }
    text.gsub!(/[\\\e]FY\[(\d+|[AUTCBD])\]/i) {
      process_face_setting_code('FY', "[#{$1}]")
      ""
    }
    text.gsub!(/[\\\e](FF|FSX|FSY|FW|FM)/i) {
      process_face_setting_code($1, "")
      ""
    }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Close
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  if instance_methods(false).include?(:close)
    alias maatsfo_close_4hn6 close
    def close(*args)
      @atsfo_face.clear
      maatsfo_close_4hn6(*args) # Call Original Method
    end
  else
    def close(*args)
      @atsfo_face.clear
      super(*args) # Call Original Method
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * New Page
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maatsfo_newpag_7uj2 new_page
  def new_page(text, pos, *args)
    process_face_setting_codes(text)
    while text[/\A\e[AM]?FB?(\[\d+\]|{\s*['"]?.*?['"]?[\s,;:]*\d*\s*})/i] != nil
      text.slice!(/\A\e([AM]?FB?)/i)
      process_face_code($1, text)
    end
    maatsfo_newpag_7uj2(text, pos, *args)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Face (overwritten super method)
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_face(face_name, face_index, *args)
    atsfo_change_face(face_name, face_index)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Change Face
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def atsfo_change_face(face_name, face_index, blink = false)
    return if @atsf_testing
    @atsfo_face_count = 0
    if blink
      $game_message.blink_face_name = face_name
      $game_message.blink_face_index = face_index
      @atsfo_face.refresh($game_message.face_name, $game_message.face_index)
    else
      $game_message.face_name = face_name
      $game_message.face_index = face_index
      @atsfo_face.setup($game_message.face_name, $game_message.face_index)
    end
    @atsfo_face.empty? ? @atsfo_face.hide : @atsfo_face.show
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * New Line X
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maatsfo_nwlinex_4jn6 new_line_x
  def new_line_x(*args)
    if @atsfo_face.visible?
      return 0 if !$game_message.face_overlap_allowed
      rfx, rfy = @atsfo_face.screen_ranges
      rmx, rmy = screen_ranges
      # If face window overlaps left side & overlaps some of the window
      if !(rfy === rmy.first || rmy === rfy.first)
        return 0
      # If more room on the right side of the face than the left
      elsif (rfx.first - rmx.first) < (rmx.last - rfx.last)
        return [rfx.last - rmx.first + 16, 0].max
      else # Left-aligned Text
        return 0
      end
    else
      maatsfo_nwlinex_4jn6(*args)
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Face Animation
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_face_animation
    if @show_fast || @line_show_fast
      @atsfo_face.draw_next_face(0)
    else
      @atsfo_face_count = (@atsfo_face_count + 1) % $game_message.chars_per_face
      @atsfo_face.draw_next_face if @atsfo_face_count == 0
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Process Normal Character
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maatsfo_procsnormchar_8zj6 process_normal_character
  def process_normal_character(*args)
    update_face_animation if @atsfo_face.animate_face?
    maatsfo_procsnormchar_8zj6(*args) # Call original method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Process Escape Character
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maatsfo_procescchar_6ca8 process_escape_character
  def process_escape_character(code, text, *args, &block)
    result = process_face_setting_code(code, text) || process_face_code(code, text)
    if code[/FA(M?)/]
      mirror = !$1.empty?
      anim_id = obtain_escape_param(text)
      @atsfo_face.face_sprite.start_animation($data_animations[anim_id], mirror) unless @atsf_testing
      result = true
    end
    # Call Original Method
    maatsfo_procescchar_6ca8(code, text, *args, &block) unless result
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Process Face Code
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def process_face_code(code, text)
    code.upcase!
    blink = (code.slice!(/B\Z/) != nil)
    if code[/([AM])F/] != nil # AF (Actor Face) or PF (Party Face)
      type = ($1 == 'A')
      param = obtain_escape_param(text)
      actor = type ? $game_actors[param] : $game_party.members[[param - 1, 0].max]
      # Change Face to chosen Actor
      atsfo_change_face(actor.face_name, actor.face_index, blink) if actor
    elsif code == 'F' # F (Face)
      if text.slice!(/^{\s*['"]?(.*?)['"]?[\s,;:]*(\d*)\s*}/)
        atsfo_change_face($1.empty? ? $game_message.face_name : $1, $2.to_i, blink)
      end
    else
      return false
    end
    return true
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Process Face Setting Code
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def process_face_setting_code(code, text)
    return false if code.nil? || code.empty?
    case code.upcase
    when 'FF' then $game_message.face_fadein = true
    when 'FSX' then $game_message.face_scroll_x = true
    when 'FSY' then $game_message.face_scroll_y = true
    when 'FW' then $game_message.face_window = true
    when 'FM' then $game_message.face_mirror = true
    when 'FX'
      $game_message.face_x = text.slice!(/\A\[([LCR])\]/i) != nil ? $1.to_sym :
        obtain_escape_param(text)
    when 'FY'
      $game_message.face_y = text.slice!(/\A\[([AUTCBD])\]/i) != nil ? $1.to_sym :
        obtain_escape_param(text)
    else
      return false
    end
    return true
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Wait / Input Pause / Input Choice / Input Number / Input Item
  #``````````````````````````````````````````````````````````````````````````
  # Change Face to Idle
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  [:wait, :input_pause, :input_choice, :input_number, :input_item].each { |meth|
    alias_method(:"maatsfo_#{meth}_7uj1", meth)
    define_method(meth) do |*args|
      @atsfo_face.draw_next_face(0)
      send(:"maatsfo_#{meth}_7uj1", *args)
    end
  }
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Settings Changed?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maatsfo_setngchn_5ov6 settings_changed?
  def settings_changed?(*args)
    return true if @overlap_width_adjust
    maatsfo_setngchn_5ov6(*args) # Call Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Message Window Position
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def adjust_placement_for_face
    rfx, rfy = @atsfo_face.screen_ranges
    # Unless user allows face overlap with message window
    unless $game_message.face_overlap_allowed
      rmx, rmy = screen_ranges
      # If face window overlaps vertically
      if (rfy === rmy.first || rmy === rfy.first)
        # If more space on right than left
        if (rfx.first - rmx.first) < (rmx.last - rfx.last)
          # Don't resize if it makes message window too small
          if (rmx.last - rfx.last) > padding + 32
            @overlap_width_adjust = [x, width]
            # Resize and move message window to right of face
            w = x + width - rfx.last
            resize(w, height)
            self.x = rfx.last
          end
        else
          # Don't resize if it makes message window too small
          if (rfx.first - rmx.first) > padding + 32
            @overlap_width_adjust = [x, width]
            # Resize so message window all to left of face
            w = rfx.first - x
            resize(w, height)
          end
        end
      end
    end
    # Move Name Window if necessary
    if $imported[:ATS_MessageOptions] && $game_message.message_name
      @atsmo_name_window.z = self.z + 4
      rnx, rny = @atsmo_name_window.screen_ranges
      # If name overlaps with face window
      if (rny === rfy.first || rfy === rny.first) && (rnx === rfx.first ||
        rfx === rnx.first)
        # if message window to left
        if rfx.first - @atsmo_name_window.width > x
          # Move name window to left of face
          @atsmo_name_window.x = rfx.first - @atsmo_name_window.width
        else
          @atsmo_name_window.x = rfx.last
        end
      end
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Adjust Choice Window Placement
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def adjust_choice_placement_for_face
    rcx, rcy = @choice_window.screen_ranges
    rfx, rfy = @atsfo_face.screen_ranges
    # If face window overlaps with choice window
    if (rfy === rcy.first || rcy === rfy.first) && (rfx === rcx.first ||
      rcx === rfx.first)
      # if message window to left
      if rfx.first - @choice_window.width > x
        # Move name window to left of face
        @choice_window.x = rfx.first - @choice_window.width
      else
        @choice_window.x = rfx.last
      end
      # Adjust to make sure not over a name
      if $imported[:ATS_MessageOptions] && $game_message.message_name
        rnx, rny = @atsmo_name_window.screen_ranges
        rcx, rcy = @choice_window.screen_ranges
        # If overlaps name window
        if (rny === rcy.first || rcy === rny.first) && (rnx === rcx.first ||
          rcx === rnx.first)
          # Try to Centre
          if rnx.first - @choice_window.width > x
            @choice_window.x = rnx.first - @choice_window.width
          else
            @choice_window.x = rnx.last
          end
        end
      end
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Resize
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def resize(w, h)
    if w != self.width || h != self.height
      self.width = w
      self.height = h
      create_contents
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Screen Ranges
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def screen_ranges
    rmx = (self.x + self.padding)...(self.x + self.width - self.padding)
    rmy = (self.y + self.padding)...(self.y + self.height - self.padding)
    return rmx, rmy
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Total Line Width
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def maatsfo_line_width(y = 0)
    nlx = new_line_x
    w = contents_width
    if @atsfo_face.visible?
      rfx, rfy = @atsfo_face.screen_ranges
      rmx, rmy = screen_ranges
      if (rfy === rmy.first || rmy === rfy.first) && nlx < rfx.first &&
        (rfx.first < (x + width - padding))
        w = rfx.first - (x + padding)
      end
    end
    w - nlx
  end
  if $imported[:ATS_Formatting]
    def maatsf_total_line_width(y = 0); maatsfo_line_width(y); end
  end
end


EDIT: if it cuts the work time for anyone who tries to convert this, I only need the animated faces option... none other :)
6
Thanks, KK20.

I understand why it's not possible! I figured that since I can't do that, I decided against using it as a function in the game  :^_^': I'll make the game mechanics work differently now since I can't find other scripts that can handle such a thing.

Thanks for your help!
7
I recently posted this issue on another game development site, but no one could help me find the right answer.

What I'm looking for is a way to get the menu to open anytime in an RMXP game, whether or not messages are being displayed on screen. Ideally, it wouldn't close the message that's currently being displayed--it would just force the menu open, then return to the message that was being displayed.

I've been using RMXP for ages, and this is the one thing I've been wondering ever since I started using it. It seems annoying that you're unable to do that... or would a function to open the menu at the same time as a message somehow screw up the system?

If there is no way currently, can someone direct me to the parts in the script editor that might have something to do with menu access? So I can toy around with it :)

Someone did suggest to me to replace this section of code in Scene_Map:


with this:
Spoiler: ShowHide
    # If B button was pressed
    if Input.trigger?(Input::B)
      # If event is running, or menu is not forbidden
      unless $game_system.menu_disabled
        # Set menu calling flag or beep flag
        $game_temp.menu_calling = true
        $game_temp.menu_beep = true
      end
    end


... but it didn't work. This feature is really important to my game, so I'd really appreciate it if someone were able to show me how to solve this problem.

Thanks for any help in advance!

~Zangetsu
8
I do have a $scene.emotion, and it will be all right if I delete that and save without it, but I do want to keep this emotion scene...

Never mind actually! I've fixed this by simply adding in some wait frames at the beginning, to give the game some time before it runs that parallel process... I guess because "emotions" doesn't exist in the Scene_Load? So I make it wait for 10 frames, then it works!

But for some reason, the new project file that I started had no problems to load the script in the parallel process for emotions.

I have solved this and will be changing the title to mark it as resolved. :) Thank you for trying to help, though!
9
Hi, I'm using RPG Maker XP! I ran into a problem today that I hope to solve soon. :) I'll will put all the detail that I can.

So in my game I ran a parallel process, and this process uses the emotions script. I will post below, in spoilers in case this code is too large.

Spoiler: ShowHide
#===============================================================#
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>SCRIPT<<<<<<<<<<<<<<<<<<<<<<<<<<<<<#
#===============================================================#
#                                                               #
#                        Emotions Script                        #
#                by Ánemus (www.arcadiumrpg.net)                #
#                                                               #
#  This script shows emotions over the player or over the other #
#                     characters of the map.                    #
#                                                               #
#                  $scene.emotion(id,ev,image)                  #
#                                                               #
#           For any comments: anemus@arcadiumrpg.net            #
#                                                               #
#===============================================================#
#>>>>>>>>>>>>>>>>>>>>>>>>>>>SETTINGS<<<<<<<<<<<<<<<<<<<<<<<<<<<<#
#===============================================================#
#                                                               #
# Number of Repetitions or LOOP:                                #
# That's the number of times the animation of the emotion will  #
# repeat. I recomend 1, because bigger numbers are just way to  #
# repetitive.                                                   #
LOOP = 1
#                                                               #
# Delay:                                                        #
# That's the slowness of the animation. I recomend 3 or 4,      #
# smaller numbers are like flashes, so they aren't really       #
# useful.                                                       #
DELAY = 5
#                                                               #
# Deafult file for emotions:                                    #
# This is a tool to make it easier to use, this way you just    #
# write the id of the animation and the event where you want to #
# show it.
DEFAULTFILE = "Balloon"
#                                                               #
#===============================================================#
#>>>>>>>>>>>>>>>>>>>>>>>>>INSTRUCTIONS<<<<<<<<<<<<<<<<<<<<<<<<<<#
#===============================================================#
#                                                               #
# Whenever you want to use it just use Call Script command      #
# then write:                                                   #
# $scene.emotion(id, ev, image)                                 #
# Being id the number of the emotion in the file (the top one is#
# the 0 and the lowest one the 9), ev the event over which you  #
# are showing the emotion (being -1 for the player and any      #
# other number for events, and image, that is the image file    #
# that you are using for the emotions. This file is to be placed#
# on Pictures folder and should be 256x320 px.                  #
#                                                               #
# Some tips:                                                    #
# If you are using the emotion file specified in DEFAULTFILE    #
# you dont need to include it in the sentence.                  #
# $scene.emotion(id, ev)                                        #
# Now if you are using the default file and also placing the    #
# emotion on the main character, the sentence is reduced to:    #
# $scene.emotion(id)                                            #
#                                                               #
#===============================================================#
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>END<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<#
#===============================================================#

#===============================================================#
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>CODE<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<#
#===============================================================#
class Sprite_Character < RPG::Sprite
 alias :old_updateEmo :update
 def update
   old_updateEmo
   if @frames != nil
     @pic.x = (@character.screen_x + 5)
     @pic.y = (@character.screen_y - @ph - @ch.to_i+2)
     if @frames > (1 + LOOP*7)*DELAY
       @pic.zoom_x = 0.6
       @pic.zoom_y = 0.6
       @pic.opacity = 100
       @frames -= 1
       return
     elsif @frames > (LOOP*7)*DELAY
       @pic.zoom_x = 1
       @pic.zoom_y = 1
       @pic.opacity = 255
       @frames -= 1
       @iframe = 1
       @gota = 0
       return
     elsif @frames == 0
       @frames = nil
       @pic.bitmap.dispose
       @pic.dispose
       @picid = nil
       return
     else
       @pic.bitmap.clear
       @pic.bitmap.blt(0,0,RPG::Cache.picture(@picig),Rect.new(@iframe*32, @picid*32, 32, 32))
       @pic.zoom_x = 1
       @pic.zoom_y = 1
       @pic.opacity = 255
       @frames -= 1
       if @gota == DELAY
         @iframe += 1
         if @iframe > 7
           @iframe = 1
         end
         @gota = 0
       end
       @gota +=1
     end
   end
 end
 def emotion (id,ig="Balloon",wt=false)
   @frames = (2 + LOOP*7)*DELAY
   @picid = id > 9 ? 9 : id
   @picig = ig
   @pic = Sprite.new
   @pic.bitmap = Bitmap.new(32,32)
   @pic.bitmap.blt(0, 0, RPG::Cache.picture(@picig), Rect.new(0,32*@picid,32,32))
   @pic.ox = @pic.bitmap.width / 2
   @pic.oy = @ph = @pic.bitmap.height / 2
   @pic.z = 100
   if wt
     return @frames
   else
     return 0
   end
 end
 def dispose
   super
   if @pic != nil
     @pic.bitmap.dispose
     @pic.dispose
   end
 end
end
class Spriteset_Map
 def emotion (id,ev=-1,ig=DEFAULTFILE,wt=false)
   if ev.to_i > -1
     @frames = @character_sprites[ev].emotion (id,ig,wt)
   else
     @frames = @character_sprites[@character_sprites.size - 1].emotion(id,ig,wt)
   end
   return @frames
 end
end
class Scene_Map
 def emotion (id,ev=-1,ig=DEFAULTFILE,wt=false)
   $game_system.map_interpreter.wait_count = @spriteset.emotion (id,ev,ig,wt)
 end
end
class Interpreter
 def wait_count=(frames)
   @wait_count = frames.to_i
 end
end


So I ran the parallel process with two set move routes for the two NPCs, so that they have emotions above their head as if they're arguing. I use parallel process as to not conflict with autoruns (if I put in an autorun and write "Wait for Completion", the move route will never finish, because it set on repeats).

But when I save and try to load my save file I get an error. Also below, an image, in spoilers:
Spoiler: ShowHide


EDIT: Seems the image does not work. Here is the direct link: http://sta.sh/0266wvtem63e

So when I load the save I get this error... it's because the engine doesn't recognise the "emotion" script that I added? It is an unfamiliar process? In any case please help me solve this! Thank you very much if you can. :)

I'm sorry if my English isn't great! I haven't had good practice for a while now. I'm a little rusty jaja :D
10
Thanks Blizzard :D

Unfortunately the script doesn't seem compatible, but I'll probably try with another project soon! I like this script a lot ;)
11
Hi, I am having a problem.

Is this script compatible to the "Emotions script" by Ánemus? It seems to have an error...

I will paste the code here if it helps. :)

#===============================================================#
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>SCRIPT<<<<<<<<<<<<<<<<<<<<<<<<<<<<<#
#===============================================================#
#                                                               #
#                        Emotions Script                        #
#                by Ánemus (www.arcadiumrpg.net)                #
#                                                               #
#  This script shows emotions over the player or over the other #
#                     characters of the map.                    #
#                                                               #
#                  $scene.emotion(id,ev,image)                  #
#                                                               #
#           For any comments: anemus@arcadiumrpg.net            #
#                                                               #
#===============================================================#
#>>>>>>>>>>>>>>>>>>>>>>>>>>>SETTINGS<<<<<<<<<<<<<<<<<<<<<<<<<<<<#
#===============================================================#
#                                                               #
# Number of Repetitions or LOOP:                                #
# That's the number of times the animation of the emotion will  #
# repeat. I recomend 1, because bigger numbers are just way to  #
# repetitive.                                                   #
LOOP = 1
#                                                               #
# Delay:                                                        #
# That's the slowness of the animation. I recomend 3 or 4,      #
# smaller numbers are like flashes, so they aren't really       #
# useful.                                                       #
DELAY = 5
#                                                               #
# Deafult file for emotions:                                    #
# This is a tool to make it easier to use, this way you just    #
# write the id of the animation and the event where you want to #
# show it.
DEFAULTFILE = "Balloon"
#                                                               #
#===============================================================#
#>>>>>>>>>>>>>>>>>>>>>>>>>INSTRUCTIONS<<<<<<<<<<<<<<<<<<<<<<<<<<#
#===============================================================#
#                                                               #
# Whenever you want to use it just use Call Script command      #
# then write:                                                   #
# $scene.emotion(id, ev, image)                                 #
# Being id the number of the emotion in the file (the top one is#
# the 0 and the lowest one the 9), ev the event over which you  #
# are showing the emotion (being -1 for the player and any      #
# other number for events, and image, that is the image file    #
# that you are using for the emotions. This file is to be placed#
# on Pictures folder and should be 256x320 px.                  #
#                                                               #
# Some tips:                                                    #
# If you are using the emotion file specified in DEFAULTFILE    #
# you dont need to include it in the sentence.                  #
# $scene.emotion(id, ev)                                        #
# Now if you are using the default file and also placing the    #
# emotion on the main character, the sentence is reduced to:    #
# $scene.emotion(id)                                            #
#                                                               #
#===============================================================#
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>END<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<#
#===============================================================#

#===============================================================#
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>CODE<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<#
#===============================================================#
class Sprite_Character < RPG::Sprite
  alias :old_updateEmo :update
  def update
    old_updateEmo
    if @frames != nil
      @pic.x = (@character.screen_x + 5)
      @pic.y = (@character.screen_y - @ph - @ch.to_i+2)
      if @frames > (1 + LOOP*7)*DELAY
        @pic.zoom_x = 0.6
        @pic.zoom_y = 0.6
        @pic.opacity = 100
        @frames -= 1
        return
      elsif @frames > (LOOP*7)*DELAY
        @pic.zoom_x = 1
        @pic.zoom_y = 1
        @pic.opacity = 255
        @frames -= 1
        @iframe = 1
        @gota = 0
        return
      elsif @frames == 0
        @frames = nil
        @pic.bitmap.dispose
        @pic.dispose
        @picid = nil
        return
      else
        @pic.bitmap.clear
        @pic.bitmap.blt(0,0,RPG::Cache.picture(@picig),Rect.new(@iframe*32, @picid*32, 32, 32))
        @pic.zoom_x = 1
        @pic.zoom_y = 1
        @pic.opacity = 255
        @frames -= 1
        if @gota == DELAY
          @iframe += 1
          if @iframe > 7
            @iframe = 1
          end
          @gota = 0
        end
        @gota +=1
      end
    end
  end
  def emotion (id,ig="Balloon",wt=false)
    @frames = (2 + LOOP*7)*DELAY
    @picid = id > 9 ? 9 : id
    @picig = ig
    @pic = Sprite.new
    @pic.bitmap = Bitmap.new(32,32)
    @pic.bitmap.blt(0, 0, RPG::Cache.picture(@picig), Rect.new(0,32*@picid,32,32))
    @pic.ox = @pic.bitmap.width / 2
    @pic.oy = @ph = @pic.bitmap.height / 2
    @pic.z = 100
    if wt
      return @frames
    else
      return 0
    end
  end
  def dispose
    super
    if @pic != nil
      @pic.bitmap.dispose
      @pic.dispose
    end
  end
end
class Spriteset_Map
  def emotion (id,ev=-1,ig=DEFAULTFILE,wt=false)
    if ev.to_i > -1
      @frames = @character_sprites[ev].emotion (id,ig,wt)
    else
      @frames = @character_sprites[@character_sprites.size - 1].emotion(id,ig,wt)
    end
    return @frames
  end
end
class Scene_Map
  def emotion (id,ev=-1,ig=DEFAULTFILE,wt=false)
    $game_system.map_interpreter.wait_count = @spriteset.emotion (id,ev,ig,wt)
  end
end
class Interpreter
  def wait_count=(frames)
    @wait_count = frames.to_i
  end
end
12
RMXP Script Database / Re: [XP] XP Ace Tilemap
March 17, 2015, 10:40:18 pm
Hm, for some reason it doesn't work  :???: That's odd... there's a lot of lines where 480 is writtenin the script, would I have to replace them all then?

EDIT:
I replaced all of the 480s in the script, it works now! :D Thanks for your help, it put me on the right path! uwu
13
RMXP Script Database / Re: [XP] XP Ace Tilemap
March 17, 2015, 09:30:04 pm
I am using this script and changed my resolution to 896 x 576... but the problem is my message box floats in an odd place... any idea how to move it down to the bottom of the screen?

I am also using UMS :D

EDIT:
I should describe my problem more I think... I am using XP, and when I playtest I see the messagebox here: http://orig03.deviantart.net/7b07/f/2015/076/6/a/screenshot_2015_03_17_19_54_49_by_espada_kitsuki-d8m4tkc.png
No matter how I edit the UMS, I can't move the message box to the bottom of thes screen, I can't figure it out.

Please help :)
14
RMXP Script Database / Re: [XP] Drago Inventory System
December 23, 2014, 05:19:18 pm
Okay thank you.

But is there a way to "unbold" it so that it looks unselectable, or to remove the option entirely? Or it is just like this?

Again, thanks for the help :)
15
RMXP Script Database / Re: [XP] Drago Inventory System
December 23, 2014, 12:33:14 am
Okay I'm sorry for necroposting again, but I'm having problems with this script. I'm trying to enter it like this, putting most things as nil because I don't want them to be used:

Quote# STRING SECTION
 ITEM_WELCOME     = "Inventory"
 EQUIP_WELCOME    = "Press Shift button to Unequip"
 ASK_MANY         = nil
 GET_COMB         = nil
 PARTY_INV        = nil
 LOOT_INV         = nil
 USE_COM          = "Use"
 COMBINE_COM      = nil    # Insert nil to disable permanently
 EQ_COM           = nil           # Insert nil to disable permanently
 TRANSFER_COM     = nil  # Insert nil to disable permanently
 UNEQUIP_COM      = "Unequip"
 UNEQUIPALL_COM   = "Unequip All"
 DIS_COM          = nil
 CANCEL_COM       = "Cancel"
 FULL_INVENTORY   = nil
 ELEMENT_TOO_MANY = nil


Because I definitely only want a "Use" function and a "cancel" button in my inventory. The graphics are great and all, but the rest is unnecessary. Unfortunately when I set most of it to nil, I can't even access inventory.

Even when I disable "discard" because I absolutely cannot have it in my game, it tells me there's an error on Window_Command line 41 or something. How can I remove all these unnecessary options without giving my game trouble? If possible I would take to take out the option of "Discard" entirely, rather than just having it move back up to the "Use" option.

Thanks.
16
RMXP Script Database / Re: [XP] Message Choice Window
November 16, 2014, 02:29:04 am
Sorry for necroposting once more... I've been using this script a lot lately, therefore I've had some time to explore and find some weird spots in my games concerning it. And being useless in coding, I wouldn't be able to fix this problem on my own no matter what I do. That's why I'm posting here.

Here's the thing: When I show a picture and call the script, the choices don't show up. At first I thought I didn't draw up the choices, but when I used the up and down arrow keys, I could hear the sound of the cursor moving from choice to choice. So it's there--it's just that the picture (which, by the way, is the size of the game window) and completely obscures it. I guess overlay is the word?

How can I fix it and get the choices to come out on top?

Thanks in advance to anyone who can help!
17
Thanks so much, guys :D This helps a whole bunch.

Once more question, is there any way to centre the text IN the choices? Not centre the message window itself, but the choice's text. Thanks!
18
Sorry for necroposting...

But if anyone can help me out there, I get a syntax error when trying to add a choice with an apostrophe in, as if I want to write "I don't know" as one of the choices, the script won't let me. I get that it's a scripting thing, but is there any way to override this without making my choices seem awkwardly phrased?

Many thanks to anyone who can help.