Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Closed TopicStart new topic
> Simple Cutscenes
maximusmaxy
post Oct 2 2011, 12:44 PM
Post #1


PZE whore
Group Icon

Group: Revolutionary
Posts: 131
Type: Scripter
RM Skill: Skilled




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


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

This post has been edited by maximusmaxy: Jan 8 2012, 02:46 AM


__________________________
Check out the new PZE Forums! http://zeldaengine.net/index.php
Go to the top of the page
 
+Quote Post
   
Tsukihime
post Oct 3 2011, 09:37 AM
Post #2


Level 25
Group Icon

Group: Revolutionary
Posts: 561
Type: None
RM Skill: Undisclosed
Rev Points: 25




So would things like a running clock be stopped?

ie: a bomb will go off in 5 minutes and you're supposed to evacuate, but then a cut-scene comes in.
Though realistically time wouldn't stop, but then the player would probably get frustrated that he has to sit through a cut-scene that's wasting his time.

This post has been edited by Tsukihime: Oct 3 2011, 09:39 AM


__________________________
My Scripts
Go to the top of the page
 
+Quote Post
   
maximusmaxy
post Oct 3 2011, 01:13 PM
Post #3


PZE whore
Group Icon

Group: Revolutionary
Posts: 131
Type: Scripter
RM Skill: Skilled




I haven't included any features like that, simply because it's up to developers whether clocks/timer's stop during the cutscene. Developers may actually want the cutscene to be wasting your time. ie. if you've ever played MGS3, after Snake places the bomb in Grozynj Grad you have 10-20 minutes to get out (can't remember how much exactly) but the cutscene wastes your time up until 5 minutes until the bomb explodes. The script alone doesn't disable anything automatically, it just provides a framework for you to be able to disable mandatory stuff like huds and run/dash scripts allot easier.

This post has been edited by maximusmaxy: Oct 3 2011, 07:09 PM


__________________________
Check out the new PZE Forums! http://zeldaengine.net/index.php
Go to the top of the page
 
+Quote Post
   
joey101
post Oct 16 2011, 12:34 PM
Post #4


DeadlyWeapon6
Group Icon

Group: Revolutionary
Posts: 196
Type: Developer
RM Skill: Skilled




QUOTE
a bomb will go off in 5 minutes and you're supposed to evacuate, but then a cut-scene comes in.
Though realistically time wouldn't stop, but then the player would probably get frustrated that he has to sit through a cut-scene that's wasting his time.

YES they would (well aleast i would)


__________________________
Go to the top of the page
 
+Quote Post
   
SleepingSirenx
post Jan 7 2012, 08:59 PM
Post #5


The SMT Maniac
Group Icon

Group: Revolutionary
Posts: 125
Type: Developer
RM Skill: Undisclosed




I'm sorry if this is considered necroposting but I'm having problems at line 148 saying :

Line : 148
Method: y
Disposed Sprite

Thank you.


__________________________

My First Game .... Yeah .... ~♥
I'm In Need Of A Team To Help Me WIth The Development Of My Game PM Me. :)
- DEMO's On Progress!

I Support This Projects!



Please Teach Me How To Script. :(
I'm Learning How To Script. But Still Teach Me How To Script :)
Damn THERMODYNAMICS! Makes My Head Spin!
Go to the top of the page
 
+Quote Post
   
maximusmaxy
post Jan 7 2012, 11:39 PM
Post #6


PZE whore
Group Icon

Group: Revolutionary
Posts: 131
Type: Scripter
RM Skill: Skilled




I rewrote a bunch of the code and added some extra features, i can't be bothered putting up another demo so just copy and paste the script


__________________________
Check out the new PZE Forums! http://zeldaengine.net/index.php
Go to the top of the page
 
+Quote Post
   
SleepingSirenx
post Jan 8 2012, 03:08 AM
Post #7


The SMT Maniac
Group Icon

Group: Revolutionary
Posts: 125
Type: Developer
RM Skill: Undisclosed




Oh I see. I've used the script from the demo, I hardly notice the updates in this thread. Gonna try that. Thank you.


__________________________

My First Game .... Yeah .... ~♥
I'm In Need Of A Team To Help Me WIth The Development Of My Game PM Me. :)
- DEMO's On Progress!

I Support This Projects!



Please Teach Me How To Script. :(
I'm Learning How To Script. But Still Teach Me How To Script :)
Damn THERMODYNAMICS! Makes My Head Spin!
Go to the top of the page
 
+Quote Post
   

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 24th May 2013 - 10:37 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker