#last updated 3/6/2012
#credits to diagostimo
#comercial use prohibited
#-------------#
#beging config#
#-------------#
module Config
#notes when using this system:
#when making your background bear in mind that the window has an offset of 16
#pixles on all sides, this means that when the grids x and y are both 0 then
#they are actually 16 so always draw an image with a bordeline of 16 on all
#sides so it meets up with the grid properly
#also when setting the variable that controls the cursor position on the map,
#if you set it higher than the maximum index value of the map it will return
#0 when calling the scene.
#if you change the default grid settings then you will need to count how many
#index squares are on your grid, you can still use the index reference image as
#a reference, just note that it starts at 0 and increases linear
#setup how many grid squares wide and high the map is, the example used here
#gives it a width of 19 and a height of 14 in grid squares, this setup makes
#each square 32 by 32 pixles, say we double these values, so the width is 38
#and the height is 28, this will make each grid square 16 by 16 pixles comprende!
X_GRID = 19
Y_GRID = 14
# note if your grid is large then giving it an offset will make it go off screen
#this is intended for smaller grids
GRIDX_OFFSET = 0
GRIDY_OFFSET = 0
#this sets the total width for your grid, note the max width it can go is 608
#and the max height is 448, if you do set it higher then your map will simply go
#off the screen, your grid squares pixle size is also divided by these
#numbers, so say you set it to be 5 grid squares wide and the grid width is 608
#then a grid squares width is roughly 121, this is so you can make smaller grids
GRID_WIDTH = 608
GRID_HEIGHT = 448
#IMPORT ALL YOUR IMAGES TO THE PICTURES DIRECTORY!
#your main map's image name
MAP_NAME = 'map.png'
#here you can complete configure the text show when the cursor is at differnt
#locations on the map
#config whether you wish to use custom font, true or false
CUSTOM_FONT = false
#configure the name of the custom font
TEXT_FONT = 'Georgia'
#configure whether you wish to manually set the color of the text, true or false
CUSTOM_COLOR = true #when false default is white
# set the color of the text like so: [RED, GREEN, BLUE]min=0 max=255
SET_COLOR = [0, 0, 0]
#configure whether the text writen will be bold or not, true or false
BOLD_TEXT = true
#set the fonts size
FONT_SIZE = 25 #maximum size = 96
#set if you would like to use outlined text
OUTLINED_TEXT = true
#set if you would like to customize the color of the outline
OUTLINED_COLOR = true #when false default is black
# set the color of the outline: [red, green, blue]min=0 max=255
OUTLINED_COLOR_SET = [255, 255, 255]
#set to true to draw a box behind the text
TEXT_BACK = true
#set the color and opacity of the box
TEXT_BACK_COLOR = [255, 0, 0, 150]#[red, green, blue, opacity]
#set to true to give the box a border, only returns if back box = true
TEXT_BACK_BORDER = true #not functional
#set the color and opacity of the border
TEXT_BACK_BORDER_COLOR = [0, 0, 255, 255]#[red, green, blue, opacity]
#set to true to give the box a border
TEXT_BACK_BORDER = true #not functional
#set up the names that will be shown when the cursor is over locations,
#when 193 points at the index point of the map, refer to the index refernece
#image, config like so: when INDEX ID then [x, y , "TEXT"]
#just simply add a new line to configure a new location
#for index's not configured it will not return any text
def self.map_text(index)
return case index
when 193 then [6, 6, 'example text']
when 174 then [50, 50, 'example2 text']
#leave else, this returns no text if none is set
else ''
end
end
#here you configure the window that will show an image of the town you press
#the action button on
#define the windows [x, y, width, height] for your town images ect
WINDOW_SIZE = [112, 64, 416, 352]
#define the opacity of your towns windows(this does not effect the images)
#255=max, 0=min
WINDOW_OPACITY = 255
#configure the maps name that will be shown in the window, configure
#it exactly how you configured the text above, the index is set the same, it
#will show the text for the index point it is called from
def self.window_text(index)
return case index
when 193 then [30, 30, "example text"]
when 174 then [80, 50, "example text"]
#leave else, this returns no text if none is set
else ''
end
end
#config whether you wish to use custom font, true or false
W_CUSTOM_FONT = false
#configure the name of the custom font
W_TEXT_FONT = 'Georgia'
#configure whether you wish to manually set the color of the text, true or false
W_CUSTOM_COLOR = true #when false default is white
# set the color of the text like so: [RED, GREEN, BLUE]min=0 max=255
W_SET_COLOR = [0, 0, 0]
#configure whether the text writen will be bold or not, true or false
W_BOLD_TEXT = true
#set the fonts size
W_FONT_SIZE = 20 #maximum size = 96
#set if you would like to use outlined text
W_OUTLINED_TEXT = true
#set if you would like to customize the color of the outline
W_OUTLINED_COLOR = true #when false default is black
# set the color of the outline: [red, green, blue]min=0 max=255
W_OUTLINED_COLOR_SET = [255, 255, 255]
#set to true to draw a box behind the text
W_TEXT_BACK = true
#set the color and opacity of the box
W_TEXT_BACK_COLOR = [0, 0, 255, 100]#[red, green, blue, opacity]
#set to true to give the box a border, only returns if back box = true
W_TEXT_BACK_BORDER = true #not functional
#set the color and opacity of the border
W_TEXT_BACK_BORDER_COLOR = [255, 0, 0, 255]#[red, green, blue, opacity]
#to add a new image for an index point simply add a new line with the image's
#name E.G you want to add a image for index 0 you would add this:
#when 0 then 'IMAGE_NAME'
#where IMAGE_NAME is the name of the image to show, use the index reference
#image in the projects root folder for a reference of how the index is set-up
def self.image_name(index)
return case index
when 193 then 'pallettown.png'
when 174 then 'pallettown.png'
#leave else, this returns no window if no image is set
else ''
end
end
#set the [x, y, opacity] of the images, opacity max=255 min=0
IMAGE_XY = [0, 0, 255]
#set if tele window is enabled
#when the tele window is enabled a pre menu comes up before the map, asking if
#you wish to teleport or view location information
TELE_WINDOW = true
#below is the teleport setup, there are also script calls you can use to manipulate the
#teleport menu, here is a list of them:
#$game_system.tele_disabled = true #disables the teleport menu selection
#$game_system.tele_disabled = false #enables the teleport menu selection
#the following calls are used to disable individual locations:
#$game_system.telearray.push(193)
#the above disables teleporting to index 193 if it has a teleport method setup
#$game_system.telearray.delete(193)
#the above removes index 193 from the list of disabled locations
#end of script calls#
#setup teleport locations for index points: when INDEX then [id, x, y, direction]
#drections: 0 = retain, 2 = down, 4 = left, 6 = right, 8 = up
def self.tele_config(index)
return case index
when 155 then [3, 9, 7, 0]
when 174 then [2, 9, 7, 0]
when 193 then [1, 9, 7, 0]
#leave else, this disables teleporting at index's unasigned
else ''
end
end
#set if a custom sound should be played when teleporting
TELE_SOUND = true
#set the name of the sound file/this must be in the SE directory
#you may need to add the file extension depending on the format of the
#sound, i.e .mp3
TELE_NAME = '020-Teleport03'
end
#----------#
#END CONFIG#
#----------#
#==============================================================================
# * game system teleporting addons
#==============================================================================
class Game_System
attr_accessor :tele_disabled #tele menu disable
attr_accessor :telearray #tele array to disable individual tele's
alias teleinit initialize
def initialize
teleinit
@tele_disabled = false
@telearray = []
end
end
#==============================================================================
# Bitmap Addon (Outlined Text)
#==============================================================================
class Bitmap
#----------------------------------------------------------------------------
# draw_text_full
# x2 - x coordinate or rectangle
# y2 - y coordinate or text
# w2 - width or align
# h2 - height
# text2 - the text to be drawn
# a2 - align
# Draws outlines text.
#----------------------------------------------------------------------------
def draw_text_full(x2, y2, w2 = 0, h2 = 0, text2 = '', a2 = 0)
# set coordinates whether x2 is rectangle
if x2.is_a?(Rect)
x, y, w, h, text, a = x2.x, x2.y, x2.width, x2.height, y2, w2
else
x, y, w, h, text, a = x2, y2, w2, h2, text2, a2
end
# store font color
save_color = self.font.color.clone
# set font color to black
if Config::OUTLINED_COLOR == true
rgb = Config::OUTLINED_COLOR_SET
self.font.color = Color.new(rgb[0], rgb[1], rgb[2])
else
self.font.color = Color.new(0, 0, 0)
end
# draw outline
draw_text(x+1, y, w, h, text, a)
draw_text(x-1, y, w, h, text, a)
draw_text(x, y+1, w, h, text, a)
draw_text(x, y-1, w, h, text, a)
draw_text(x+1, y+1, w, h, text, a)
draw_text(x-1, y+1, w, h, text, a)
draw_text(x-1, y-1, w, h, text, a)
draw_text(x+1, y-1, w, h, text, a)
# restore font color
self.font.color = save_color
# draw normal text
draw_text(x, y, w, h, text, a)
end
end
#============================================================================
# ** Window_Map
#----------------------------------------------------------------------------
class Window_MapMenu < Window_Base
attr_reader :index
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
end
#-------------------------------------------------------------------------
# * def index
#-------------------------------------------------------------------------
def index=(index)
@index = index
# Update cursor rectangle
update_cursor_rect
refresh
end
#-------------------------------------------------------------------------
# * def refresh
#-------------------------------------------------------------------------
def refresh
ctext = Config.map_text(@index) # a will be our temporary array
if ctext == ''
self.contents.clear
else
self.contents.clear
if Config::CUSTOM_FONT == true
self.contents.font.name = Config::TEXT_FONT
end
if Config::CUSTOM_COLOR == true
rgb = Config::SET_COLOR
self.contents.font.color = Color.new(rgb[0], rgb[1], rgb[2])
end
if Config::BOLD_TEXT == true
self.contents.font.bold = true
end
size = Config::FONT_SIZE
self.contents.font.size = (size)
cx = contents.text_size(ctext[2]).width
tx = contents.text_size(ctext[2]).height
if Config::TEXT_BACK == true
if Config::TEXT_BACK_BORDER == true
rect = self.contents.text_size(ctext[2])
bc = Config::TEXT_BACK_BORDER_COLOR
#border right
highlight_rect = Rect.new(rect.x, rect.y, 2, rect.height + 8)
bitmap = Bitmap.new(highlight_rect.width, highlight_rect.height)
bitmap.fill_rect(highlight_rect.x, highlight_rect.y, highlight_rect.width, highlight_rect.height, Color.new(bc[0], bc[1], bc[2], bc[3]))
self.contents.blt(ctext[0] + rect.width + 4, ctext[1] - 4, bitmap, highlight_rect)
#border left
highlight_rect = Rect.new(rect.x, rect.y, 2, rect.height + 8)
bitmap = Bitmap.new(highlight_rect.width, highlight_rect.height)
bitmap.fill_rect(highlight_rect.x, highlight_rect.y, highlight_rect.width, highlight_rect.height, Color.new(bc[0], bc[1], bc[2], bc[3]))
self.contents.blt(ctext[0] - 6, ctext[1] - 4, bitmap, highlight_rect)
#border bottom
highlight_rect = Rect.new(rect.x, rect.y, rect.width + 12, 2)
bitmap = Bitmap.new(highlight_rect.width, highlight_rect.height)
bitmap.fill_rect(highlight_rect.x, highlight_rect.y, highlight_rect.width, highlight_rect.height, Color.new(bc[0], bc[1], bc[2], bc[3]))
self.contents.blt(ctext[0] - 6, ctext[1] + rect.height + 4, bitmap, highlight_rect)
#border top
highlight_rect = Rect.new(rect.x, rect.y, rect.width + 12, 2)
bitmap = Bitmap.new(highlight_rect.width, highlight_rect.height)
bitmap.fill_rect(highlight_rect.x, highlight_rect.y, highlight_rect.width, highlight_rect.height, Color.new(bc[0], bc[1], bc[2], bc[3]))
self.contents.blt(ctext[0] - 6, ctext[1] - 6, bitmap, highlight_rect)
#draw back box
bc = Config::TEXT_BACK_COLOR
highlight_rect = Rect.new(rect.x, rect.y, rect.width + 8, rect.height + 8)
bitmap = Bitmap.new(highlight_rect.width, highlight_rect.height)
bitmap.fill_rect(highlight_rect.x, highlight_rect.y, highlight_rect.width, highlight_rect.height, Color.new(bc[0], bc[1], bc[2], bc[3]))
self.contents.blt(ctext[0] - 4, ctext[1] - 4, bitmap, highlight_rect)
else
#draw back box
bc = Config::TEXT_BACK_COLOR
rect = self.contents.text_size(ctext[2])
highlight_rect = Rect.new(rect.x - 8, rect.y - 4, rect.width + 24, rect.height + 12)
bitmap = Bitmap.new(highlight_rect.width, highlight_rect.height)
bitmap.fill_rect(highlight_rect.x, highlight_rect.y, highlight_rect.width, highlight_rect.height, Color.new(bc[0], bc[1], bc[2], bc[3]))
self.contents.blt(ctext[0] - 16, ctext[1] - 8, bitmap, highlight_rect)
end
end
if Config::OUTLINED_TEXT == true
self.contents.draw_text_full(ctext[0], ctext[1], cx, tx, ctext[2])
else
self.contents.draw_text(ctext[0], ctext[1], cx, tx, ctext[2])
end
if Config::BOLD_TEXT == true
self.contents.font.bold = false
end
end
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
gswidth = Config::GRID_WIDTH / Config::X_GRID
gsheight = Config::GRID_HEIGHT / Config::Y_GRID
x = Config::GRIDX_OFFSET + @index % Config::X_GRID * gswidth
y = Config::GRIDX_OFFSET + @index / Config::X_GRID % Config::Y_GRID * gsheight
self.cursor_rect.set(x, y, gswidth, gsheight)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
telearray = []
# if enter is being pressed
if Input.trigger?(Input::C)
if Config::TELE_WINDOW == true
tele = Config.tele_config(@index)
if $tele == 0
if tele == ''
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
else
if $game_system.telearray.include?(@index)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
else
# Play decision SE
$game_system.se_play($data_system.decision_se)
#transfering is happening
$scene = Scene_Map.new
$game_temp.player_transferring = true
# Set player move destination
i = tele[0]
x = tele[1]
y = tele[2]
d = tele[3]
$game_temp.player_new_map_id = i
$game_temp.player_new_x = x
$game_temp.player_new_y = y
$game_temp.player_new_direction = d
# Prepare for transition
Graphics.freeze
# Set transition processing flag
#$game_temp.transition_processing = true
#$game_temp.transition_name = ""
Graphics.transition(20)
if Config::TELE_SOUND == true
# Play decision SE
Audio.se_play("Audio/SE/" + Config::TELE_NAME, 100, 100)
end
return false
end
end
else
name = Config.image_name(@index)
if name == ''
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
else
#Play decision SE
$game_system.se_play($data_system.decision_se)
$scene = Scene_Index.new(@index)
end
end
else
name = Config.image_name(@index)
if name == ''
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
else
#Play decision SE
$game_system.se_play($data_system.decision_se)
$scene = Scene_Index.new(@index)
end
end
end
# If right directional button is pushed
if Input.repeat?(Input::RIGHT)
# If directional button pressed down is not a repeat, or
# cursor is not positioned on the right edge
if Input.trigger?(Input::RIGHT) or
@index % Config::X_GRID < Config::X_GRID-1
# Move cursor to right
$game_system.se_play($data_system.cursor_se)
if @index % Config::X_GRID < Config::X_GRID-1
self.index += 1
end
end
# If left directional button is pushed
elsif Input.repeat?(Input::LEFT)
# If directional button pressed down is not a repeat, or
# cursor is not positioned on the left edge
if Input.trigger?(Input::LEFT) or
@index % Config::X_GRID > 0
# Move cursor to left
$game_system.se_play($data_system.cursor_se)
if @index % Config::X_GRID > 0
self.index -= 1
end
end
# If down directional button is pushed
elsif Input.repeat?(Input::DOWN)
# Move cursor down
if @index / Config::X_GRID < Config::Y_GRID-1
self.index += Config::X_GRID
$game_system.se_play($data_system.cursor_se)
end
# If up directional button is pushed
elsif Input.repeat?(Input::UP)
# Move cursor up
if @index / Config::X_GRID > 0
self.index -= Config::X_GRID
$game_system.se_play($data_system.cursor_se)
end
end
update_cursor_rect
end
end
#---------------------------------------------------------------------------
# * Scene Map_Menu
#---------------------------------------------------------------------------
class Scene_MapMenu
def initialize(index)
@index = index
end
#-------------------------------------------------------------------------
# * MAIN
#-------------------------------------------------------------------------
def main
#calculate the index value of the map
ival = Config::X_GRID * Config::Y_GRID - 1
#sets @index to 0 if it is greater than the value
if @index > ival
@index = 0
end
#creates the map window
@mapmenu_window = Window_MapMenu.new
#windows index = @index
@mapmenu_window.index = @index
#new sprite (background)
@sprite = Sprite.new
#set sprite image
@sprite.bitmap = RPG::Cache.picture(Config::MAP_NAME)
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@mapmenu_window.dispose
@sprite.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@mapmenu_window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to Menu screen
if $tele == 0
$scene = Scene_Tele.new(0)
else
$scene = Scene_Tele.new(1)
end
return
end
end
end
#===========================================================================
# * class Window_Index
#---------------------------------------------------------------------------
class Window_Index < Window_Base
#-------------------------------------------------------------------------
# * Object Initialization
#-------------------------------------------------------------------------
def initialize(index)
super(*Config::WINDOW_SIZE)
wtext = Config.window_text(index)
@wtext = wtext
self.contents = Bitmap.new(width - 32, height - 32)
@bitmap = RPG::Cache.picture(Config.image_name(index))
self.opacity = Config::WINDOW_OPACITY
refresh
end
#-------------------------------------------------------------------------
# * refresh
#-------------------------------------------------------------------------
def refresh
xy = Config::IMAGE_XY
if @wtext == ''
self.contents.clear
self.contents.blt(xy[0], xy[1], @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), xy[2])
else
self.contents.clear
self.contents.blt(xy[0], xy[1], @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), xy[2])
if Config::W_CUSTOM_FONT == true
self.contents.font.name = Config::W_TEXT_FONT
end
if Config::W_CUSTOM_COLOR == true
rgb = Config::W_SET_COLOR
self.contents.font.color = Color.new(rgb[0], rgb[1], rgb[2])
end
if Config::W_BOLD_TEXT == true
self.contents.font.bold = true
end
self.contents.font.size = Config::W_FONT_SIZE
cx = contents.text_size(@wtext[2]).width
tx = contents.text_size(@wtext[2]).height
if Config::W_TEXT_BACK == true
if Config::W_TEXT_BACK_BORDER == true
rect = self.contents.text_size(@wtext[2])
bc = Config::W_TEXT_BACK_BORDER_COLOR
#border right
highlight_rect = Rect.new(rect.x, rect.y, 2, rect.height + 8)
bitmap = Bitmap.new(highlight_rect.width, highlight_rect.height)
bitmap.fill_rect(highlight_rect.x, highlight_rect.y, highlight_rect.width, highlight_rect.height, Color.new(bc[0], bc[1], bc[2], bc[3]))
self.contents.blt(@wtext[0] + rect.width + 4, @wtext[1] - 4, bitmap, highlight_rect)
#border left
highlight_rect = Rect.new(rect.x, rect.y, 2, rect.height + 8)
bitmap = Bitmap.new(highlight_rect.width, highlight_rect.height)
bitmap.fill_rect(highlight_rect.x, highlight_rect.y, highlight_rect.width, highlight_rect.height, Color.new(bc[0], bc[1], bc[2], bc[3]))
self.contents.blt(@wtext[0] - 6, @wtext[1] - 4, bitmap, highlight_rect)
#border bottom
highlight_rect = Rect.new(rect.x, rect.y, rect.width + 12, 2)
bitmap = Bitmap.new(highlight_rect.width, highlight_rect.height)
bitmap.fill_rect(highlight_rect.x, highlight_rect.y, highlight_rect.width, highlight_rect.height, Color.new(bc[0], bc[1], bc[2], bc[3]))
self.contents.blt(@wtext[0] - 6, @wtext[1] + rect.height + 4, bitmap, highlight_rect)
#border top
highlight_rect = Rect.new(rect.x, rect.y, rect.width + 12, 2)
bitmap = Bitmap.new(highlight_rect.width, highlight_rect.height)
bitmap.fill_rect(highlight_rect.x, highlight_rect.y, highlight_rect.width, highlight_rect.height, Color.new(bc[0], bc[1], bc[2], bc[3]))
self.contents.blt(@wtext[0] - 6, @wtext[1] - 6, bitmap, highlight_rect)
#draw back box
bc = Config::W_TEXT_BACK_COLOR
highlight_rect = Rect.new(rect.x, rect.y, rect.width + 8, rect.height + 8)
bitmap = Bitmap.new(highlight_rect.width, highlight_rect.height)
bitmap.fill_rect(highlight_rect.x, highlight_rect.y, highlight_rect.width, highlight_rect.height, Color.new(bc[0], bc[1], bc[2], bc[3]))
self.contents.blt(@wtext[0] - 4, @wtext[1] - 4, bitmap, highlight_rect)
else
#draw back box
bc = Config::W_TEXT_BACK_COLOR
rect = self.contents.text_size(@wtext[2])
highlight_rect = Rect.new(rect.x - 8, rect.y - 4, rect.width + 24, rect.height + 12)
bitmap = Bitmap.new(highlight_rect.width, highlight_rect.height)
bitmap.fill_rect(highlight_rect.x, highlight_rect.y, highlight_rect.width, highlight_rect.height, Color.new(bc[0], bc[1], bc[2], bc[3]))
self.contents.blt(@wtext[0] - 16, @wtext[1] - 8, bitmap, highlight_rect)
end
end
if Config::W_OUTLINED_TEXT == true
self.contents.draw_text_full(@wtext[0], @wtext[1], cx, tx, @wtext[2], 1)
else
self.contents.draw_text(@wtext[0], @wtext[1], cx, tx, @wtext[2], 1)
end
if Config::W_BOLD_TEXT == true
self.contents.font.bold = false
end
end
end
end
#---------------------------------------------------------------------------
# * Scene_Index
#---------------------------------------------------------------------------
class Scene_Index
def initialize(index)
@index = index
end
#-------------------------------------------------------------------------
# * Main
#-------------------------------------------------------------------------
def main
@index_window = Window_Index.new(@index)
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.picture(Config::MAP_NAME)
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@index_window.dispose
@sprite.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@index_window.update
# set text
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_MapMenu.new(@index)
return
end
end
end
#==============================================================================
# ** Scene_Tele
#------------------------------------------------------------------------------
# This class performs Party screen processing.
#==============================================================================
class Scene_Tele
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(tele_index = 0)
@tele_index = tele_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
$tele_disabled
# Make command window
s1 = "teleport"
s2 = "location info"
@tele_window = Window_Command.new(120, [s1, s2])
@tele_window.index = @tele_index
@tele_window.x = 0
@tele_window.y = 0
#new sprite (background)
@sprite = Sprite.new
#set sprite image
@sprite.bitmap = RPG::Cache.picture(Config::MAP_NAME)
if $game_system.tele_disabled
@tele_window.disable_item(0)
end
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@tele_window.dispose
@sprite.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@tele_window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Menu.new(2)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @tele_window.index
when 0 # teleport
if $game_system.tele_disabled
#buzzer here
else
$tele = 0
@index = $game_variables[Menu_Config::MAP_VARIABLE]
# Play decision SE
$game_system.se_play($data_system.decision_se)
#Scene_MapMenu
$scene = Scene_MapMenu.new(@index)
end
when 1 #
$tele = 1
# Play decision SE
$game_system.se_play($data_system.decision_se)
@index = $game_variables[Menu_Config::MAP_VARIABLE]
# Play decision SE
$game_system.se_play($data_system.decision_se)
#Scene_MapMenu
$scene = Scene_MapMenu.new(@index)
end
return
end
end
end
#---------------------------------------------------------------------
# * interpreter fix when setting false via script * credits to Juan, Blizzard
#---------------------------------------------------------------------
class Interpreter
SCRIPT_WAIT_RESULTS = [:wait, FalseClass]
#-------------------------------------------------------------------
# * Script
#-------------------------------------------------------------------
def command_355
# Set first line to script
script = @list[@index].parameters[0] + "\n"
# Store index in case we need to wait.
current_index = @index
# Loop
loop do
# If next event command is second line of script or after
if @list[@index+1].code == 655
# Add second line or after to script
script += @list[@index+1].parameters[0] + "\n"
# If event command is not second line or after
else
# Abort loop
break
end
# Advance index
@index += 1
end
# Evaluation
result = eval(script)
# If return value is false
if SCRIPT_WAIT_RESULTS.include?(result)
# Set index back (If multi-line script call)
@index = current_index
# End and wait
return false
end
# Continue
return true
end
end
#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
# This class performs skill screen processing.
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Get actor
@actor = $game_party.actors[@actor_index]
# Make help window, status window, and skill window
@help_window = Window_Help.new
@status_window = Window_SkillStatus.new(@actor)
@skill_window = Window_Skill.new(@actor)
# Associate help window
@skill_window.help_window = @help_window
# Make target window (set to invisible / inactive)
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@help_window.dispose
@status_window.dispose
@skill_window.dispose
@target_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@help_window.update
@status_window.update
@skill_window.update
@target_window.update
# If skill window is active: call update_skill
if @skill_window.active
update_skill
return
end
# If skill target is active: call update_target
if @target_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if skill window is active)
#--------------------------------------------------------------------------
def update_skill
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Party.new(0)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the skill window
@skill = @skill_window.skill
# If unable to use
if @skill == nil or not @actor.skill_can_use?(@skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# If effect scope is ally
if @skill.scope >= 3
# Activate target window
@skill_window.active = false
@target_window.x = (@skill_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
# Set cursor position to effect scope (single / all)
if @skill.scope == 4 || @skill.scope == 6
@target_window.index = -1
elsif @skill.scope == 7
@target_window.index = @actor_index - 10
else
@target_window.index = 0
end
# If effect scope is other than ally
else
# If common event ID is valid
if @skill.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = @skill.common_event_id
# Play use skill SE
$game_system.se_play(@skill.menu_se)
# Use up SP
@actor.sp -= @skill.sp_cost
# Remake each window content
@status_window.refresh
@skill_window.refresh
@target_window.refresh
# Switch to map screen
$scene = Scene_Map.new
return
end
end
return
end
# If R button was pressed
if Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To next actor
@actor_index += 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_Skill.new(@actor_index)
return
end
# If L button was pressed
if Input.trigger?(Input::L)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To previous actor
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_Skill.new(@actor_index)
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when target window is active)
#--------------------------------------------------------------------------
def update_target
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Erase target window
@skill_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If unable to use because SP ran out
unless @actor.skill_can_use?(@skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If target is all
if @target_window.index == -1
# Apply skill use effects to entire party
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
# If target is user
if @target_window.index <= -2
# Apply skill use effects to target actor
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
# If single target
if @target_window.index >= 0
# Apply skill use effects to target actor
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
# If skill was used
if used
# Play skill use SE
$game_system.se_play(@skill.menu_se)
# Use up SP
@actor.sp -= @skill.sp_cost
# Remake each window content
@status_window.refresh
@skill_window.refresh
@target_window.refresh
# If entire party is dead
if $game_party.all_dead?
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If command event ID is valid
if @skill.common_event_id > 0
# Command event call reservation
$game_temp.common_event_id = @skill.common_event_id
# Switch to map screen
$scene = Scene_Map.new
return
end
end
# If skill wasn't used
unless used
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs equipment screen processing.
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
# equip_index : equipment index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@equip_index = equip_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Get actor
@actor = $game_party.actors[@actor_index]
# Make windows
@help_window = Window_Help.new
@left_window = Window_EquipLeft.new(@actor)
@right_window = Window_EquipRight.new(@actor)
@item_window1 = Window_EquipItem.new(@actor, 0)
@item_window2 = Window_EquipItem.new(@actor, 1)
@item_window3 = Window_EquipItem.new(@actor, 2)
@item_window4 = Window_EquipItem.new(@actor, 3)
@item_window5 = Window_EquipItem.new(@actor, 4)
# Associate help window
@right_window.help_window = @help_window
@item_window1.help_window = @help_window
@item_window2.help_window = @help_window
@item_window3.help_window = @help_window
@item_window4.help_window = @help_window
@item_window5.help_window = @help_window
# Set cursor position
@right_window.index = @equip_index
refresh
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@help_window.dispose
@left_window.dispose
@right_window.dispose
@item_window1.dispose
@item_window2.dispose
@item_window3.dispose
@item_window4.dispose
@item_window5.dispose
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Set item window to visible
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
# Get currently equipped item
item1 = @right_window.item
# Set current item window to @item_window
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
end
# If right window is active
if @right_window.active
# Erase parameters for after equipment change
@left_window.set_new_parameters(nil, nil, nil)
end
# If item window is active
if @item_window.active
# Get currently selected item
item2 = @item_window.item
# Change equipment
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
# Get parameters for after equipment change
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
# Return equipment
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# Draw in left window
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@left_window.update
@right_window.update
@item_window.update
refresh
# If right window is active: call update_right
if @right_window.active
update_right
return
end
# If item window is active: call update_item
if @item_window.active
update_item
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when right window is active)
#--------------------------------------------------------------------------
def update_right
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Party.new(1)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If equipment is fixed
if @actor.equip_fix?(@right_window.index)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Activate item window
@right_window.active = false
@item_window.active = true
@item_window.index = 0
return
end
# If R button was pressed
if Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To next actor
@actor_index += 1
@actor_index %= $game_party.actors.size
# Switch to different equipment screen
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
# If L button was pressed
if Input.trigger?(Input::L)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To previous actor
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# Switch to different equipment screen
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when item window is active)
#--------------------------------------------------------------------------
def update_item
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Activate right window
@right_window.active = true
@item_window.active = false
@item_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play equip SE
$game_system.se_play($data_system.equip_se)
# Get currently selected data on the item window
item = @item_window.item
# Change equipment
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
# Activate right window
@right_window.active = true
@item_window.active = false
@item_window.index = -1
# Remake right window and item window contents
@right_window.refresh
@item_window.refresh
return
end
end
end
#==============================================================================
# ** Scene_Status
#------------------------------------------------------------------------------
# This class performs status screen processing.
#==============================================================================
class Scene_Status
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Get actor
@actor = $game_party.actors[@actor_index]
# Make status window
@status_window = Window_Status.new(@actor)
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@status_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Party.new(2)
return
end
# If R button was pressed
if Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To next actor
@actor_index += 1
@actor_index %= $game_party.actors.size
# Switch to different status screen
$scene = Scene_Status.new(@actor_index)
return
end
# If L button was pressed
if Input.trigger?(Input::L)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To previous actor
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# Switch to different status screen
$scene = Scene_Status.new(@actor_index)
return
end
end
end
#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
# This class performs save screen processing.
#==============================================================================
class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super("Which file would you like to save to?")
end
#--------------------------------------------------------------------------
# * Decision Processing
#--------------------------------------------------------------------------
def on_decision(filename)
# Play save SE
$game_system.se_play($data_system.save_se)
# Write save data
file = File.open(filename, "wb")
write_save_data(file)
file.close
# If called from event
if $game_temp.save_calling
# Clear save call flag
$game_temp.save_calling = false
# Switch to map screen
$scene = Scene_Map.new
return
end
# Switch to menu screen
$scene = Scene_Menu.new(2)
end
#--------------------------------------------------------------------------
# * Cancel Processing
#--------------------------------------------------------------------------
def on_cancel
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# If called from event
if $game_temp.save_calling
# Clear save call flag
$game_temp.save_calling = false
# Switch to map screen
$scene = Scene_Map.new
return
end
# Switch to menu screen
$scene = Scene_Menu.new(3)
end
#--------------------------------------------------------------------------
# * Write Save Data
# file : write file object (opened)
#--------------------------------------------------------------------------
def write_save_data(file)
# Make character data for drawing save file
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
# Write character data for drawing save file
Marshal.dump(characters, file)
# Wrire frame count for measuring play time
Marshal.dump(Graphics.frame_count, file)
# Increase save count by 1
$game_system.save_count += 1
# Save magic number
# (A random value will be written each time saving with editor)
$game_system.magic_number = $data_system.magic_number
# Write each type of game object
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
end
#==============================================================================
# ** Scene_End
#------------------------------------------------------------------------------
# This class performs game end screen processing.
#==============================================================================
class Scene_End
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make command window
s1 = "To Title"
s2 = "Shutdown"
s3 = "Cancel"
@command_window = Window_Command.new(192, [s1, s2, s3])
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 240 - @command_window.height / 2
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame Update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of window
@command_window.dispose
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update command window
@command_window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(4)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # to title
command_to_title
when 1 # shutdown
command_shutdown
when 2 # quit
command_cancel
end
return
end
end
#--------------------------------------------------------------------------
# * Process When Choosing [To Title] Command
#--------------------------------------------------------------------------
def command_to_title
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Switch to title screen
$scene = Scene_Title.new
end
#--------------------------------------------------------------------------
# * Process When Choosing [Shutdown] Command
#--------------------------------------------------------------------------
def command_shutdown
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Shutdown
$scene = nil
end
#--------------------------------------------------------------------------
# * Process When Choosing [Cancel] Command
#--------------------------------------------------------------------------
def command_cancel
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to menu screen
$scene = Scene_Menu.new(4)
end
end
#----------------------------------------------#
# credits to Diagostimo if you use this script #
#----------------------------------------------#
# use of this script for comercial purposes is #
# prohibited. #
#----------------------------------------------#
#-------------#
#beging config#
#-------------#
module Config
#IMPORT ALL YOUR IMAGES TO THE PICTURES DIRECTORY!
#your main map's image name
MAP_NAME = "kantomap.png"
#define the windows [x, y, width, height] for your town images ect
WINDOW_SIZE = [112, 64, 416, 352]
#define the opacity of your towns windows(this does not effect the images)
#255=max, 0=min
WINDOW_OPACITY = 255
#your town's image names ect (if field "" is left empty no window will open
#for the index selected) refer to the 'index reference' image to map out your
#images properly!
def self.image_name(index)
return case index
when 1 then 'pallettown.png'
when 2 then 'pallettown.png'
when 3 then 'pallettown.png'
when 4 then 'pallettown.png'
# And so on and so forth...
else 'pallettown.png'
end
end
end
#==============================================================================
# ** Window_Map
#------------------------------------------------------------------------------
class Window_MapMenu < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
end
#-------------------------------------------------------------------------
# * def index
#-------------------------------------------------------------------------
def index=(index)
@index = index
# Update cursor rectangle
update_cursor_rect
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
x = 0 + @index % 19 * 32
y = 0 + @index / 19 % 14 * 32
self.cursor_rect.set(x, y, 32, 32)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# if enter is being pressed
if Input.trigger?(Input::C)
name = Config.image_name(@index)
if name == ''
$scene = Scene_MapMenu(@index)
else
$scene = Scene_Index.new(@index)
$game_system.se_play($data_system.decision_se)
end
# If right directional button is pushed
elsif Input.repeat?(Input::RIGHT)
# If directional button pressed down is not a repeat, or
# cursor is not positioned on the right edge
if Input.trigger?(Input::RIGHT) or
@index % 19 < 18
# Move cursor to right
$game_system.se_play($data_system.cursor_se)
if @index % 19 < 18
@index += 1
end
end
# If left directional button is pushed
elsif Input.repeat?(Input::LEFT)
# If directional button pressed down is not a repeat, or
# cursor is not positioned on the left edge
if Input.trigger?(Input::LEFT) or
@index % 19 > 0
# Move cursor to left
$game_system.se_play($data_system.cursor_se)
if @index % 19 > 0
@index -= 1
end
end
# If down directional button is pushed
elsif Input.repeat?(Input::DOWN)
# Move cursor down
if @index / 19 < 13
@index += 19
$game_system.se_play($data_system.cursor_se)
end
# If up directional button is pushed
elsif Input.repeat?(Input::UP)
# Move cursor up
if @index / 19 > 0
@index -= 19
$game_system.se_play($data_system.cursor_se)
end
end
update_cursor_rect
end
end
#---------------------------------------------------------------------------
# * Scene Map_Menu
#---------------------------------------------------------------------------
class Scene_MapMenu
def initialize(index = 0)
@index = index
end
#-------------------------------------------------------------------------
# * MAIN
#-------------------------------------------------------------------------
def main
@mapmenu_window = Window_MapMenu.new
@mapmenu_window.index = @index
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.picture(Config::MAP_NAME)
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@mapmenu_window.dispose
@sprite.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@mapmenu_window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to Menu screen
$scene = Scene_Item.new
return
end
end
end
#---------------------------------------------------------------------------
# * class Window_Index
#---------------------------------------------------------------------------
class Window_Index < Window_Base
#-------------------------------------------------------------------------
# * Object Initialization
#-------------------------------------------------------------------------
def initialize(index)
super(*Config::WINDOW_SIZE)
@bitmap = RPG::Cache.picture(Config.image_name(index))
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = Config::WINDOW_OPACITY
refresh
end
#-------------------------------------------------------------------------
# * refresh
#-------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.blt(0, 0, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), 255)
end
end
#---------------------------------------------------------------------------
# * Scene_Index
#---------------------------------------------------------------------------
class Scene_Index
def initialize(index)
@index = index
end
#-------------------------------------------------------------------------
# * Main
#-------------------------------------------------------------------------
def main
@index_window = Window_Index.new(@index)
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.picture(Config::MAP_NAME)
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@index_window.dispose
@sprite.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@index_window.update
# if mapmenu is active call update_map
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_MapMenu.new(0)
return
end
end
end
@bitmap.clear
# of
@window.contents.clear
when 1 then 'pallettown.png'
when 2 then 'pallettown.png'
when 3 then 'pallettown.png'
when 4 then 'pallettown.png'
# And so on and so forth...
else 'pallettown.png'
Quote from: diagostimo on April 26, 2012, 06:19:18 pm
thanks :D, i do have an idea to add more to it, perhaps a teleporting function but not sure how i would go about it yet, anyone think this is worthy enough for the database :P