Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Right Face! (V1.0), Move the face to the right in messages ...
originalwij
post Jun 7 2009, 11:33 AM
Post #1


... 42 ...
Group Icon

Group: Revolutionary
Posts: 214
Type: Scripter
RM Skill: Masterful




Right Face

Version: 1.0
Author: OriginalWij
Release Date:6/7/2009

Introduction:
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


Customization
None

Compatibility
Overwrites a lot of Window_Message, so other similar scripts probably will conflict.

Screenshot
[Show/Hide] Screenshot


Script
CODE

#==============================================================================
# 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


DEMO
v1.0
Attached File  RightFace10.zip ( 353.38K ) Number of downloads: 75



FAQ
Comments and suggestions for improvement/next version welcome.

Terms and Conditions
Free to use. Please credit me.

Credits
Me


__________________________




Go to the top of the page
 
+Quote Post
   
TimmahX
post Jun 7 2009, 01:48 PM
Post #2


Level 6
Group Icon

Group: Member
Posts: 82
Type: Event Designer
RM Skill: Skilled




This is a really good idea! This could create a nice effect for something like a Good V.S. Evil Dialog (One on each side). wink.gif


__________________________
This is a signature. I know right?
Go to the top of the page
 
+Quote Post
   
Zenu_The_Druid
post Jun 14 2009, 04:42 PM
Post #3


Level 5
Group Icon

Group: Member
Posts: 70
Type: Event Designer
RM Skill: Skilled




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

Version: 1.0
Author: OriginalWij
Release Date:6/7/2009

Introduction:
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


Customization
None

Compatibility
Overwrites a lot of Window_Message, so other similar scripts probably will conflict.

Screenshot
[Show/Hide] Screenshot


Script
CODE

#==============================================================================
# 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


DEMO
v1.0
Attached File  RightFace10.zip ( 353.38K ) Number of downloads: 75



FAQ
Comments and suggestions for improvement/next version welcome.

Terms and Conditions
Free to use. Please credit me.

Credits
Me


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
Go to the top of the page
 
+Quote Post
   
originalwij
post Jun 14 2009, 04:48 PM
Post #4


... 42 ...
Group Icon

Group: Revolutionary
Posts: 214
Type: Scripter
RM Skill: Masterful




@Zenu_The_Druid
find this in the script:
CODE
@face.mirror = right

and change it to:
CODE
@face.mirror = false


__________________________




Go to the top of the page
 
+Quote Post
   
Zenu_The_Druid
post Jun 14 2009, 04:56 PM
Post #5


Level 5
Group Icon

Group: Member
Posts: 70
Type: Event Designer
RM Skill: Skilled




QUOTE (originalwij @ Jun 14 2009, 05:48 PM) *
@Zenu_The_Druid
find this in the script:
CODE
@face.mirror = right

and change it to:
CODE
@face.mirror = false


Awesome, thanks.
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 25th May 2013 - 05:09 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker