6 hours ago
(This post was last modified: 5 hours ago by DerVVulfman.)
DerVV's Tutorial Windows
Version: 1.0
Version: 1.0
Introduction
This system allows you to create pop-up windows designed to give the player quick gameplay instructions, whether it be simple movement instructions or more complex guides for devices, system mechanics or minigames.
Being in-game tutorials, the window(s) will not close without player input.
The system is designed to let game developers use both map events or troop database events (such as inserted into Turn 0). However, it is possible to adapt game mechanic scripts (lockpicking, quest system, etc) to include the tutorial system and allow pop-up help to appear upon their first execution.
Features
- Creates a window of custom size to display helpful text
- Uses a text system similar to the message window
- Track if a tutorial had already shown and prevent re-appearance
- Instructions include how to inert into other custom scripts in need
Script
TUT HERE
Code:
#==============================================================================
# ** DerVV's Tutorial Windows
#------------------------------------------------------------------------------
# by DerVVulfman
# version 1.0
# 07-01-2026 (mm/dd/yyyy)
# RGSS / RPGMaker XP
#==============================================================================
#
# INTRODUCTION:
#
# This system allows you to create pop-up windows designed to give the player
# quick gameplay instructions, whether it be simple movement instructions or
# more complex guides for devices, system mechanics or minigames.
#
# Being in-game tutorials, the window(s) will not close without player input.
#
# The system is designed to let game developers use both map events or troop
# database events (such as inserted into Turn 0). However, it is possible to
# adapt game mechanic scripts (lockpicking, quest system, etc) to include the
# tutorial system and allow pop-up help to appear upon their first execution.
#
#
#------------------------------------------------------------------------------
#
# INSTALLATION:
#
# Place this script below Scene_Debug and above Main. Create a new Tutorials
# subfolder within the project's Graphics folder if you plan to use graphic
# images instead of basic text.
#
# IE: Graphics\Tutorials
#
#
#------------------------------------------------------------------------------
#
# CONFIGURATION:
#
# The TutWindow module is where the game developer defines the basic settings
# for all, or most all, tutorial windows. It is divided into two sections;
# the Fixed Values section and the Flexible Values section.
#
# Fixed Values are the settings for the fonts used within all tutorial win-
# dows and the vertical spacing for each line of text. There are no methods
# to change these settings, and that is by intent as it is assumed that the
# tutorial windows all share a matching and uniform appearance.
#
# * FONTNAME: Here, the game deveoper sets either the font or an array
# of fonts used within the tutorial window. If an array is
# used, the system will use the first within the array that
# functions on the player's PC. Or, it can be set to 'nil'
# to use the default system font.
#
# * FONTNAME: Here, the game developer may set the size of the font in
# use, or can be set to 'nil' to use the 22pt standard.
#
# * LINEHEIGHT: This setting controls the vertical height for every line
# that appears within the tutorial window. If set to 'nil',
# it uses the default setting of 32px.
#
# Flexible Values are basic settings for every tutorial window, though these
# may be temporarily changed by the use of script calls. As such, the game
# developer can change the placement of tutorial windows or define how trans-
# parent the windows may be.
#
# * TUTORIAL_RECT: This sets the default placement and size of the tuto-
# tial window itself. Unlike all other values defined in
# configuration section, it cannot be set to nil.
#
# * OPACITY: This value sets the opacity or transparency level of
# the tutorial window. If it is set to nil, the opacity
# of the window will be a solid 255.
#
# * WINDOWSKIN: This value allows the use of a separate windowskin for
# the tutorial window rather than the default skin used
# for the default menus. Still, this may be set to 'nil'
# if the default skin is desired.
#
#
#------------------------------------------------------------------------------
#
# SCRIPT CALLS - SETTING A TUTORIAL:
#
# Once installed, the game developer can immediately create a tutorial. This
# tutorial is a pop-up window giving instructions to the player, and may come
# to be as either text or as an image/graphics file. And both are relatively
# simple to design.
#
#
# * SET TUTORIAL WITH TEXT
#
# Syntax: set_tutorial_text(text)
#
# That one method is the essential command to pass text into the Tutorial
# system. And the moment this method is executed, the Tutorial Window will
# appear. Note that the text itself is basically the same type of text that
# is used in a [SHOW TEXT] message window event, though stripped down.
#
# * Color: To set the color of the text, you use \\C[#] rather than \C[#].
# I don't understand why it cannot use \C[#] alone, but "It just works",
# to quote Todd Howard. And it still uses value 0-7 to set the colors.
#
# * Line Break: The [SHOW TEXT] event adds line breaks to the text entered
# into its text entry window. However, the developer must manually add
# their own line breaks so text will end on one line and advance to the
# next. To do this, you use the \n code.
#
# EXAMPLE (Used in a map's parallel process):
#
# @>Wait: 1 frame(s)
# @Script: my_text = "\\c[6]Tutorial:\n\n"+
# : : "\\c[0]This is my example."
# : : set_tutorial_text(my_text)
#
# This doesn't change the size of the tutorial window, only adding the two
# lines of text with a blank line in between, and the first line in yellow.
# This system allows you to create pop-up windows designed to give the play
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# * SET TUTORIAL WITH GRAPHICS
#
# Syntax: set_tutorial_image(filename)
#
# Similar in appearance, this method is used to display an image within the
# tutorial window. And the moment it is executed, the window will appear.
# The graphic image MUST be within the 'Graphics\Tutorials' subfolder.
#
# EXAMPLE (Used in a map's parallel process):
#
# @>Wait: 1 frame(s)
# @Script: set_tutorial_text("TestTutScreen")
#
# This will immediately load a graphic image named "TestTutScreen" found in
# the Graphics\Tutorials subfolder and immediately display it. That's it!
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Do note, you will want a '1-frame' delay before calling either command if
# it is being executed by a parallel process event that immediately runs
# the moment a map loads. The delay is not needed if the map event executed
# is an 'auto-run' event.
#
# Do note that the area of the tutorial window must be both 32px wider and
# taller than the image file itself as RMXP windows have a 16px border on
# all sides. A graphic that is 200x150px would need a 232x182px window.
#
#
#------------------------------------------------------------------------------
#
# SCRIPT CALLS - TEMPORARY SETTINGS:
#
# Obviously, not every tutorial pop-up are equal. A game developer may devise
# a tutorial describing the controls for an NPC in order to navigate through
# a lethal obstacle course which may include dash and jump buttons. However,
# the game developer may wish a small screen to appear to let the player know
# to use the arrow buttons to move the character.
#
# To this, three script calls were created to temporarily chagne the appear-
# ance of the tutorial window. Blatantly temporary, the settings erase imme-
# diately after they are executed. And these script calls must be used before
# the tutorials are shown.
#
# * SET THE AREA
# Syntax: set_tutorial_area = array
# This command asks for a four-parameter array that defines the
# x-coordinate, y-coordinate, width and height of the window. If
# used for an image tutorial, both the width and height needs to
# be 32px larger to accommodate the 16px border on all sides.
#
# * SET THE OPACITY
# Syntax: tutorial_opacity = value
# This asks for a value from 0-255, setting how solid or trans-
# parnt the window (or image file) will appear.
#
# * SET THE WINDOWSKIN
# Syntax: set_tutorial_skin = value
# This asks for an alternative windowskin name, the skin being
# within the Graphics\Windowskins folder. The windowskin will
# not appear if a Graphic Image tutorial is being used.
#
#
#==============================================================================
#
# SPECIAL!
# INTEGRATION INTO OTHER SCRIPTS:
#
# If you want to include the Tutorial System as an optional feature in your
# own custom system, its not that hard to include. There are just four steps.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Step 1: Setting your OWN tutorial window appearances
#
# Whether you have a custom configuration module for your custom system or
# not, you will want to have four custom constants. These will set the opa-
# city, size and shape, windowskin and obviously the 'TEXT' of the tutorial
# window for your script.
#
# Let's assume that you have a script that deals with unlocking doors based
# on random chance and type of lockpick (I'm going good old Morrowind here).
# You may have a configuration module with the name MorrowLocks. If so, just
# add the three Configuration values like so:
#
# module MorrowLocks
# #----------------------------------------------------------
# TUTORIAL_RECT = [80,96,480,288]
# TUTORIAL_OPACITY = 220
# TUTORIAL_WINDOWSKIN = nil
# TUTORIAL_TEXT = "\\c[4]My Tutorial:\n\\c[0]Hi there."
# #----------------------------------------------------------
# end
#
# Of course, my tutorial text is pretty short. For a real tutorial text, it
# would be quite a bit larger
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Step 2: Making auto-detect and tutorial read variables
#
# You want the tutorial to only show once when you first try your custom
# feature. So yeah, that is going to need a custom switch that is recorded
# within the save game file.
#
# For those developing their own systems, I offer a test to determine if
# the Tutorial system is even running. So their own custom systems may be
# able to run with or without the tutorial script in place.
#
# Ergo, If the Morrowind Lockpick system is in use but the Tutorial system
# isn't... it won't crash after trying to run its methods. ^_^
#
# Let's assume that you have a script that deals with unlocking doors based
# For this, you'll need to add new values to Game_System, one for the auto-
# detection switch and the other for the tutorial shown switch. And it may
# look as simple as this:
#
# class Game_System
# #----------------------------------------------------------
# attr_accessor :tutorial_detected
# attr_accessor :tutorial_lockpick
# #----------------------------------------------------------
# alias morrowlocks_game_system_initialize initialize
# #----------------------------------------------------------
# def initialize
# morrowlocks_game_system_initialize
# @tutorial_detected = false
# @tutorial_lockpick = false
# if Interpreter.method_defined? "set_tutorial_text"
# @tutorial_detected = true
# end
# end
# #----------------------------------------------------------
# end
#
# You will notice the [if Interpreter.method_defined? "set_tutorial_text"]
# line. This will test the system to see if the Tutorial System is in the
# project.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Step 3: Getting the Tutorial window to show
#
# When you run your custom... Morrowind Lockpick... system, it obvious exe-
# cutes from a custom "Scene_" code. Whether your custom Scene displays an
# informative window (like Scene_Item) or not, you will want something like
# this added to the mix.
#
# #----------------------------------------------------------
# def main_windows_tutorial
# # Reset tutorial flag if no tutorial script used
# if $game_system.tutorial_detected == false
# $game_system.tutorial_lockpick = true
# return
# end
# # Exit if tutorial already shown
# if $game_system.tutorial_lockpick
# return
# end
# # Get configurables
# x = MorrowLocks::TUTORIAL_RECT[0]
# y = MorrowLocks::TUTORIAL_RECT[1]
# wd = MorrowLocks::TUTORIAL_RECT[2]
# ht = MorrowLocks::TUTORIAL_RECT[3]
# opa = MorrowLocks::TUTORIAL_OPACITY
# skin = MorrowLocks::TUTORIAL_WINDOWSKIN
# text = MorrowLocks::TUTORIAL_TEXT
# # Exit if there's no text (like... really?)
# if text.nil?
# $game_system.tutorial_lockpick = true
# return
# end
# # First set the temp opacity and skin values
# $game_temp.tut_temp_window_opacity = opa
# $game_temp.tut_temp_window_skin = skin
# # Finally... make the window and set the text
# @tut_window = Window_Tutorial.new(x, y, wd, ht)
# @tut_window.refresh(text)
# end
# #----------------------------------------------------------
#
# This is the basis for creating the window, checking to see if you have
# the tutorial script running, seeing if the tutorial even shown and then
# loading the configuration values before actively generating the window
# itself.
#
# Once this is inserted, you merely add the 'main_windows_tutorial' state-
# ment around the start of your Scene's 'main' method (or 'main_windows'
# method if using the SDK). You may want it to be placed after all other
# windows or graphics are shown, but before the loop begins.
#
# There are only two things here that would change. The first change would
# be the seven lines under "Get configurables" to align with your custom
# script's config.
#
# The second thing to change would be if you wanted to show an image file
# rather than text. In that case, the final line would read:
#
# #----------------------------------------------------------
# @tut_window.refresh(text, true)
# #----------------------------------------------------------
#
# The second value in the refresh method is defaulted to 'false', so its
# not necessary if showing basic text. But here, we are passing 'true' into
# the second parameter to inform the system that a graphic file is in use.
#
# Ergo, the TUTORIAL_TEXT value within the config section is actually sup-
# plying the filename in the graphic file in Graphics\Tutorials.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Step 4: Updating and closing the Tutorial window
#
# Believe it or not, this is not big or long at all. And first, another
# premade little present to be added to your Scene code:
#
# #----------------------------------------------------------
# def update_tutorial?
# if $game_system.tutorial_lockpick
# return true
# end
# return false unless Input.trigger?(Input::C)
# Input.update
# $game_system.tutorial_lockpick = true
# @tut_window.dispose
# return true
# end
# #----------------------------------------------------------
#
# The above method only runs if the tutorial window is actively showing,
# and waits for the player to press any DECISION key (Enter/Space). After
# that, it runs the "Input.update" statement to clear the input system,
# lest any further player input affects the system.
#
# After that, it sets the flag to the tutorial as having finally shown,
# disposes of the tutorial window, and exit.
#
# And once that's done, just add the "update_tutorial?" method as a test at
# the start of your update method like so:
#
# #----------------------------------------------------------
# def update
# return unless update_tutorial?
# (ALL OF YOUR UPDATE CODE)
# end
# #----------------------------------------------------------
#
# This will stop all actions of your update method while the tutorial win-
# dow is visible.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# And that's really it. You just need to add:
#
# 1) The configuration values
# 2) The switches within Game_System
# 3) The 'main_windows_tutorial' method in your Scene code, and having it run
# 4) The 'update_tutorial?' method in Scene code and having it placed at the
# start of update.
#
#
#==============================================================================
#
# COMPATIBILITY:
#
# Compatible with RPGMaker XP default scripts. The only default scripts within
# are aliased content.
#
#------------------------------------------------------------------------------
#
# TERMS OF USE:
#
# Free for use, even in commercial games. Only due credit is required.
#
#
#==============================================================================
module TutWindow
# FIXED VALUES
# ============
# These values define the fonts used in all tutorial windows. The display is
# considered static for all tutorials for a project for continuity.
#
FONTNAME = nil # Font name (or array of fonts) or nil
FONTSIZE = nil # Size of the font used, or nil
LINEHEIGHT = nil # Vertical height of each line, or nil
# FLEXIBLE VALUES
# ===============
# These values define the shape and visual appearance of the tutorial windows.
# They allow for customization so they'll work with various in-game mechanics,
# and be adaptable to custom plugins actively using the Tutorial system.
#
TUTORIAL_RECT = [80, 304, 480, 160] # Rectangle area of the window
OPACITY = 120 # Opacity of the window back area
WINDOWSKIN = nil # Custom windowskin in use
end
#==============================================================================
# ** RPG::Cache
#------------------------------------------------------------------------------
# The module that loads each of RPGXP's graphic formats, creates a Bitmap
# object, and retains it.
#==============================================================================
module RPG::Cache
#------------------------------------------------------------------------
# * Tutorial Screen
# filename : filename of the cached bitmap
#------------------------------------------------------------------------
def self.tutorial(filename)
begin
self.load_bitmap("Graphics/Tutorials/", filename)
rescue
self.load_bitmap("Graphics/Tutorials/", "")
end
end
end
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# Refer to "$game_temp" for the instance of this class.
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :tut_temp_window_opacity # Temporary window back opacity
attr_accessor :tut_temp_window_skin # Temporary window skin
attr_accessor :tut_temp_window_rect # Temporary window area defined
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
alias game_temp_tutorial_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
#
game_temp_tutorial_initialize # Run the original method
@tut_temp_window_opacity = nil # Temporary opacity reset
@tut_temp_window_skin = nil # Temporary skin reset
@tut_temp_window_rect = nil # Temporary area reset
#
end
end
#==============================================================================
# ** Window_Tutorial
#------------------------------------------------------------------------------
# This window is used to display in-game tutorials.
#==============================================================================
class Window_Tutorial < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
#
super(x, y, width, height) # Superclass method
self.contents = Bitmap.new(width-32, height-32) # Create the contents area
self.z = 9998 # Set z-depth to near max
self.pause = false # Remove any pause glyph
#
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
#
super # Use superclass method
#
end
#--------------------------------------------------------------------------
# * Refresh
# text : text to display
# type : (true/false) is image?
#--------------------------------------------------------------------------
def refresh(text=nil, type=false)
#
if text.nil? # If passing nil text
self.visible = false # Hide the window
return # Exit the method
end
#
if type == true # If tutorial is an image
refresh_image(text) # Use image option
return # Exit the method
end
#
refresh_message(text) # Show text tutorial
#
end
#--------------------------------------------------------------------------
# * Refresh Image
# file : filename
#--------------------------------------------------------------------------
def refresh_image(file)
#
self.contents.clear # Clear the drawing area
self.opacity = 0 # Remove opacity
#
bitmap = RPG::Cache.tutorial(file) # Get the tutorial bitmap
self.contents = bitmap # Bitmap becomes contents
#
opa = 255 # Assume solid opacity
unless TutWindow::OPACITY.nil? # If defined opacity
opa = TutWindow::OPACITY # Use defined opacity
end
unless $game_temp.tut_temp_window_opacity.nil? # If temp opacity exists
opa = $game_temp.tut_temp_window_opacity # Get temp opacity
end
self.contents_opacity = opa # Use on image contents
#
end
#--------------------------------------------------------------------------
# * Refresh Message
# text : text to display
#--------------------------------------------------------------------------
def refresh_message(text=nil)
#
refresh_contents # Refresh the drawing area
text.strip! # Remove excess spaces
#
lnht = 32 # Set default line height
unless TutWindow::LINEHEIGHT.nil? # If a custom line height?
lnht = TutWindow::LINEHEIGHT # Set custom line height
end
#
x = y = 0 # Set text coords to start
text.gsub!(/\\\\/) { "\000" } # Change "\\\\" to "\000"
text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]"} # Change \\C to "\001"
while ((c = text.slice!(/./m)) != nil) # Loop 1 char at a time
#
c = "\\" if c == "\000" # Use original text if \\
#
if c == "\001" # If \C[n] (Color code)
text.sub!(/\[([0-9]+)\]/, "") # Get substitution value
color = $1.to_i # Set value as color
if color >= 0 and color <= 7 # Only if in range
self.contents.font.color = text_color(color)# Use that set color
end
next # Then skip to next text
end
#
if c == "\n" # If new line text
x = 0 ; y += 1 # Reset to next line
next # Then skip to next text
end
#
self.contents.draw_text(4+x,lnht*y,40,lnht,c) # Draw character
x += self.contents.text_size(c).width # Add to drawn text width
#
end
#
end
#--------------------------------------------------------------------------
# * Refresh Contents
#--------------------------------------------------------------------------
def refresh_contents
#
self.contents.clear # Clear the drawing area
self.contents.font.color = normal_color # Set normal font color
#
font = Font.default_name # Assume default font
unless TutWindow::FONTNAME.nil? # If a custom font defined
font = TutWindow::FONTNAME # Get custom font
end
self.contents.font.name = font # Set the font
#
size = Font.default_size # Assume default size
unless TutWindow::FONTSIZE.nil? # If a custom size defined
size = TutWindow::FONTSIZE # Get custom size
end
self.contents.font.size = size # Set the size
#
skin = $game_system.windowskin_name # Assume system windowskin
unless TutWindow::WINDOWSKIN.nil? # If defined windowskin
skin = TutWindow::WINDOWSKIN # Use defined windowskin
end
unless $game_temp.tut_temp_window_skin.nil? # If temp skin exists
skin = $game_temp.tut_temp_window_skin # Get temp windowskin
end
self.windowskin = RPG::Cache.windowskin(skin) # Use windowskin
#
opa = 255 # Assume solid opacity
unless TutWindow::OPACITY.nil? # If defined opacity
opa = TutWindow::OPACITY # Use defined opacity
end
unless $game_temp.tut_temp_window_opacity.nil? # If temp opacity exists
opa = $game_temp.tut_temp_window_opacity # Get temp opacity
end
self.back_opacity = opa # Use opacity
#
$game_temp.tut_temp_window_skin = nil # Erase temp skin
$game_temp.tut_temp_window_opacity = nil # Erase temp opacity
#
end
end
#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
# This interpreter runs event commands. This class is used within the
# Game_System class and the Game_Event class.
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# * Set Tutorial Text from map or battle event
#--------------------------------------------------------------------------
def set_tutorial_text(text)
#
effective = false # Assume invalid scene
effective = true if $scene.is_a?(Scene_Map) # Test if in the map
effective = true if $scene.is_a?(Scene_Battle) # Test if in battle
return unless effective # Exit if not valid
$scene.set_tutorial(text) # Set into the scene
#
end
#--------------------------------------------------------------------------
# * Set Tutorial Image from map or battle event
#--------------------------------------------------------------------------
def set_tutorial_image(text)
#
effective = false # Assume invalid scene
effective = true if $scene.is_a?(Scene_Map) # Test if in the map
effective = true if $scene.is_a?(Scene_Battle) # Test if in battle
return unless effective # Exit if not valid
$scene.set_tutorial(text, true) # Set into the scene
#
end
#--------------------------------------------------------------------------
# * Set Tutorial Area
#--------------------------------------------------------------------------
def set_tutorial_area(array_val)
#
return unless array_val.is_a?(Array) # Exit if not an array
return unless array_val.size == 4 # Exit if params incorrect
$game_temp.tut_temp_window_rect = array_val # Set into temp array
#
end
#--------------------------------------------------------------------------
# * Set Tutorial Opacity
#--------------------------------------------------------------------------
def set_tutorial_opacity(value)
#
return unless value.is_a?(Integer) # Exit if not an integer
return if value < 0 # Exit if out of range
return if value > 255 # Exit if out of range
$game_temp.tut_temp_window_opacity = value # Set into temp value
#
end
#--------------------------------------------------------------------------
# * Set Tutorial Windowskin
#--------------------------------------------------------------------------
def set_tutorial_skin(value)
#
return unless value.is_a?(String) # Exit if not text
$game_temp.tut_temp_window_skin = value # Set into temp value
#
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias scene_map_tutorial_main main
alias scene_map_tutorial_update update
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
#
main_tutorial_window # Load the custom window
scene_map_tutorial_main # Run the original method
main_tutorial_dispose # Dispose of the window
#
end
#--------------------------------------------------------------------------
# * Main Processing (Loading custom window)
#--------------------------------------------------------------------------
def main_tutorial_window
#
x = TutWindow::TUTORIAL_RECT[0] # Get the x/y/width/height
y = TutWindow::TUTORIAL_RECT[1] # Of the tutorial window
wd = TutWindow::TUTORIAL_RECT[2]
ht = TutWindow::TUTORIAL_RECT[3]
#
@tut_window = Window_Tutorial.new(x,y,wd,ht) # Create with dimensions
@tut_window.visible = false # Set the window invisible
#
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def main_tutorial_dispose
#
@tut_window.dispose # Dispose the window
#
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
#
if @tut_window.visible == true # If the window is active
return update_tutorial # Exit with the custom update
end
#
scene_map_tutorial_update # Run the original method
#
end
#--------------------------------------------------------------------------
# * Frame Update (When testing for player input to exit tutorial screen)
#--------------------------------------------------------------------------
def update_tutorial
#
return if !Input.trigger?(Input::C) # Exit if Enter isn't pressed
#
@tut_window.visible = false # Set the window invisible
#
end
#--------------------------------------------------------------------------
# * Set Tutorial
# text : text passed into the tutorial window
# type : (true/false) if the text is a tutorial image filename
#--------------------------------------------------------------------------
def set_tutorial(text=nil, type=false)
#
set_tutorial_area # Redraw area each instance
@tut_window.refresh(text, type) # Pass tutorial into window
@tut_window.visible = true # Set the window active
#
end
#--------------------------------------------------------------------------
# * Set Tutorial Contents Area
#--------------------------------------------------------------------------
def set_tutorial_area
#
array_val = TutWindow::TUTORIAL_RECT # Assume default window
unless $game_temp.tut_temp_window_rect.nil? # If a temporary area defined
array_val = $game_temp.tut_temp_window_rect # Use the temporary area
end
$game_temp.tut_temp_window_rect = nil # Erase the temporary area
@tut_window.x = array_val[0] # Set x-coordinates
@tut_window.y = array_val[1] # Set y-coordinates
width = array_val[2] # Get window width
height = array_val[3] # Get window height
@tut_window.width = width # Set window width
@tut_window.height = height # Set window height
#
# Reset the window content area
@tut_window.contents = Bitmap.new(width - 32, height - 32)
#
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias scene_battle_tutorial_main main
alias scene_battle_tutorial_update update
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
#
main_tutorial_window # Load the custom window
scene_battle_tutorial_main # Run the original method
main_tutorial_dispose # Dispose of the window
#
end
#--------------------------------------------------------------------------
# * Main Processing (Loading custom window)
#--------------------------------------------------------------------------
def main_tutorial_window
#
x = TutWindow::TUTORIAL_RECT[0] # Get the x/y/width/height
y = TutWindow::TUTORIAL_RECT[1] # Of the tutorial window
wd = TutWindow::TUTORIAL_RECT[2]
ht = TutWindow::TUTORIAL_RECT[3]
#
@tut_window = Window_Tutorial.new(x,y,wd,ht) # Create with dimensions
@tut_window.visible = false # Set the window invisible
#
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def main_tutorial_dispose
#
@tut_window.dispose # Dispose the window
#
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
#
if @tut_window.visible == true # If the window is active
return update_tutorial # Exit with the custom update
end
#
scene_battle_tutorial_update # Run the original method
#
end
#--------------------------------------------------------------------------
# * Frame Update (When testing for player input to exit tutorial screen)
#--------------------------------------------------------------------------
def update_tutorial
#
return if !Input.trigger?(Input::C) # Exit if Enter isn't pressed
#
@tut_window.visible = false # Set the window invisible
#
end
#--------------------------------------------------------------------------
# * Set Tutorial
# text : text passed into the tutorial window
# type : (true/false) if the text is a tutorial image filename
#--------------------------------------------------------------------------
def set_tutorial(text=nil, type=false)
#
set_tutorial_area # Redraw area each instance
@tut_window.refresh(text, type) # Pass tutorial into window
@tut_window.visible = true # Set the window active
#
end
#--------------------------------------------------------------------------
# * Set Tutorial Contents Area
#--------------------------------------------------------------------------
def set_tutorial_area
#
array_val = TutWindow::TUTORIAL_RECT # Assume default window
unless $game_temp.tut_temp_window_rect.nil? # If a temporary area defined
array_val = $game_temp.tut_temp_window_rect # Use the temporary area
end
$game_temp.tut_temp_window_rect = nil # Erase the temporary area
@tut_window.x = array_val[0] # Set x-coordinates
@tut_window.y = array_val[1] # Set y-coordinates
width = array_val[2] # Get window width
height = array_val[3] # Get window height
@tut_window.width = width # Set window width
@tut_window.height = height # Set window height
#
# Reset the window content area
@tut_window.contents = Bitmap.new(width - 32, height - 32)
#
end
endInstructions
Built into the instructions
Compatibility
Compatible with RPGMaker XP default scripts. The only default scripts within are aliased content.
Author's Notes
The script is included within Two-Stage Crafting.
Terms and Conditions
Free for use, even in commercial games. Only due credit is required.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
Above are clickable links


![[Image: QrnbKlx.jpg]](https://i.imgur.com/QrnbKlx.jpg)
![[Image: sGz1ErF.png]](https://i.imgur.com/sGz1ErF.png)
![[Image: liM4ikn.png]](https://i.imgur.com/liM4ikn.png)
![[Image: fdzKgZA.png]](https://i.imgur.com/fdzKgZA.png)
![[Image: sj0H81z.png]](https://i.imgur.com/sj0H81z.png)
![[Image: QL7oRau.png]](https://i.imgur.com/QL7oRau.png)
![[Image: uSqjY09.png]](https://i.imgur.com/uSqjY09.png)
![[Image: GAA3qE9.png]](https://i.imgur.com/GAA3qE9.png)
![[Image: 2Hmnx1G.png]](https://i.imgur.com/2Hmnx1G.png)
![[Image: BwtNdKw.png%5B]](https://i.imgur.com/BwtNdKw.png%5B)