This is totally awesome

thank you very much for getting it done

Well hope you don't mind, I added full guide on how to use in the script's description. Just a little something for ease of use for those who wanna use the script.
CODE
#==============================================================================
# N5_Module - Skit
#------------------------------------------------------------------------------
# By Night5h4d3
# Version 5.0
# Date 11/11/2010
# Last Update 9/13/2011
#==============================================================================
# • Support/Troubleshooting/FAQ's/Bugs:
# If what you have in mind falls under those categories, PM me at:
# http://www.rpgrevolution.com/
# (Username: Night5h4d3)
#------------------------------------------------------------------------------
# • Key
# <S> = New value in "string" format
# <B> = New value in boolean format (true/false)
# <H> = New value in hash format (I=>N)
# <P> = Pointer to existing variable
# <N> = Number format
#==============================================================================
module N5
#------------------------------------------------------------------------------
# • Skit Presets
#------------------------------------------------------------------------------
# <S> This is the filename to use for the skit system
#--------------------------------------------------------------------------
Skit_BG = "Skit_BG"
#--------------------------------------------------------------------------
# <P> This is the button needed in order to activate the skit system
#--------------------------------------------------------------------------
Skit_Activate = Input::X
#--------------------------------------------------------------------------
# <S> This is the default music to play during a 'skit', this can be changed
# later by using a call script ($game_system.skit_bgm = "<new BGM name>")
#--------------------------------------------------------------------------
Skit_BGM = "Spinach Rag Opera"
#--------------------------------------------------------------------------
# <S> Refers to the Icon used for new/un-watched skits, leave "" or nil
# if you don't want an icon to be displayed next to new skits, they will be
# italic if no icon is used.
#--------------------------------------------------------------------------
New_Skit_Icon = ""
#--------------------------------------------------------------------------
# <S> The term used in the menu for skits.
#--------------------------------------------------------------------------
Skits_Term = "Skits"
#--------------------------------------------------------------------------
# <N> Switch number to toggle hiding new skit button. Set to false to never
# hide,
#--------------------------------------------------------------------------
Hide_Btn = 82
#--------------------------------------------------------------------------
# <N> Switch number to toggle hiding new skit text. Set to false to never
# hide,
#--------------------------------------------------------------------------
Hide_Txt = false
#--------------------------------------------------------------------------
# <N> Frame rate of the animated button. For animations with fewer frames
# set this number higher. Keep in mind that if this number multiplied by
# the number of frames in the animation exceeds 60(the game's framerate),
# frames WILL skip.
#--------------------------------------------------------------------------
Anim_Rate = 6
#--------------------------------------------------------------------------
# <H> The positioning used for the skit faces. > Do not change this unless
# you know what you're doing! <
#--------------------------------------------------------------------------
SKIT_POS = { 0 => [(((Graphics.width-448)/2)+176),(((Graphics.height-(32*4))-120)/2)],
1 => [(((Graphics.width-448)/2)+112), (((Graphics.height-(32*4))-120)/2)],
2 => [(((Graphics.width-448)/2)+240), (((Graphics.height-(32*4))-120)/2)],
3 => [(((Graphics.width-448)/2)+48), (((Graphics.height-(32*4))-120)/2)],
4 => [(((Graphics.width-448)/2)+304), (((Graphics.height-(32*4))-120)/2)],
5 => [(((Graphics.width-448)/2)+112), 32],
6 => [(((Graphics.width-448)/2)+240), 32],
7 => [(((Graphics.width-448)/2)+112), (((Graphics.height-(32*5))/2)+32)],
8 => [(((Graphics.width-448)/2)+240), (((Graphics.height-(32*5))/2)+32)],
9 => [(((Graphics.width-448)/2)+48), 32],
10 => [(((Graphics.width-448)/2)+304), 32],
11 => [(((Graphics.width-448)/2)+48),(((Graphics.height-(32*5))/2)+32)],
12 => [(((Graphics.width-448)/2)+304), (((Graphics.height-(32*5))/2)+32)],
13 => [(((Graphics.width-448)/2)+176), 32],
14 => [(((Graphics.width-448)/2)+176), (((Graphics.height-(32*5))/2)+32)],
15 => [(((Graphics.width-448)/2)), (((Graphics.height-(32*5))/2)+32)],
16 => [(((Graphics.width-448)/2)+368), (((Graphics.height-(32*5))/2)+32)],
17 => [(((Graphics.width-448)/2)), 32],
18 => [(((Graphics.width-448)/2)+368), 32]
19 => [(Graphics.width-96), 32],
20 => [(Graphics.width+96), 32],
21 => [(Graphics.width-96), 160],
22 => [(Graphics.width+96), 160],
# Your custom Face Position here. Format: Index => (x, y),
}
end
#============================================================================= #
# HOW TO USE: ||
# ============================================================================ #
# STEP 1 | ADD THE SKIT |
# ------------------------
# In Skits module under this section, add a new array in the following format.
# SKIT_ALIAS = [NAME, COMMON EVENT ID, MANDITORY, CUSTOM BGM]
#
# SKIT_ALIAS - Change this to the alias representing the corresponding skit
# configured under SNIPPETS section.
# NAME - Name of the skit to be appeared on map and in Skit Menu.
# COMMON EVENT ID - Common Event ID
# MANDITORY? - True or false. True to make this skit to be played forcefully.
# CUSTOM BGM? - True or false. Current Map's BGM will be used if false.
#
# ------------------------------------------------------------------------------
# STEP 2 | CREATE THE SKIT |
# --------------------------
# Start designing your skit. Remember to always ADD FACES first. Should look
# like this:
# > Script: $scene.new_face("Ralph", 3, 0, false, 0)
# > Script: $scene.new_face("Ulrika", 2, 17, true, 0)
# > Text: ...
#
# Check out the SNIPPETS under this section for more features in-skit.
# ---------------------------------------------------------------------------- #
# STEP 3 | CALL THE SKIT |
# ------------------------
# Using an Event, Script Command to call and add the skit to Skit Menu.
# $scene.new_skit(Skits::SKIT_ALIAS)
# SKIT_ALIAS - The alias representing the corresponding skit already configured
# under SNIPPETS section.
# ================================== DONE! =================================== #
#
#
#
# ============================================================================ #
# * SNIPPETS TO BE USED IN-SKIT
# ============================================================================ #
# * ======== ADD A FACE ======== *
# $scene.new_face(face, expr, pos, mir?, num)
#* NOTES
# face - the filename of the face set to use
# expr - facial expression (0-7, default is 0)
# pos - the position of the face (default is 0)
# mir? - set to true to mirror the face graphic. Default is false
# num - set default value of facial expression index
#
#
# * ======== CHANGE A FACE ======== *
# $scene.change_face(pos, new expr, new file, mirror)
#* NOTES
# pos - refers to the current position of the face being modified.
# new expr - new facial expression to use.
# new file - new face graphic to use, nil to keep.
# mirror - 'Mirror new face?' Default is false.
#
#
# * ======== REPOSITION A FACE ======== *
# $scene.move(pos, new pos, pause)
#* NOTES
# pos - refers to the current position of the face being modified.
# new pos - refers to the destination position.
# pause - 'Pause interpreter while moving face?' Default is false.
#
#
# * ======== HOPPING EFFECT ======== *
# $scene.hop(pos, scale, count, dir, pause)
#* NOTES
# pos - refers to the current position of the face being modified.
# scale - how fast and high the face hops (scale of 1-10). Default is 5.
# count - how many times to make the face jump (scale of 1-5). Default is 1
# dir - direction of the jump ("up", "down", "left", "right"). Default is "up"
# pause - 'Pause interpreter while moving face?' Default is false.
#
#
# * ======== POPPING EFFECT ======== *
# $scene.pop(pos, scale, pause)
#*NOTES
# pos - refers to the current position of the face being modified.
# scale - how fast and wide the face pops (scale of 1-5). Default is 3.
# pause - 'Pause interpreter while moving face?' Default is false.
#
#
# * ======== SHAKING EFFECT ======== *
# $scene.shake(pos, scale, axis, pause)
#* NOTES
# pos - refers to the current position of the face being modified.
# scale - how fast the face shakes (scale of 1-10). Default is 5.
# axis - plane of shake "x" or "y" (horizontal or vertical). Default is "x".
# pause - 'Pause interpreter while moving face?' Default is false.
#============================================================================= #
module Skits
YOLINA_CAVE = ["I'm ... err ... not nfraid!", 101, false, false]
THE_REASON = ["The reason why I decided to stay", 102, false, false]
# Append skits here
# NOTE: MUST BE ALL CAPS
end
#==============================================================================
# * END CONFIGURATION ZONE
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# The instance of this class is referenced by $game_temp.
#==============================================================================
class Game_Temp
attr_accessor :newskit # new skit available flag
attr_accessor :skit_beep # play SE flag
attr_accessor :last_bgm # memory of the last bgm played
attr_accessor :last_bgs # memory of the last bgs played
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias n543_init initialize
def initialize
n543_init
@skit_beep = false
@newskit = false
@last_bgm = nil
@last_bgs = nil
end
end
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles system-related data. Also manages vehicles and BGM, etc.
# The instance of this class is referenced by $game_system.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Get Skit BGM (N5)
#--------------------------------------------------------------------------
def skit_bgm
if @skit_bgm == nil
return N5::Skit_BGM
else
return @skit_bgm
end
end
#--------------------------------------------------------------------------
# * Set Skit BGM (N5)
# skit_bgm : new BGM
#--------------------------------------------------------------------------
def skit_bgm=(skit_bgm)
@skit_bgm = skit_bgm
end
end
#==============================================================================
# ** Game_Skit
#------------------------------------------------------------------------------
# This class handles Skit variables. It includes the data of available and
# watched skits in addition to their names.
#==============================================================================
class Game_Skit
attr_accessor :skits
attr_accessor :watched
attr_accessor :names
#--------------------------------------------------------------------------
# * Object Initialization
# skits : Current skits in list
# watched : Skits that have been watched (for displaying 'new' icon)
# names : Names to display for skit menu
#--------------------------------------------------------------------------
def initialize
@skits = []
@watched = []
@names = []
@skit_count_old = @skits.size
end
#--------------------------------------------------------------------------
# * New Skits Available
#--------------------------------------------------------------------------
def new_skits?
return true if @skits.size > @skit_count_old
end
end
#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
# An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# * Event Setup
# list : list of event commands
# event_id : event ID
#--------------------------------------------------------------------------
alias n543_setup setup
def setup(list, event_id = 0)
n543_setup(list, event_id)
@pause = false
end
#--------------------------------------------------------------------------
# * Get Pause state
#--------------------------------------------------------------------------
def pause
return @pause
end
#--------------------------------------------------------------------------
# * Set Pause state
#--------------------------------------------------------------------------
def pause=(pause)
@pause = pause
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
loop do
if $game_map.map_id != @map_id # Map is different?
@event_id = 0 # Make event ID 0
end
if @child_interpreter != nil # If child interpreter exists
@child_interpreter.update # Update child interpreter
if @child_interpreter.running? # If running
return # Return
else # After execution has finished
@child_interpreter = nil # Erase child interpreter
end
end
if @message_waiting # Waiting for message finish
return
end
if @pause == true
return
end
if @moving_character != nil # Waiting for move to finish
if @moving_character.move_route_forcing
return
end
@moving_character = nil
end
if @wait_count > 0 # Waiting
@wait_count -= 1
return
end
if $game_troop.forcing_battler != nil # Forcing battle action
return
end
if $game_temp.next_scene != nil # Opening screens
return
end
if @list == nil # If content list is empty
setup_starting_event if @main # Set up starting event
return if @list == nil # Nothing was set up
end
return if execute_command == false # Execute event command
@index += 1 # Advance index
end
end
end
#==============================================================================
# ** Window_Message
#------------------------------------------------------------------------------
# This message window is used to display text.
#==============================================================================
class Window_Message < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, Graphics.height - 128, Graphics.width, 128)
self.z = 200
self.active = false
self.index = -1
self.openness = 0
@opening = false # WIndow opening flag
@closing = false # Window closing flag
@text = nil # Remaining text to be displayed
@contents_x = 0 # X coordinate for drawing next character
@contents_y = 0 # Y coordinate for drawing next character
@line_count = 0 # Line count drawn up until now
@wait_count = 0 # Wait count
@background = 0 # Background type
@position = 2 # Display position
@show_fast = false # Fast forward flag
@line_show_fast = false # Fast forward by line flag
@pause_skip = false # Input standby omission flag
create_gold_window
create_number_input_window
create_back_sprite
end
#--------------------------------------------------------------------------
# * Set Window Background and Position
#--------------------------------------------------------------------------
alias n543_rw reset_window
def reset_window
n543_rw
case @position
when 0 # Top
self.y = 0
@gold_window.y = 360
when 1 # Middle
self.y = (Graphics.height / 2) - (128 / 2)
@gold_window.y = 0
when 2 # Bottom
self.y = (Graphics.height - 128)
@gold_window.y = 0
end
end
end
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
# This class brings together map screen sprites, tilemaps, etc. It's used
# within the Scene_Map class.
#==============================================================================
class Spriteset_Map
attr_accessor :viewport1
attr_accessor :viewport2
attr_accessor :viewport3
end
#==============================================================================
# ** Window_SkitCommand
#------------------------------------------------------------------------------
# Similar to 'Menu_Command' but changed to adapt separate functionality for the
# skit system.
#==============================================================================
class Window_SkitCommand < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :commands # command
#--------------------------------------------------------------------------
# * Object Initialization
# width : window width
# commands : command string array
# align : alignment (0 left, 1 center, 2 right)
# column_max : digit count (if 2 or more, horizontal selection)
# row_max : row count (0: match command count)
# spacing : blank space when items are arrange horizontally
#--------------------------------------------------------------------------
def initialize(commands, align = 1, column_max = 1, row_max = 13, spacing = 32)
if row_max == 0
row_max = (commands.size + column_max - 1) / column_max
end
super(16,16,Graphics.width-32, Graphics.height-32, spacing)
@align = align
@commands = commands
@item_max = commands.size
@column_max = column_max
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# enabled : enabled flag. When false, draw semi-transparently.
#--------------------------------------------------------------------------
def draw_item(index, enabled = true)
if N5::New_Skit_Icon != "" or nil
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
unless @commands[index] == ""
self.contents.blt(4, index * 24, Cache.system(N5::New_Skit_Icon), Rect.new(0, 0, 24, 24))
end
rect2 = item_rect(index)
rect2.x += 28
rect2.width -= 8
self.contents.clear_rect(rect2)
self.contents.draw_text(rect2, @commands[index], @align)
else
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
if $game_skit.watched.include?($game_skit.skits[index])
self.contents.font.italic = false
self.contents.font.bold = false
else
self.contents.font.italic = true
self.contents.font.bold = true
end
self.contents.draw_text(rect, @commands[index], @align)
end
end
def change_array_size(new_size)
@item_max = new_size
end
def change_command(old_index, new_data, now_enabled = true)
if @commands[old_index] == nil
@commands.push new_data
else
@commands[old_index] = new_data
end
draw_item(old_index, now_enabled)
refresh
end
def delete_command(delete)
@commands[delete] = ""
refresh
end
end
#==============================================================================
# ** Scene_Base
#------------------------------------------------------------------------------
# This is a superclass of all scenes in the game.
#==============================================================================
class Scene_Base
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
if !$scene.is_a?(Scene_Map)
if @button_sprite != nil
@button_sprite.dispose
end
if @skit_text != nil
@skit_text.dispose
end
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
if $scene.is_a?(Scene_Map)
compare_watched
unless $game_message.visible # Unless displaying a message
update_call_skit
update_skit_text unless $game_temp.newskit == false or @skit_text == nil
update_skit_button unless $game_temp.newskit == false or @button_sprite == nil
@button_sprite.dispose if @button_sprite != nil and $game_switches[N5::Hide_Btn]
@skit_text.dispose if @skit_text != nil and $game_switches[N5::Hide_Txt]
end
end
end
#--------------------------------------------------------------------------
# * N5 Create Menu BG
#--------------------------------------------------------------------------
def create_menu_bg_lite(lite = false)
@menuback_sprite = Sprite.new
@menuback_sprite.bitmap = $game_temp.background_bitmap
unless !lite
@menuback_sprite.color.set(16, 16, 16, 128)
end
update_menu_background
end
end
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs the title screen processing.
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# * Create Game Objects
#--------------------------------------------------------------------------
alias n5_create_game_objects create_game_objects
def create_game_objects
n5_create_game_objects
$game_skit = Game_Skit.new
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs the map screen processing.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * N5 Update Call Skit
#--------------------------------------------------------------------------
def update_call_skit
return unless $game_temp.newskit == true
if Input.trigger?(N5::Skit_Activate)
$game_temp.skit_beep = true # Set SE play flag
$game_temp.next_scene = "skit"
end
end
#--------------------------------------------------------------------------
# * N5 Compare Watched Skits
#--------------------------------------------------------------------------
def compare_watched
if $game_skit.skits.size > 0
for i in 0..$game_skit.skits.size - 1
if $game_skit.watched.include?($game_skit.skits[i])
next
else
@skit = $game_skit.skits[i]
$game_temp.newskit = true
create_skit_text unless $game_switches[N5::Hide_Txt] or @skit_text != nil
create_skit_button unless $game_switches[N5::Hide_Btn] or @skit_button != nil
break
end
end
end
end
#--------------------------------------------------------------------------
# * Execute Screen Switch
#--------------------------------------------------------------------------
def update_scene_change
return if $game_player.moving? # Is player moving?
case $game_temp.next_scene
when "battle"
call_battle
when "shop"
call_shop
when "name"
call_name
when "menu"
call_menu
when "save"
call_save
when "debug"
call_debug
when "gameover"
call_gameover
when "title"
call_title
when "skit"
call_skit
else
$game_temp.next_scene = nil
end
end
#--------------------------------------------------------------------------
# * N5 Call Skit
#--------------------------------------------------------------------------
def call_skit
if $game_temp.skit_beep
Sound.play_decision
$game_temp.skit_beep = false
end
@spriteset.update
Graphics.update
$game_player.straighten
$game_temp.next_scene = nil
$scene = Scene_Skit.new(@skit)
end
#--------------------------------------------------------------------------
# * N5 New Skit
# skit : new skit to add (from Skits module)
#--------------------------------------------------------------------------
def new_skit(skit)
@skit = skit # Inherit parameter
# Add skit name unless it has already exists
$game_skit.names.push(@skit[0]) unless $game_skit.skits.include?(@skit)
# If added skit is manditory, player is on map, and skit doesn't exist
if @skit[2] == true and $scene.is_a?(Scene_Map) and !$game_skit.skits.include?(@skit)
@spriteset.update # Run a quick update like
Graphics.update # update from transfer player
$game_player.straighten # call.
$game_skit.skits.push(@skit) # Add skit to que
$scene = Scene_Skit.new(@skit) # Run manditory skit
else # conditions not met
# Add skit if it hasn't been already
$game_skit.skits.push(@skit) unless $game_skit.skits.include?(@skit)
end # end if
end # end def
#--------------------------------------------------------------------------
# * N5 Create Skit Text
#--------------------------------------------------------------------------
def create_skit_text
@skit_text = Sprite.new(@spriteset.viewport3) # Create skit text sprite
@skit_text.bitmap = Bitmap.new(120, 32) # Create skit text bitmap
# Align sprite
@skit_text.x = Graphics.width - @skit_text.width - 4
@skit_text.y = Graphics.height - @skit_text.height + 4
@skit_text.z = 900
@skit_text.bitmap.draw_text(0, 0, 120, 32, get_unwatched, 2)
end # end def
#--------------------------------------------------------------------------
# * N5 Create Skit Button
#--------------------------------------------------------------------------
def create_skit_button
return if @button_sprite != nil or $game_temp.newskit == false or $game_switches[N5::Hide_Btn]
@file = Dir.entries("Graphics/System") # Set file to files in folder
for i in 0...@file.size # Number of files in /System
if @file[i] =~ /(skit(.)(b?)utton)/i # "Skit button" Regex
@file = @file[i] # Set file to Regex match
break # break for
end # end if
end # end for
# Regex get frame count from file name and convert to integer; or 1
@anim_frames = (/\#(\d+)/.match(@file) ? Regexp.last_match(1).to_i : 1)
@button_sprite = Sprite.new(@spriteset.viewport3) # Create button sprite
@button_sprite.bitmap = Cache.system(@file) # Load sprite bitmap
if @anim_frames > 1 # Split bitmap by number of frames if frames > 1
@button_sprite.src_rect.set(0, 0, @button_sprite.bitmap.width / @anim_frames, @button_sprite.bitmap.height)
end # end if
# Align sprite
@button_sprite.x = Graphics.width - @button_sprite.width
@button_sprite.y = Graphics.height - @button_sprite.height - (@skit_text != nil ? 24 : 0)
@button_sprite.z = 900
end
#--------------------------------------------------------------------------
# * N5 Update Skit Text
#--------------------------------------------------------------------------
def update_skit_text
@skit_text.bitmap.clear
@skit_text.bitmap.draw_text(0, 0, 120, 32, get_unwatched, 2)
end
#--------------------------------------------------------------------------
# * N5 Update Skit Button
#--------------------------------------------------------------------------
def update_skit_button
@button_sprite.update # Update prior to animation check
return unless @anim_frames > 1 # Return if no frames to cycle
if N5::Anim_Rate == 0 # Prevent 0 division
@index = (Graphics.frame_count % ((@anim_frames - 1) * 2)) - (@anim_frames - 1)
else # Not dividing by 0
@index = ((Graphics.frame_count / N5::Anim_Rate) % ((@anim_frames - 1) * 2)) - (@anim_frames - 1)
end # end if
@button_sprite.src_rect.x = (@index.abs * @button_sprite.width) # new frame
@button_sprite.update # Update picture
end # end def
#--------------------------------------------------------------------------
# * N5 Get Unwatched Skit Names
#--------------------------------------------------------------------------
def get_unwatched
for i in 0...$game_skit.watched.size # Number of watched skits
@return[i] = $game_skit.watched[i][0] # Set to watched names
end # end for
if @return == nil # Return from $game_skit if no watched skits
return $game_skit.names[$game_skit.names.size - 1]
end # end if
@return = $game_skit.names - @return # Remove watched skits
return @return[@return.size - 1] # Return newest skit name
end # end def
end # end class
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
s1 = Vocab::item
s2 = Vocab::skill
s3 = Vocab::equip
s4 = Vocab::status
s5 = N5::Skits_Term # N5
s6 = Vocab::save
s7 = Vocab::game_end
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7]) # N5
@command_window.index = @menu_index
if $game_party.members.size == 0 # If number of party members is 0
@command_window.draw_item(0, false) # Disable item
@command_window.draw_item(1, false) # Disable skill
@command_window.draw_item(2, false) # Disable equipment
@command_window.draw_item(3, false) # Disable status
end
if $game_skit.skits.size <= 0 # If no playable skits
@command_window.draw_item(4, false) # Disable skit
end
if $game_system.save_disabled # If save is forbidden
@command_window.draw_item(5, false) # Disable save
end
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.members.size == 0 and @command_window.index < 4
Sound.play_buzzer
return
elsif $game_skit.skits.size <= 0 and @command_window.index == 4 #N5
Sound.play_buzzer
return
elsif $game_system.save_disabled and @command_window.index == 5
Sound.play_buzzer
return
end
Sound.play_decision
case @command_window.index
when 0 # Item
$scene = Scene_Item.new
when 1,2,3 # Skill, equipment, status
start_actor_selection
when 4 # N5
$scene = Scene_Skit.new(nil, true)
when 5 # Save
$scene = Scene_File.new(true, false, false)
when 6 # End Game
$scene = Scene_End.new
end
end
end
end
#==============================================================================
# ** Scene_Skit
#------------------------------------------------------------------------------
# This class performs the basic Skit Processing.
#==============================================================================
class Scene_Skit < Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(skit = nil, from_menu = false)
@skit = skit unless skit == nil
@from_menu = from_menu
if !@from_menu
@run_skit = true
end
@face_array = []
@name_array = []
@moving_face = []
@number = -1
@dest_x = []
@dest_y = []
@x = []
@y = []
@duration = []
@count = []
@zoom = []
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_bg_lite(@from_menu)
@message_window = Window_Message.new
case @run_skit
when true
create_skit_interface
if @skit[3]
$game_temp.last_bgm = RPG::BGM.last
$game_temp.last_bgs = RPG::BGS.last
RPG::BGM.stop
RPG::BGS.stop
end
run_skit
when false
create_skit_window
end
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@message_window.dispose
if @run_skit
@skit_interface.dispose
else
if @skit_window != nil
@skit_window.dispose
end
end
if @face_array != []
@face_array.clear
@name_array.clear
@moving_face.clear
@dest_x.clear
@dest_y.clear
@duration.clear
end
unless $game_temp.last_bgm == nil
RPG::BGM.fade(20)
RPG::BGS.fade(20)
$game_temp.last_bgm.play
$game_temp.last_bgs.play
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@message_window.update
if @run_skit
@skit_interface.update
else
unless @skit_window != nil
create_skit_window
else
@skit_window.update
update_skit_selection
end
end
if @moving_face.nitems == 0 and $game_map.interpreter.pause != true
$game_map.interpreter.update
end
if !$game_map.interpreter.running? and @run_skit
$game_temp.newskit = false
$scene = Scene_Skit.new(nil, true)
end
if @moving_face.nitems > 0
update_move_face
end
end
#--------------------------------------------------------------------------
# * Create Skit Window
#--------------------------------------------------------------------------
def create_skit_window
@skit_window = Window_SkitCommand.new($game_skit.names)
end
#--------------------------------------------------------------------------
# * Create Skit Interface
#--------------------------------------------------------------------------
def create_skit_interface
@viewport1 = Viewport.new(0, 0, Graphics.width, Graphics.height)
@skit_interface = Sprite.new(@viewport1)
@skit_interface.bitmap = Cache.system(N5::Skit_BG)
@skit_interface.bitmap.blur
@skit_interface.x = 0
@skit_interface.y = 0
@skit_interface.z = 100
end
#--------------------------------------------------------------------------
# * Run Skit
#--------------------------------------------------------------------------
def run_skit
if @skit[3]
Audio.bgm_play("Audio/BGM/" + $game_system.skit_bgm, 100, 100)
end
$game_map.interpreter.setup($data_common_events[@skit[1]].list, 0)
$game_skit.watched.push(@skit)
end
#--------------------------------------------------------------------------
# * Add New Face
#--------------------------------------------------------------------------
def new_face(face_name, expr = 0, pos = 0, mirror = false, num = @face_array.size)
if space_empty?(pos)
@face_array[num] = Sprite.new(@viewport1)
@face_array[num].bitmap = Bitmap.new(96,120)
bitmap = Cache.face(face_name)
rect = Rect.new(0, 0, 0, 0)
rect.x = expr % 4 * 96 + (0) / 2
rect.y = expr / 4 * 120 + (0) / 2
rect.width = 96
rect.height = 120
@face_array[num].bitmap.blt(0, 0, bitmap, rect)
@face_array[num].x = pos.is_a?(Array) ? pos[0] : N5::SKIT_POS[pos][0]
@face_array[num].y = pos.is_a?(Array) ? pos[1] : N5::SKIT_POS[pos][1]
@face_array[num].z = 200
@face_array[num].mirror = mirror
@name_array[num] = face_name
@dest_x[num] = nil
@dest_y[num] = nil
bitmap.dispose
end
end
#--------------------------------------------------------------------------
# * Get face number
#--------------------------------------------------------------------------
def get_face_num(o)
for i in 0...@face_array.size
if (@face_array[i].x == N5::SKIT_POS[o][0]) and (@face_array[i].y == N5::SKIT_POS[o][1])
@num = i
return @num
elsif (o.is_a?(Array) and (@face_array[i].x == o[0] and @face_array[i].y == o[1]))
@num = i
return @num
end
end
raise StandardError, "Position #{o} is un-occupied!"
end
#--------------------------------------------------------------------------
# * Change Face
# o : Face position
# expr : New face expression
# file : New face graphic
# mirror : Mirror face?
#--------------------------------------------------------------------------
def change_face(o, expr, file = nil, mirror = false)
@id = get_face_num(o)
if file != nil and @name_array[@id] != file
bitmap = Cache.face(file)
@name_array[@number] = file
else
bitmap = Cache.face(@name_array[@id])
end
rect = Rect.new(0, 0, 0, 0)
rect.x = expr % 4 * 96 + (0) / 2
rect.y = expr / 4 * 120 + (0) / 2
rect.width = 96
rect.height = 120
@face_array[@id].bitmap.clear
@face_array[@id].bitmap.blt(0, 0, bitmap, rect)
bitmap.dispose
@face_array[@id].mirror = mirror
end
#--------------------------------------------------------------------------
# * Move Face
# o : Face position
# new_o : New face position
# pause : Pause interpreter while moving?
#--------------------------------------------------------------------------
def move_face(o, new_o, pause = false)
verify_new(new_o)
@new_orig = new_o.is_a?(Array) ? new_o : N5::SKIT_POS[new_o]
@number = @id
if N5::SKIT_POS[o] != @new_orig and (new_o.is_a?(Array) ? true : space_empty?(new_o))
@dest_x[@number] = @new_orig[0].to_f
@dest_y[@number] = @new_orig[1].to_f
@duration[@number] = N5::SKIT_POS.has_value?(@new_orig) ? 45 : 50
@moving_face[@number] = true
$game_map.interpreter.pause = pause
end
end
#--------------------------------------------------------------------------
# * Hop Face
# o : Face position
# scale : Hop strength (1-10)
# count : Hop count (1-5)
# dir : Direction of hop: "up", "down", left", "right"
# pause : Pause interpreter while hopping?
#--------------------------------------------------------------------------
def hop(o, scale = 5, count = 1, dir = "up", pause = false)
@id = get_face_num(o)
if scale < 1 # If scale is out of range
scale = 1 # Adjust
elsif scale > 10
scale = 10 # Adjust
end # end if
if count < 1 # If count is out of range
count = 1 # Adjust
elsif count > 5
count = 5 # Adjust
end # end if
@count[@id] = count * 2 # Localize count
@x[@id] = @face_array[@id].x # Store old x
@y[@id] = @face_array[@id].y # Store old y
case dir.downcase
when "up"
@dest_y[@id] = (@face_array[@id].y - scale * 4).to_f
@dest_x[@id] = (@face_array[@id].x).to_f
when "down"
@dest_y[@id] = (@face_array[@id].y + scale * 4).to_f
@dest_x[@id] = (@face_array[@id].x).to_f
when "left"
@dest_x[@id] = (@face_array[@id].x - scale * 4).to_f
@dest_y[@id] = (@face_array[@id].y).to_f
when "right"
@dest_x[@id] = (@face_array[@id].x + scale * 4).to_f
@dest_y[@id] = (@face_array[@id].y).to_f
else
raise StandardError, "Not a valid direction!\nGiven #{dir.downcase}, required up/down/left/right"
end
@duration[@id] = (scale * 2 - 24).abs
@moving_face[@id] = "hopping" # Set face to hop
$game_map.interpreter.pause = pause
end
#--------------------------------------------------------------------------
# * Pop Face
# obj : Face object
# scale : Pop strength (1-5)
# pause : Pause interpreter while popping?
#--------------------------------------------------------------------------
def pop(obj, scale = 3, pause = false)
@id = get_face_num(obj)
if scale < 1 # If scale is out of range
scale = 1 # Adjust
elsif scale > 5
scale = 5 # Adjust
end # end if
@x[@id] = @face_array[@id].x # Store x
@y[@id] = @face_array[@id].y # Store y
@duration[@id] = {1 => 9, 2 => 8, 3 => 7, 4 => 6, 5 => 5}[scale]
@moving_face[@id] = "popping" # Set face to shake
@zoom[@id] = 0.4
$game_map.interpreter.pause = pause
end
#--------------------------------------------------------------------------
# * Shake Face
# o : Face position
# scale : Shake strength (1-10)
# axis : Axis of shake: ("vertical", "horizontal")
# pause : Pause interpreter while shaking?
#--------------------------------------------------------------------------
def shake(o, scale = 5, axis = "x", pause = false)
@id = get_face_num(o)
if scale < 1 # If scale is out of range
scale = 1 # Adjust
elsif scale > 10
scale = 10 # Adjust
end # end if
@count[@id] = -scale # Setup shake counter
@x[@id] = @face_array[@id].x # Store old x
@y[@id] = @face_array[@id].y # Store old y
case axis.downcase
when "x"
@dest_x[@id] = [(@face_array[@id].x + scale + 22).to_f, (@face_array[@id].x + scale - 22).to_f]
@dest_y[@id] = (@face_array[@id].y).to_f
when "y"
@dest_y[@id] = [(@face_array[@id].y + scale + 22).to_f, (@face_array[@id].x + scale - 22).to_f]
@dest_x[@id] = (@face_array[@id].x).to_f
else
raise StandardError, "Not a valid axis!\nGiven #{axi.downcase}, required x/y"
end
@duration[@id] = (scale * 5 - 60).abs
@moving_face[@id] = "shaking" # Set face to shake
$game_map.interpreter.pause = pause
end
#--------------------------------------------------------------------------
# * Dispose Face
#--------------------------------------------------------------------------
def dispose_face(o)
for i in 0..@face_array.size - 1
if @face_array[i] != nil and (@face_array[i].x == N5::SKIT_POS[o][0].to_f) and (@face_array[i].y == N5::SKIT_POS[o][1].to_f)
@face_array[i].dispose
@face_array.delete_at(i)
@name_array.delete_at(i)
@moving_face.delete_at(i)
@dest_x.delete_at(i)
@dest_y.delete_at(i)
@duration.delete_at(i)
end
end
end
#--------------------------------------------------------------------------
# * Update Face
#--------------------------------------------------------------------------
def update_move_face
for i in 0..@face_array.size - 1
unless @duration[i] == nil
case @moving_face[i]
when "hopping"
if @d == 0 or @d == nil
@d = @duration[i]
elsif @d >= 1
@face_array[i].x = (@face_array[i].x * (@d - 1) + @dest_x[i]) / @d
@face_array[i].y = (@face_array[i].y * (@d - 1) + @dest_y[i]) / @d
@d -= 1
end
if (@face_array[i].x == @dest_x[i]) and (@face_array[i].y == @dest_y[i])
if @count[i] >= 2
@dest_x[i] = @x[i]
@dest_y[i] = @y[i]
@x[i] = @face_array[i].x
@y[i] = @face_array[i].y
@count[i] -= 1
else # Done hopping
@dest_x[i] = nil
@dest_y[i] = nil
@moving_face[i] = nil
$game_map.interpreter.pause = false
break
end
end
when "shaking"
if @d == 0 or @d == nil
@d = @duration[i] / 4
elsif @d >= 1
@face_array[i].x = (@face_array[i].x * (@d - 1) + (@dest_x[i].is_a?(Array) ?
@dest_x[i][(@count[i]%2)] :
@dest_x[i])) / @d
@face_array[i].y = (@face_array[i].y * (@d - 1) + (@dest_y[i].is_a?(Array) ?
@dest_y[i][(@count[i]%2)] :
@dest_y[i])) / @d
@d -= 1
end
if(@face_array[i].x == (@dest_x[i].is_a?(Array) ? @dest_x[i][(@count[i]%2)] : @dest_x[i])) and
(@face_array[i].y == (@dest_y[i].is_a?(Array) ? @dest_y[i][(@count[i]%2)] : @dest_y[i]))
if @count[i] <= 0
@count[i] += 1
elsif @count[i] <= 1 # Done shaking
@count[i] += 1
(@dest_x[i].is_a?(Array) ? @dest_x[i][(@count[i]%2)] = @x[i] : @dest_x[i] = @x[i])
(@dest_y[i].is_a?(Array) ? @dest_y[i][(@count[i]%2)] = @y[i] : @dest_y[i] = @y[i])
else # Done returning
@dest_x[i] = nil
@dest_y[i] = nil
@moving_face[i] = nil
$game_map.interpreter.pause = false
break
end
end
when "popping"
if @d == 0 or @d == nil
@d = @duration[i]
elsif @d >= 1
@face_array[i].zoom_x = (@face_array[i].zoom_x * (@d - 1) + (1.0 + @zoom[i])) / @d
@face_array[i].zoom_y = (@face_array[i].zoom_y * (@d - 1) + (1.0 + @zoom[i])) / @d
@d -= 1
a =
@face_array[i].x = (@x[i] - (@face_array[i].width.to_f * (@face_array[i].zoom_x - 1.0)) / 2).ceil
@face_array[i].y = (@y[i] - (@face_array[i].height.to_f * (@face_array[i].zoom_y - 1.0)) / 2).ceil
end
if ((@face_array[i].zoom_x and @face_array[i].zoom_y == 1.0 + @zoom[i]) and (@zoom[i] == 0))
@zoom[i] = nil
@moving_face[i] = nil
$game_map.interpreter.pause = false
break
elsif (@face_array[i].zoom_x and @face_array[i].zoom_y == 1.0 + @zoom[i])
@zoom[i] = 0 #-= 0.5
end
when true # Regular movement
if @duration[i] >= 1
d = @duration[i]
@face_array[i].x = (@face_array[i].x * (d - 1) + @dest_x[i]) / d
@face_array[i].y = (@face_array[i].y * (d - 1) + @dest_y[i]) / d
@duration[i] -= 1
end
if (@face_array[i].x == @dest_x[i]) and (@face_array[i].y == @dest_y[i])
@dest_x[i] = nil
@dest_y[i] = nil
@moving_face[i] = nil
$game_map.interpreter.pause = false
break
end
end
end
end
end
#--------------------------------------------------------------------------
# * Verify Position
#--------------------------------------------------------------------------
def verify_new(o)
case o
when Array
return
when 0..18
return
else
raise IndexError,"Not a valid index!\nGiven #{o} required 0-18 or array."
end
end
#--------------------------------------------------------------------------
# * Space Empty?
#--------------------------------------------------------------------------
def space_empty?(pos)
for i in 0..@face_array.size - 1
if (@face_array[i].x == N5::SKIT_POS[pos][0].to_f) and (@face_array[i].y == N5::SKIT_POS[pos][1].to_f)
if @moving_face[i]
return true
else
print("IndexError\nPosition index #{pos} is currently occupied!")
end
else
return true
end
end
end
#--------------------------------------------------------------------------
# * Update Skit Selection
#--------------------------------------------------------------------------
def update_skit_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Menu.new(4)
elsif Input.trigger?(Input::C)
$scene = Scene_Skit.new($game_skit.skits[@skit_window.index], false)
end
end
end
#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
# This class performs the save and load screen processing.
#==============================================================================
class Scene_File < Scene_Base
#--------------------------------------------------------------------------
# * Write Save Data
# file : write file object (opened)
#--------------------------------------------------------------------------
alias n543_wsd write_save_data
def write_save_data(file)
n543_wsd(file)
Marshal.dump($game_skit, file)
end
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
alias n543_rsd read_save_data
def read_save_data(file)
n543_rsd(file)
$game_skit = Marshal.load(file)
end
end