But you promised me that it was the template that started on line 71, so I thought that you were talking about this template:
http://img20.imageshack.us/img20/6615/spacedh.pngThe template for the positioning of the faces.
I'm guessing that you're talking about the face graphic template:
http://img546.imageshack.us/img546/4058/skitfacetemplate.pngHow it's 96 pixels across and 120 pixels down?
If that's the problem then use this code:
CODE
#==============================================================================
# N5_Module - Skit
#------------------------------------------------------------------------------
# By Night5h4d3
# Version 4.6.0.5
# Date 11/11/2010
# Last Update 8/2/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)
#------------------------------------------------------------------------------
# Pre-script redef
#------------------------------------------------------------------------------
module Graphics
def self.width
return 640
end
def self.height
return 480
end
end
#------------------------------------------------------------------------------
# • 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
#==============================================================================
module N5
#------------------------------------------------------------------------------
# • Skit Presets
#------------------------------------------------------------------------------
# <S> This is the filename to use for the skit system
#--------------------------------------------------------------------------
Skit_BG = "Skit_BG"
#--------------------------------------------------------------------------
# This is the filename to use for the skit system's activation button.
# located in
#--------------------------------------------------------------------------
Skit_Button = "Skit_Button"
#--------------------------------------------------------------------------
# <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 = ""
#--------------------------------------------------------------------------
# <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"
#--------------------------------------------------------------------------
# <B> Pause the interpreter while modifying faces, this will cause the
# interpreter to stop until a face is created/reaches its destination.
#--------------------------------------------------------------------------
Pause_While = false
#--------------------------------------------------------------------------
# <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 => [0, 0],
}
end
#==============================================================================
# How to use: | Making use of this module is actually quite easy, first off
#=============+ when you want to make add a skit, code it's text in a common-
# event, then come here. find the most recent array that hasnt been used - in
# this case, C and rename it . And then we begin editing
# data, just enter in between the brackets [ ] the data in this format:
# NAME, COMMON EVENT NUMBER, MANDITORY?, USE CUSTOM MUSIC?
# The name is what displays in the skit menu if you decide to re-play the
# skit.
# The common event number is the number of the common event to run when this
# skit is active.
# Manditory? is either true or false, if true, the skit will activate without
# player's consent, this is if you want a skit that MUST be played at that
# moment.
# Use custom music? set this as true if you want to use a custom song to play
# while the skit is playing, otherwise, the map BGM will continue to play.
#==============================================================================
module Skits
FRIES_M = ["I want fries - Manditory ver.", 1, true, true]
FRIES = ["I want fries", 2, false, false]
C = []
# 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
attr_accessor :skit_bg # snapshot of map screen for skit bg
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias n543_init initialize
def initialize
n543_init
@skit_beep = false
@newskit = false
@last_bgm = nil
@last_bgs = nil
@skit_bg = 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
unless N5::Skit_BGM == nil or '' or ""
return N5::Skit_BGM
end
return false
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
#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
# An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================
class 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
# Initialize loop count
@loop_count = 0
# Loop
loop do
# Add 1 to loop count
@loop_count += 1
# If 100 event commands ran
if @loop_count > 100
# Call Graphics.update for freeze prevention
Graphics.update
@loop_count = 0
end
# If map is different than event startup time
if $game_map.map_id != @map_id
# Change event ID to 0
@event_id = 0
end
# If a child interpreter exists
if @child_interpreter != nil
# Update child interpreter
@child_interpreter.update
# If child interpreter is finished running
unless @child_interpreter.running?
# Delete child interpreter
@child_interpreter = nil
end
# If child interpreter still exists
if @child_interpreter != nil
return
end
end
# If waiting for message to end
if @message_waiting
return
end
# If pause while moving faces (N543 Skit System)
unless N5::Pause_While
if @pause == true
return
end
end
# If waiting for move to end
if @move_route_waiting
# If player is forcing move route
if $game_player.move_route_forcing
return
end
# Loop (map events)
for event in $game_map.events.values
# If this event is forcing move route
if event.move_route_forcing
return
end
end
# Clear move end waiting flag
@move_route_waiting = false
end
# If waiting for button input
if @button_input_variable_id > 0
# Run button input processing
input_button
return
end
# If waiting
if @wait_count > 0
# Decrease wait count
@wait_count -= 1
return
end
# If an action forcing battler exists
if $game_temp.forcing_battler != nil
return
end
# If a call flag is set for each type of screen
if $game_temp.battle_calling or
$game_temp.shop_calling or
$game_temp.name_calling or
$game_temp.menu_calling or
$game_temp.save_calling or
$game_temp.gameover
return
end
# If list of event commands is empty
if @list == nil
# If main map event
if @main
# Set up starting event
setup_starting_event
end
# If nothing was set up
if @list == nil
return
end
end
# If return value is false when trying to execute event command
if execute_command == false
return
end
# Advance index
@index += 1
end
end
end
#==============================================================================
# ** Window_Message
#------------------------------------------------------------------------------
# This message window is used to display text.
#==============================================================================
class Window_Message < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
if $scene.is_a?(Scene_Skit)
super(0, (Graphics.width/2)-16, Graphics.width, 160)
else
super((Graphics.height/2)-160, (Graphics.width/2)-16, Graphics.height, 160)
end
self.contents = Bitmap.new(width - 32, height - 32)
self.visible = false
self.z = 9998
@fade_in = false
@fade_out = false
@contents_showing = false
@cursor_width = 0
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# * Set Window Background and Position
#--------------------------------------------------------------------------
alias n543_rw reset_window
def reset_window
n543_rw
case $game_system.message_position
when 0 # Top
self.y = 0
when 1 # Middle
self.y = (Graphics.height / 2) - (160 / 2)
when 2 # Bottom
self.y = (Graphics.height - 160)
end
if $scene.is_a?(Scene_Skit)
self.opacity = 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
class Window_PlayTime < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x = 0,y = 0,w = 160,h = 96)
super(x,y,w,h)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
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)
if row_max == 0
row_max = (commands.size + column_max - 1) / column_max
end
super(16,16,Graphics.width-32, Graphics.height-32)
self.contents = Bitmap.new(width-32, height-32)
@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
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + 32) / @column_max - 32
rect.height = 32
rect.x = index % @column_max * (rect.width + 32)
rect.y = index / @column_max * 32
return rect
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, RPG::Cache.icon(N5::New_Skit_Icon), Rect.new(0, 0, 24, 24))
end
rect2 = item_rect(index)
rect2.x += 28
rect2.width -= 8
self.contents.rect.clear_rect(rect2)
self.contents.draw_text(rect2, @commands[index], @align)
else
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
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_Title
#------------------------------------------------------------------------------
# This class performs the title screen processing.
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# * Create Game Objects
#--------------------------------------------------------------------------
alias n5_command_new_game command_new_game
def command_new_game
$game_skit = Game_Skit.new
n5_command_new_game
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs the map screen processing.
#==============================================================================
class Scene_Map
def initialize
if FileTest.exist?("scr_N543.bmp")
File.delete("scr_N543.bmp")
end
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
alias n5_main main
def main
n5_main
@button_sprite.dispose if $game_temp.newskit == false and @button_sprite != nil
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Loop
loop do
# Update map, interpreter, and player order
# (this update order is important for when conditions are fulfilled
# to run any event, and the player isn't provided the opportunity to
# move in an instant)
$game_map.update
if @button_sprite == nil and $game_temp.newskit == true
create_skit_button
end
compare_watched
$game_system.map_interpreter.update
$game_player.update
# Update system (timer), screen
$game_system.update
$game_screen.update
# Abort loop if player isn't place moving
unless $game_temp.player_transferring
break
end
# Run place move
transfer_player
# Abort loop if transition processing
if $game_temp.transition_processing
break
end
end
# Update sprite set
@spriteset.update
# Update message window
@message_window.update
# If game over
if $game_temp.gameover
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If returning to title screen
if $game_temp.to_title
# Change to title screen
$scene = Scene_Title.new
return
end
# If transition processing
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# If showing message window
if $game_temp.message_window_showing
return
end
# update button sprite
@button_sprite.update unless $game_temp.newskit == false or @button_sprite != nil
# If encounter list isn't empty, and encounter count is 0
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
# If event is running or encounter is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
# Confirm troop
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
# If troop is valid
if $data_troops[troop_id] != nil
# Set battle calling flag
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
# If B button was pressed
if Input.trigger?(Input::B)
# If event is running, or menu is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
# Set menu calling flag or beep flag
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
# If debug mode is ON and F9 key was pressed
if $DEBUG and Input.press?(Input::F9)
# Set debug calling flag
$game_temp.debug_calling = true
end
# If player is not moving
unless $game_player.moving?
update_call_skit
# Run calling of each screen
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
#--------------------------------------------------------------------------
# * 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
call_skit
end
end
alias n543_call_menu call_menu
def call_menu
$game_temp.skit_bg = Sprite.new
Win32API.new("screenshot", "Screenshot", "llllpll", "").call(0, 0, 640, 480, "scr_N543.bmp",
Win32API.new("user32", "FindWindow", "pp", "l").call("RGSS Player", $1), 0)
$game_temp.skit_bg.bitmap = Bitmap.new("scr_N543.bmp")
n543_call_menu
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_button
$game_screen.update
break
end
end
end
end
#--------------------------------------------------------------------------
# * N5 Call Skit
#--------------------------------------------------------------------------
def call_skit
$game_temp.skit_bg = Sprite.new
Win32API.new("screenshot", "Screenshot", "llllpll", "").call(0, 0, 640, 480, "scr_N543.bmp",
Win32API.new("user32", "FindWindow", "pp", "l").call("RGSS Player", $1), 0)
$game_temp.skit_bg.bitmap = Bitmap.new("scr_N543.bmp")
if $game_temp.skit_beep
# Play decision SE
$game_system.se_play($data_system.decision_se)
$game_temp.skit_beep = false
end
@spriteset.update
Graphics.update
$game_player.straighten
$scene = Scene_Skit.new(@skit)
end
#--------------------------------------------------------------------------
# * N5 New Skit
#--------------------------------------------------------------------------
def new_skit(skit)
@skit = skit
$game_skit.names.push(@skit[0]) unless $game_skit.skits.include?(@skit)
if @skit[2] == true and $scene.is_a?(Scene_Map) and !$game_skit.skits.include?(@skit)
@spriteset.update
Graphics.update
$game_player.straighten
$game_skit.skits.push(@skit)
$game_temp.skit_bg = Sprite.new
Win32API.new("screenshot", "Screenshot", "llllpll", "").call(0, 0, 640, 480, "scr_N543.bmp",
Win32API.new("user32", "FindWindow", "pp", "l").call("RGSS Player", $1), 0)
$game_temp.skit_bg.bitmap = Bitmap.new("scr_N543.bmp")
$scene = Scene_Skit.new(@skit)
else
$game_skit.skits.push(@skit) unless $game_skit.skits.include?(@skit)
end
end
#--------------------------------------------------------------------------
# * N5 Create Skit Button
#--------------------------------------------------------------------------
def create_skit_button
return if @button_sprite != nil or $game_temp.newskit == false
@button_sprite = Sprite.new(@spriteset.viewport1)
@button_sprite.bitmap = RPG::Cache.icon(N5::Skit_Button)
@button_sprite.x = Graphics.width - @button_sprite.src_rect.width
@button_sprite.y = Graphics.height - @button_sprite.src_rect.height
@button_sprite.z = 900
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================
class Scene_Menu
def main
if FileTest.exist?("scr_N543.bmp")
File.delete("scr_N543.bmp")
end
# Make command window
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = N5::Skits_Term # N5
s6 = "Save"
s7 = "End Game"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
@command_window.index = @menu_index
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# If no skits or a invalid number of skits exists
if $game_skit.skits.size <= 0
# Disable skits
@command_window.disable_item(4)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(5)
end
# Make play time window
@playtime_window = Window_PlayTime.new(0, 252, 160, 96)
# Make steps window
@steps_window = Window_Steps.new
@steps_window.x = 0
@steps_window.y = 320
# Make gold window
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 416
# Make status window
@status_window = Window_MenuStatus.new
@status_window.x = 160
@status_window.y = 0
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@command_window.dispose
@playtime_window.dispose
@steps_window.dispose
@gold_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If command other than save or end game, and party members = 0
if $game_party.actors.size == 0 and @command_window.index < 4
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Branch by command window cursor position
case @command_window.index
when 0 # item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to item screen
$scene = Scene_Item.new
when 1 # skill
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4 # skit
# If skits are unavailable
if $game_skit.skits.size <= 0 and @command_window.index == 4 #N5
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skit.new(nil, true)
when 5 # save
# If saving is forbidden
if $game_system.save_disabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to save screen
$scene = Scene_Save.new
when 6 # end game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to end game screen
$scene = Scene_End.new
end
return
end
end
end
#==============================================================================
# ** Scene_Skit
#------------------------------------------------------------------------------
# This class performs the basic Skit Processing.
#==============================================================================
class Scene_Skit
#--------------------------------------------------------------------------
# * 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 = []
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
@skitback_sprite = Sprite.new
@skitback_sprite.bitmap = $game_temp.skit_bg.bitmap
@skitback_sprite.color.set(16, 16, 16, 128)
@message_window = Window_Message.new
case @run_skit
when true
create_skit_interface
if @skit[3]
$game_temp.last_bgm = $game_system.playing_bgm
$game_temp.last_bgs = $game_system.playing_bgs
Audio.bgm_stop
Audio.bgm_stop
end
run_skit
when false
create_skit_window
end
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Terminatation
terminate
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
@skitback_sprite.dispose
@message_window.dispose
if @run_skit
@skit_interface.dispose
else
if @skit_window != nil
@skit_window.dispose
end
end
for i in 0...@face_array.size
@face_array[i].dispose
end
if @face_array != []
@face_array.clear
@name_array.clear
@moving_face.clear
@dest_x.clear
@dest_y.clear
@duration.clear
end
Audio.bgm_fade(20)
Audio.bgs_fade(20)
unless $game_temp.last_bgm == nil
$game_temp.last_bgm.play
$game_temp.last_bgs.play
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@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_system.map_interpreter.pause == false
$game_system.map_interpreter.update
end
if !$game_system.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 = RPG::Cache.icon(N5::Skit_BG)
@skit_interface.x = 0
@skit_interface.y = 0
@skit_interface.z = 100
end
#--------------------------------------------------------------------------
# * Run Skit
#--------------------------------------------------------------------------
def run_skit
if @skit[3]
unless $game_system.skit_bgm == false
Audio.bgm_play("Audio/BGM/" + $game_system.skit_bgm, 100, 100)
end
end
$game_system.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 = RPG::Cache.icon(face_name)
face_name =~ /((\d)+)x((\d)+)$/
face_width, face_height = $1.to_i, $3.to_i
face_width = 96 if face_width == 0
face_height = 120 if face_height == 0
rect = Rect.new(0, 0, 0, 0)
rect.x = expr % 4 * face_width + (0) / 2
rect.y = expr / 4 * face_height + (0) / 2
rect.width = face_width
rect.height = face_height
@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
#--------------------------------------------------------------------------
# * Change Face
#--------------------------------------------------------------------------
def change_face(o, new_o, new_expr = nil, new_face = nil, mirror = false)
verify_new(new_o)
@new_orig = new_o.is_a?(Array) ? new_o : N5::SKIT_POS[new_o]
for i in 0..@face_array.size - 1
if (@face_array[i].x == N5::SKIT_POS[o][0].to_f) and (@face_array[i].y == N5::SKIT_POS[o][1].to_f)
@number = i
break
end
end
if new_expr != nil
if new_face != nil and @name_array[@number] != new_face
bitmap = RPG::Cache.icon(new_face)
@name_array[@number] = new_face
else
bitmap = RPG::Cache.icon(@name_array[@number])
end
@name_array[@number] =~ /((\d)+)x((\d)+)$/
face_width, face_height = $1.to_i, $3.to_i
face_width = 96 if face_width == 0
face_height = 120 if face_height == 0
rect = Rect.new(0, 0, 0, 0)
rect.x = new_expr % 4 * face_width + (0) / 2
rect.y = new_expr / 4 * face_height + (0) / 2
rect.width = face_width
rect.height = face_height
@face_array[@number].bitmap.blt(0, 0, bitmap, rect)
bitmap.dispose
end
@face_array[@number].mirror = mirror
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_system.map_interpreter.pause = true
end
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
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
end
if @dest_x[i] == nil and @dest_y[i] == nil
@moving_face[i] = nil
end
if @dest_x.nitems == 0 and @dest_y.nitems == 0
$game_system.map_interpreter.pause = false
break
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)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
$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_Save
#--------------------------------------------------------------------------
# * 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
end
class Scene_Load
#--------------------------------------------------------------------------
# * 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
And you need to format your picture to have the dimensions at the end of the face's name, so for example:
I've appended 10x20 to the end of the filename, telling the script that each face is 10 pixels across and 20 pixels down for that graphic.