RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

Functions to start and end scenes

Started by gerkrt, October 01, 2011, 05:28:38 PM

0 Members and 1 Guest are viewing this topic.

gerkrt

This is a very small script that automatizes the start and end of X type of scenes.
You have a start and end scene that call commons events, and active a optional
switch, that you can use to know if in scene or not.

Code (text) Select
=begin
#==============================================================================
# Functions to start and end scenes
# By gerkrt/gerrtunk
# Version: 1.1
# License: MIT, credits
# Date: 30/09/2011
# Look here for updates or more scripts:
# http://usuarios.multimania.es/kisap/english_list.html
#==============================================================================


This is a very small script that automatizes the start and end of X type of scenes.
You have a start and end scene that call commons events, and active a optional
switch, that you can use to know if in scene or not.

Example call script:

st_scene 7

Call common event configurated to start scene and active switch 7

end_scene 7

Call common event configurated to end scene and desactive switch 7

-You can use the short alias for each one: s_s and e_s, work equals.
-Note that the switch id is optional. If no pased don touch nothing.

end_scene

=end

module Wep
  Event_start_scene = 6 # Common event id that start scene
  Event_end_scene = 7 # Common event id that end scene
end

class Interpreter
 
  #--------------------------------------------------------------------------
  # * Start cutscene   
  #--------------------------------------------------------------------------
  def st_scene(sw_id=nil)
    $game_switches[sw_id] = true if sw_id != nil
    $game_temp.common_event_id = Wep::Event_start_scene
    # Refresh map
    $game_map.need_refresh = true
  end
 
  #--------------------------------------------------------------------------
  # * Start cutscene(short alias) 
  #--------------------------------------------------------------------------
  def s_s(sw_id=nil)
    st_scene(sw_id)
  end
 
 
  #--------------------------------------------------------------------------
  # * End cutscene   
  #--------------------------------------------------------------------------
  def end_scene(sw_id=nil)
    $game_switches[sw_id] = false if sw_id != nil
    $game_temp.common_event_id = Wep::Event_end_scene
    # Refresh map
    $game_map.need_refresh = true
  end
 
  #--------------------------------------------------------------------------
  # * End cutscene(short alias) 
  #--------------------------------------------------------------------------
  def e_s(sw_id=nil)
    end_scene(sw_id)
  end
 
end



module Wep
  Scripts_list = [] unless defined? Scripts_list
  Scripts_list.push ('Functions to start and end scenes')
end