QUOTE (originalwij @ Jun 7 2009, 12:33 PM)

Right Face
Version: 1.0Author: OriginalWijRelease Date:6/7/2009Introduction:This short script brings back the old RM2K3 option of having the face on the right side in messages.
Features:v1.0
- Simple to use: put \R in the message text (that's it)
- Face automatically flips (mirrors) when on the right side
- Show Choices and Input Number also automatically adjust if the face is on the right
CustomizationNone
CompatibilityOverwrites a lot of Window_Message, so other similar scripts probably will conflict.
ScreenshotScriptCODE
#==============================================================================
# Right Face
#==============================================================================
# Author : OriginalWij
# Version : 1.0
#==============================================================================
#==============================================================================
# v1.0
# - Initial release
#==============================================================================
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# TO USE: put \R in a message to have the face displayed on the right side
# (the face is automatically flipped (mirrored) when on the right side)
# (show choices & number input are also automatically adjusted by side)
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#==============================================================================
# Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# Draw face for messages (New)
#--------------------------------------------------------------------------
def draw_message_face(face_name, face_index, x, y, right = false)
@face.x = right ? x + 416 : x
@face.y = y + $game_message.position * 144
@face.z = 201
@face.bitmap = Cache.face(face_name)
rect = Rect.new(0, 0, 0, 0)
rect.x = face_index % 4 * 96
rect.y = face_index / 4 * 96
rect.width = rect.height = 96
@face.src_rect = rect
@face.mirror = right
end
end
#==============================================================================
# Window_Message
#==============================================================================
class Window_Message < Window_Selectable
#--------------------------------------------------------------------------
# Initialize (Mod)
#--------------------------------------------------------------------------
alias right_face_wm__initialize initialize unless $@
def initialize
right_face_wm__initialize
# Create face sprite
@face = Sprite.new
end
#--------------------------------------------------------------------------
# Update (Rerwrite)
#--------------------------------------------------------------------------
def update
super
update_gold_window
update_number_input_window
update_back_sprite
update_show_fast
unless @opening or @closing
if @wait_count > 0
@wait_count -= 1
elsif self.pause
input_pause
elsif self.active
input_choice
elsif @number_input_window.visible
input_number
elsif @text != nil
update_message
elsif continue?
start_message
open
$game_message.visible = true
else
close
# Dispose of face (Added)
if @face.bitmap != nil
@face.bitmap.dispose
end
$game_message.visible = @closing
end
end
end
#--------------------------------------------------------------------------
# Start Message (Rewrite)
#--------------------------------------------------------------------------
def start_message
@text = ""
for i in 0...$game_message.texts.size
@text += " " if i >= $game_message.choice_start
@text += $game_message.texts[i].clone + "\x00"
end
# Check for "\R" (Added)
@right = false
if @text.include?('\R')
@text.gsub!(/\\R/) { "" }
@right = true
end
@item_max = $game_message.choice_max
convert_special_characters
reset_window
new_page
end
#--------------------------------------------------------------------------
# New Page (Rewrite)
#--------------------------------------------------------------------------
def new_page
contents.clear
# Dispose of face (Added)
if @face.bitmap != nil
@face.bitmap.dispose
end
if $game_message.face_name.empty?
@contents_x = 0
@right = false # Added
else
name = $game_message.face_name
index = $game_message.face_index
draw_message_face(name, index, 16, 16, @right) # Changed
@contents_x = @right ? 0 : 112 # Edited
end
@contents_y = 0
@line_count = 0
@show_fast = false
@line_show_fast = false
@pause_skip = false
contents.font.color = text_color(0)
end
#--------------------------------------------------------------------------
# New Line (Mod)
#--------------------------------------------------------------------------
alias right_face_wm_new_line new_line unless $@
def new_line
right_face_wm_new_line
# Adjust text's X if face on right side
@contents_x = 0 if @right
end
#--------------------------------------------------------------------------
# Start Number Input (Rewrite)
#--------------------------------------------------------------------------
def start_number_input
digits_max = $game_message.num_input_digits_max
number = $game_variables[$game_message.num_input_variable_id]
@number_input_window.digits_max = digits_max
@number_input_window.number = number
if $game_message.face_name.empty? or @right # Edited
@number_input_window.x = x
else
@number_input_window.x = x + 112
end
@number_input_window.y = y + @contents_y
@number_input_window.active = true
@number_input_window.visible = true
@number_input_window.update
end
#--------------------------------------------------------------------------
# Update cursor (Rewrite)
#--------------------------------------------------------------------------
def update_cursor
if @index >= 0
x = $game_message.face_name.empty? ? 0 : 112
x = 0 if @right # Added
y = ($game_message.choice_start + @index) * WLH
offset = @right ? 112 : 0 # Added
self.cursor_rect.set(x, y, contents.width - x - offset, WLH) # Edited
else
self.cursor_rect.empty
end
end
end
DEMOv1.0
RightFace10.zip ( 353.38K )
Number of downloads: 75FAQComments and suggestions for improvement/next version welcome.
Terms and ConditionsFree to use. Please credit me.
CreditsMe
Cool, I'll credit you if I use it. One thing though, is there a way to make the image not flip? For example, I already made my character's faces, and they all face to the left on default, I want those to stay facing to the left when on the right side.
This post has been edited by Zenu_The_Druid: Jun 14 2009, 04:43 PM