Kain Nobel
Member
-Introduction-
-Instructions-
-Call Script Information-
-Screenshots-
-Materials-
-The Script-
-Credits-
Kain Nobel, and Samot for the idea.
This script was written as a request for my good friend Samot! What it is, it simply shows an image while a message is being displayed, you could use it just for a snazzy visual effect whenever and wherever you want, and enable/disable it with ease.
Also good for people who have a hard to read font, or hate using windowskins. The image's display is above the map and below the message , so with a slightly dark image the message will stand out better from the map.
Also good for people who have a hard to read font, or hate using windowskins. The image's display is above the map and below the message , so with a slightly dark image the message will stand out better from the map.
-Instructions-
Place this script above main and below the SDK if you're using it. You must place an image in the Graphics/Windowskins directory, and name it whatever, just as long as the name defined in the script and the name of the image are the same.
Also, I wrote it for Samot, so you can change the module name "Samot" to whatever you want, or remove it, and the extra 'end' on the module.
Also, I wrote it for Samot, so you can change the module name "Samot" to whatever you want, or remove it, and the extra 'end' on the module.
-Call Script Information-
Msg_Back::Enabled = true/false (enables/disables image in-game)
Msg_Back::Image = "Message_Back" (changes graphic image in-game)
Msg_Back::Opacity = 0...255 (changes image opacity in-game)
Msg_Back::Transition = 0...9+ (changes transition time to fade in/out image)
Msg_Back::Tone = Tone.new(0, 0, 0, 0) (Changes screen color tone temporarily during message)
Msg_Back::Image = "Message_Back" (changes graphic image in-game)
Msg_Back::Opacity = 0...255 (changes image opacity in-game)
Msg_Back::Transition = 0...9+ (changes transition time to fade in/out image)
Msg_Back::Tone = Tone.new(0, 0, 0, 0) (Changes screen color tone temporarily during message)
-Screenshots-
http://i224.photobucket.com/albums/dd288/Kain_Nobel/MsgbackScript.png[/img]
http://i224.photobucket.com/albums/dd28 ... Script.png[/img]
http://i224.photobucket.com/albums/dd28 ... Script.png[/img]
-Materials-
Message_Back[0] # Top Position
http://i224.photobucket.com/albums/dd28 ... _Back0.png[/img]
Message_Back[1] # Middle Position
http://i224.photobucket.com/albums/dd28 ... _Back1.png[/img]
Message Back[2] # Bottom Position
http://i224.photobucket.com/albums/dd28 ... _Back2.png[/img]
http://i224.photobucket.com/albums/dd28 ... _Back0.png[/img]
Message_Back[1] # Middle Position
http://i224.photobucket.com/albums/dd28 ... _Back1.png[/img]
Message Back[2] # Bottom Position
http://i224.photobucket.com/albums/dd28 ... _Back2.png[/img]
-The Script-
Code:
#===============================================================================
# ~** Message Back Image : Top / Middle / Bottom **~
#-------------------------------------------------------------------------------
# Written by : Kain Nobel
# Version : 2.0
# Updated : 07/08/2008
# Created : 06/30/2008
#===============================================================================
# * Special Thanks : Samot for origional "Message_Back" image.
#===============================================================================
# ** Instructions **
#-------------------------------------------------------------------------------
# Requires an image in the windowskin folder, the name must be the same
# as what you've defined in the Msg_Back module. By default, the image that
# comes with this script is already pre-transparent even with opacity 255.
#-------------------------------------------------------------------------------
# This version of the script requires 3 images, you can name them whatever
# you want, but they are indexed like so...
#
# o "Message_Back[0]" => Message at Top
# o "Message_Back[1]" => Message in Middle
# o "Message_Back[2]" => Message at Bottom
#
# But when named in the module, just name it like "Message_Back", don't
# include the [#] with it, this process is automatic.
#-------------------------------------------------------------------------------
# This script aliases the following methods.
# * Scene_Map, main
# * Scene_Map, update
#-------------------------------------------------------------------------------
# This script creates the following methods.
# * Scene_Map, setup_msg_backs
# * Scene_Map, update_msg_backs
# * Scene_Map, msgback_fade_in
# * Scene_Map, msgback_fade_out
#===============================================================================
# ** Customizable Module ;)
#-------------------------------------------------------------------------------
# Enable/Disable the message back within this module, and pick the name of
# the image you want to use for your message back.
#===============================================================================
module Msg_Back
Enabled = true
Image = "Message_Back"
Opacity = 255
Transition = 10
Tone = Tone.new(-96, -96, -96, 0)
end
#===============================================================================
# ** Scene_Map
#-------------------------------------------------------------------------------
# Enhanced to show an image behind the message window.
#===============================================================================
class Scene_Map
#-----------------------------------------------------------------------------
alias_method :kn_msgback_scene_map_main, :main
alias_method :kn_msgback_scene_map_update, :update
#-----------------------------------------------------------------------------
# * Main Method (*Aliased*)
#-----------------------------------------------------------------------------
def main
# Setup Message Back script
setup_msg_backs
# Aliased Method call for Scene_Map's "main" method.
kn_msgback_scene_map_main
# Then, after the loop do visible in origional method,
# You must dispose of the Message Back image.
for i in 0...@msg_back.size
@msg_back[i].dispose
end
end
#-----------------------------------------------------------------------------
# * Update
#-----------------------------------------------------------------------------
def update
# Aliased Method call for Scene_Map's "update" method.
kn_msgback_scene_map_update
# If Message Window is Showing
if Msg_Back::Enabled
unless $game_system.message_position.nil?
@pos = $game_system.message_position
end
update_msg_backs
end
end
#-----------------------------------------------------------------------------
# * Create Message Backs
#-----------------------------------------------------------------------------
def setup_msg_backs
# Create Msg_Back Images, by default they're not visible.
@msg_back = [Sprite.new, Sprite.new, Sprite.new]
# Create script-specific variables
@tone = $game_screen.tone
@fade = (Msg_Back::Opacity / Msg_Back::Transition)
for i in 0...@msg_back.size
@blank = RPG::Cache.windowskin("")
@filename = RPG::Cache.windowskin(Msg_Back::Image + "[#{i}]") rescue @blank
@msg_back[i].bitmap = @filename
@msg_back[i].opacity = 0
@msg_back[i].z = 550
@msg_back[i].visible = false
end
end
#-----------------------------------------------------------------------------
# * Update Message Back
#-----------------------------------------------------------------------------
def update_msg_backs
if $game_temp.message_window_showing ; msgback_fade_in
else ; msgback_fade_out
end
end
#-----------------------------------------------------------------------------
# * Memorize Msg Tone
#-----------------------------------------------------------------------------
def msgback_fade_in
# Set Msg Back image to visible
@msg_back[@pos].visible = true
# Fade in Msg Back image
unless @msg_back[@pos].opacity == Msg_Back::Opacity
@msg_back[@pos].opacity += @fade
end
# Fade screen to desired tone
unless $game_screen.tone == Msg_Back::Tone
$game_screen.start_tone_change(Msg_Back::Tone, 0)
end
end
#-----------------------------------------------------------------------------
# * Recall Origional Tone
#-----------------------------------------------------------------------------
def msgback_fade_out
# Fade out Msg Back image
unless @msg_back[@pos].opacity == 0 ; @msg_back[@pos].opacity -= @fade
else ; @msg_back[@pos].visible = false
end
# Restore origional Screen Tone
unless $game_screen.tone == @tone
$game_screen.start_tone_change(@tone, 0)
end
end
end
-Credits-
Kain Nobel, and Samot for the idea.