Simple Cutscenes
Version: 1.1
Author: Maximusmaxy
Release Date: 8/1/12
Introduction
Displays a cut scene graphic and disables any scripts/common events that interfere with cut scenes. All in a single script call.
Features
- 3 styles to choose from
- Custom graphic support
- Disables/Enables Scripts/Common Events
Script
CODE
#===============================================================================
# Simple Cutscenes
# Author: Maximusmaxy
# Version 1.1: 8/1/12
#===============================================================================
#
# Introduction:
# This script draws a simple fade graphic to establish that a scene is
# ocurring, it also disables and scripts that may interfere with cutscenes
# such as HUD's or move speed increases.
#
# Instructions:
# To begin/end a cutscene simply type in the following call scripts:
#
# CUTSCENE.begin
# to start a cutscene
#
# CUTSCENE.end
# to end a cutscene
#
# In the configuration insert the scripts that you need disabled during
# cutscenes. This may or may not include speed boosts and hud's.
#
# For people that like eventing, you may also include switches that are
# activated/deactivated before the cutscene, this can then trigger common
# events. They will be reset to there original state at the end of the scene.
#
# Custom Images:
# You now have the option to use custom graphics for your cutscene images.
# To use this feature place the cutscene images in your pictures folder and add
# the filename of those images to the configuration. Make sure your style is
# set to 3.
#
# It is recommended to use images with a width of 640 pixels.
#
#===============================================================================
module CUTSCENE
#===============================================================================
# Configuration
#===============================================================================
#Choose your style 0 = none, 1 = solid, 2 = fade, 3 = custom
STYLE = 2
#Color of your cutscene graphic. Color.new(RED,GREEN,BLUE)
COLOR = Color.new(0,0,0)
#height of your graphic
HEIGHT = 80
#speed the graphic moves in and out
SPEED = 2
#if using style 3, place your image file names here
TOP = ''
BOTTOM = ''
#insert the enable script for scripts you want disabled during cutscenes here
def self.enable_scripts
#insert script calls here
end
#insert the disable script for scripts you want disabled during cutscenes here
def self.disable_scripts
#insert script calls here
end
#add any switches you want to activate, they will deactivate after the scene
SWITCH_ACTIVATE = [] #EG.[1,2,3]
#add any switches you want to deactivate, they will activate after the scene
SWITCH_DEACTIVATE = [] #EG.[1,2,3]
#===============================================================================
# End Configuration
#===============================================================================
def self.begin
SWITCH_ACTIVATE.each {|switch| $game_switches[switch] = true }
SWITCH_DEACTIVATE.each {|switch| $game_switches[switch] = false }
$game_temp.cutscene_display = true
self.disable_scripts
$game_map.need_refresh = true
end
def self.end
SWITCH_ACTIVATE.each {|switch| $game_switches[switch] = false }
SWITCH_DEACTIVATE.each {|switch| $game_switches[switch] = true }
$game_temp.cutscene_display = false
self.enable_scripts
$game_map.need_refresh = true
end
end
#===============================================================================
# Game_Temp
#===============================================================================
class Game_Temp
attr_accessor :cutscene_display
alias max_cutscene_initialize_later initialize
def initialize
max_cutscene_initialize_later
#temp variable for whether a cutscene is displayed
@cutscene_display = false
end
end
#===============================================================================
# Sprite_Cutscene_Fade
#===============================================================================
class Sprite_Cutscene_Fade < Sprite
attr_reader :dispose_me
def initialize(direction)
super(nil)
@direction = direction
@count = 0
@speed = CUTSCENE::SPEED
@dispose_me = false
refresh
@height = self.bitmap.height
self.y = (@direction == 1 ? -@height : self.y = 480)
self.z = 9997
end
def dispose
self.bitmap.dispose if CUTSCENE::STYLE != 3
super
end
def refresh
case CUTSCENE::STYLE
when 0 #none
self.bitmap = Bitmap.new(1,1)
when 1 #solid
self.bitmap = Bitmap.new(640, CUTSCENE::HEIGHT)
self.bitmap.fill_rect(0, 0, 640, CUTSCENE::HEIGHT, CUTSCENE::COLOR)
when 2 #fade
self.bitmap = Bitmap.new(640, CUTSCENE::HEIGHT)
y = @direction == 1 ? 0 : CUTSCENE::HEIGHT
c = CUTSCENE::COLOR
(0..CUTSCENE::HEIGHT).each do |i|
self.bitmap.fill_rect(0, i * @direction + y, 640, 1,
Color.new(c.red, c.green, c.blue, 255 - 255 * i / CUTSCENE::HEIGHT))
end
when 3 #custom
file = (@direction == 1 ? CUTSCENE::TOP : CUTSCENE::BOTTOM)
self.bitmap = RPG::Cache.picture(file)
end
end
def update
@count += @speed
if @count < @height && !$game_temp.cutscene_display
#jump to fade out
@count = @height * 2 - (@count - @speed)
elsif @count < @height
#fade in
self.y += @speed * @direction
elsif @count == @height && $game_temp.cutscene_display
#hold position
@count -= @speed
elsif @count < @height * 2 && $game_temp.cutscene_display
#jump to fade in
@count = @height * 2 - (@count - @speed)
elsif @count < @height * 2
#fade out
self.y -= @speed * @direction
else
#flag for disposal
@dispose_me = true
end
end
end
#===============================================================================
# Scene_Map
#===============================================================================
class Scene_Map
alias max_cutscene_main_later main
alias max_cutscene_update_later update
def main
max_cutscene_main_later
#dispose fade if changing scenes
@cutscene_top.dispose if !@cutscene_top.nil?
@cutscene_bottom.dispose if !@cutscene_bottom.nil?
end
def update
max_cutscene_update_later
#display the cutscene
if $game_temp.cutscene_display
@cutscene_top = Sprite_Cutscene_Fade.new(1) if @cutscene_top.nil?
@cutscene_bottom = Sprite_Cutscene_Fade.new(-1) if @cutscene_bottom.nil?
@cutscene_top.update
@cutscene_bottom.update
else #else dispose
unless @cutscene_top.nil?
if @cutscene_top.dispose_me
@cutscene_top.dispose
@cutscene_top = nil
else
@cutscene_top.update
end
end
unless @cutscene_bottom.nil?
if @cutscene_bottom.dispose_me
@cutscene_bottom.dispose
@cutscene_bottom = nil
else
@cutscene_bottom.update
end
end
end
end
end
# Simple Cutscenes
# Author: Maximusmaxy
# Version 1.1: 8/1/12
#===============================================================================
#
# Introduction:
# This script draws a simple fade graphic to establish that a scene is
# ocurring, it also disables and scripts that may interfere with cutscenes
# such as HUD's or move speed increases.
#
# Instructions:
# To begin/end a cutscene simply type in the following call scripts:
#
# CUTSCENE.begin
# to start a cutscene
#
# CUTSCENE.end
# to end a cutscene
#
# In the configuration insert the scripts that you need disabled during
# cutscenes. This may or may not include speed boosts and hud's.
#
# For people that like eventing, you may also include switches that are
# activated/deactivated before the cutscene, this can then trigger common
# events. They will be reset to there original state at the end of the scene.
#
# Custom Images:
# You now have the option to use custom graphics for your cutscene images.
# To use this feature place the cutscene images in your pictures folder and add
# the filename of those images to the configuration. Make sure your style is
# set to 3.
#
# It is recommended to use images with a width of 640 pixels.
#
#===============================================================================
module CUTSCENE
#===============================================================================
# Configuration
#===============================================================================
#Choose your style 0 = none, 1 = solid, 2 = fade, 3 = custom
STYLE = 2
#Color of your cutscene graphic. Color.new(RED,GREEN,BLUE)
COLOR = Color.new(0,0,0)
#height of your graphic
HEIGHT = 80
#speed the graphic moves in and out
SPEED = 2
#if using style 3, place your image file names here
TOP = ''
BOTTOM = ''
#insert the enable script for scripts you want disabled during cutscenes here
def self.enable_scripts
#insert script calls here
end
#insert the disable script for scripts you want disabled during cutscenes here
def self.disable_scripts
#insert script calls here
end
#add any switches you want to activate, they will deactivate after the scene
SWITCH_ACTIVATE = [] #EG.[1,2,3]
#add any switches you want to deactivate, they will activate after the scene
SWITCH_DEACTIVATE = [] #EG.[1,2,3]
#===============================================================================
# End Configuration
#===============================================================================
def self.begin
SWITCH_ACTIVATE.each {|switch| $game_switches[switch] = true }
SWITCH_DEACTIVATE.each {|switch| $game_switches[switch] = false }
$game_temp.cutscene_display = true
self.disable_scripts
$game_map.need_refresh = true
end
def self.end
SWITCH_ACTIVATE.each {|switch| $game_switches[switch] = false }
SWITCH_DEACTIVATE.each {|switch| $game_switches[switch] = true }
$game_temp.cutscene_display = false
self.enable_scripts
$game_map.need_refresh = true
end
end
#===============================================================================
# Game_Temp
#===============================================================================
class Game_Temp
attr_accessor :cutscene_display
alias max_cutscene_initialize_later initialize
def initialize
max_cutscene_initialize_later
#temp variable for whether a cutscene is displayed
@cutscene_display = false
end
end
#===============================================================================
# Sprite_Cutscene_Fade
#===============================================================================
class Sprite_Cutscene_Fade < Sprite
attr_reader :dispose_me
def initialize(direction)
super(nil)
@direction = direction
@count = 0
@speed = CUTSCENE::SPEED
@dispose_me = false
refresh
@height = self.bitmap.height
self.y = (@direction == 1 ? -@height : self.y = 480)
self.z = 9997
end
def dispose
self.bitmap.dispose if CUTSCENE::STYLE != 3
super
end
def refresh
case CUTSCENE::STYLE
when 0 #none
self.bitmap = Bitmap.new(1,1)
when 1 #solid
self.bitmap = Bitmap.new(640, CUTSCENE::HEIGHT)
self.bitmap.fill_rect(0, 0, 640, CUTSCENE::HEIGHT, CUTSCENE::COLOR)
when 2 #fade
self.bitmap = Bitmap.new(640, CUTSCENE::HEIGHT)
y = @direction == 1 ? 0 : CUTSCENE::HEIGHT
c = CUTSCENE::COLOR
(0..CUTSCENE::HEIGHT).each do |i|
self.bitmap.fill_rect(0, i * @direction + y, 640, 1,
Color.new(c.red, c.green, c.blue, 255 - 255 * i / CUTSCENE::HEIGHT))
end
when 3 #custom
file = (@direction == 1 ? CUTSCENE::TOP : CUTSCENE::BOTTOM)
self.bitmap = RPG::Cache.picture(file)
end
end
def update
@count += @speed
if @count < @height && !$game_temp.cutscene_display
#jump to fade out
@count = @height * 2 - (@count - @speed)
elsif @count < @height
#fade in
self.y += @speed * @direction
elsif @count == @height && $game_temp.cutscene_display
#hold position
@count -= @speed
elsif @count < @height * 2 && $game_temp.cutscene_display
#jump to fade in
@count = @height * 2 - (@count - @speed)
elsif @count < @height * 2
#fade out
self.y -= @speed * @direction
else
#flag for disposal
@dispose_me = true
end
end
end
#===============================================================================
# Scene_Map
#===============================================================================
class Scene_Map
alias max_cutscene_main_later main
alias max_cutscene_update_later update
def main
max_cutscene_main_later
#dispose fade if changing scenes
@cutscene_top.dispose if !@cutscene_top.nil?
@cutscene_bottom.dispose if !@cutscene_bottom.nil?
end
def update
max_cutscene_update_later
#display the cutscene
if $game_temp.cutscene_display
@cutscene_top = Sprite_Cutscene_Fade.new(1) if @cutscene_top.nil?
@cutscene_bottom = Sprite_Cutscene_Fade.new(-1) if @cutscene_bottom.nil?
@cutscene_top.update
@cutscene_bottom.update
else #else dispose
unless @cutscene_top.nil?
if @cutscene_top.dispose_me
@cutscene_top.dispose
@cutscene_top = nil
else
@cutscene_top.update
end
end
unless @cutscene_bottom.nil?
if @cutscene_bottom.dispose_me
@cutscene_bottom.dispose
@cutscene_bottom = nil
else
@cutscene_bottom.update
end
end
end
end
end
DEMO
Demo is outdated, just copy and paste the script above
http://www.mediafire.com/?2eiqdh5voqxrfe5
The demo includes Simple Pop Up Hud. It's not required for the script but is used as an example on how to use the script.
Screenshot
Installation
Paste above main, bellow the other default scripts.
Credits
Maximusmaxy - For writing the script