Locations system
Version:2
By: gerkrt/gerrtunk
IntroductionThis script adds a entry in the main menu(removing steps window)that shows
your actual place. The interesting thing about it is that it lets configure
about anything with flexibility and new features.
Creating locations:
-Using the map tree system. You only have to write the name of the parent map
and all the others under it take his description
-By map name
-By maps groups that share a description
Sublocations:
-By map name
-By maps groups that share a sublocation description
Sublocations allow you to add a specification of the actual area,
so: location "Aoha forest" sublocation "Old tree", for example.
Also you can combine any of these system or options without a problem.
Screenshots Script
Get a more updated one here:
http://usuarios.multimania.es/kisap/english_list.html
#==============================================================================
# Locations system
# By gerkrt/gerrtunk
# Version: 2.1
# License: MIT, credits
# Date: 24/01/2011
# IMPORTANT NOTE: to acces the more actualitzed or corrected version of this
# script check here: http://usuarios.multimania.es/kisap/english_list.html
#==============================================================================
=begin
------INTRODUCTION------
This script adds a entry in the main menu(removing steps window)that shows
your actual place. The interesting thing about it is that it lets configure
about anything with flexibility and new features.
Creating locations:
-Using the map tree system. You only have to write the name of the parent map
and all the others under it take his description
-By map name
-By maps groups that share a description
Sublocations:
-By map name
-By maps groups that share a sublocation description
Sublocations allow you to add a specification of the actual area,
so: location "Aoha forest" sublocation "Old tree", for example.
Also you can combine any of these system or options without a problem.
-------CONFIGURING LOCATIONS---------
Location_type : This variable sets the type of locations:
Location_type = :map_list -> use map list
Location_type = :map_name -> use map name
Location_type = :map_tree -> use map tree
-By map name: It will just write the actual map name.
-By map list: Using this you create a group of maps that share a location
description.
Locations_map_id = [
[[1,2,3], 'Ahoha forest'], # Maps 1,2,3 share Ahoha forest description
[[4,5,6], 'Sphynx']
]
Just add lines like this: [[map_id1, map_id2], 'Description'],
-By map tree: With this you only have to define a parent map and write its name in
the descriptions. All the maps will have the description, including the parent map.
The map tree is show under the tileset tool. If you doubleclick to - or + you will
see that the maps are shown in groups that depend in parent maps.
Note: I recomend having the maps having the maps ordered and directly relationed with
its parent map to have optimal performance.
Use example:
Mapamundi - Parent of all
Forest - Parent of maps 3-7
Mapa3
Mapa4
Mapa5 - Parent of 6,7
Mapa6
Mapa7
Pantano del Wep
Mapa9
Configuration it:
Locations_map_tree = {
'Forest' => 'Ahoha forest',
'Prologue' => 'Sphynx' # All the maps under the map called Prologue have
# sphynx description
}
To add new locations add these lines:
'Basename map name' => 'Description',
-------CONFIGURING SUBLOCATIONS---------
Show_sublocations : These configurates sublocations
Show_sublocations = :inactive ---> makes them inactive
Show_sublocations = :map_name ---> use map name
Show_sublocations = :codes ---> makes them use map codes
inactive: if they are inactive you are going to see in the first line the
sublocations word
map name: this wall it will simply write the actual map name as a sublocation
description
codes: this works like the locations map list, but for sublocations:
Sublocations_codes = [
[[1,2], 'Santuary'],
[[4,5,6], 'Old tree']
]
Just add lines like this: [[map_id1, map_id2], 'Description'],
------OTHER THINGS------------
Unknown_location_text: This is for maps that dont have a description.
Sublocations_text : Here you can write a prefix for all sublocations
Locations_text : Here you write the describing word of the locations
=end
module Wep
Unknown_location_text = '?????'
Location_type = :map_list
Show_sublocations = :inactive # :inactive, :map_name, :codes
Sublocations_text = ''
Locations_text = 'Location'
Locations_map_id = [
[[1,2,3], 'Ahoha forest'],
[[4,5,6], 'Sphynx']
]
Sublocations_codes = [
[[1,2], 'Santuary'],
[[4,5,6], 'Old tree']
]
Locations_map_tree = {
'Forest' => 'Ahoha forest',
'Prologue' => 'Sphynx'
}
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make command window
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Estado"
s5 = "Guardar"
s6 = "Salir"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
@command_window.index = @menu_index
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(4)
end
# Make play time window
@playtime_window = Window_PlayTime.new
@playtime_window.x = 0
@playtime_window.y = 224
# Make steps window
@location_window = Window_Location.new
@location_window.x = 0
@location_window.y = 320
# Make gold window
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 416
# Make status window
@status_window = Window_MenuStatus.new
@status_window.x = 160
@status_window.y = 0
# 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
@command_window.dispose
@playtime_window.dispose
@location_window.dispose
@gold_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@command_window.update
@playtime_window.update
@location_window.update
@gold_window.update
@status_window.update
# If command window is active: call update_command
if @command_window.active
update_command
return
end
# If status window is active: call update_status
if @status_window.active
update_status
return
end
end
end
#==============================================================================
# ** Window_Location
#------------------------------------------------------------------------------
# Show the places you visit
#==============================================================================
class Window_Location < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Set basic text
text = Wep::Unknown_location_text
# If uses the complete hash
if Wep::Location_type == :map_list
# Extract text from locations
for location in Wep::Locations_map_id
if location[0].include? $game_map.map_id
text = location[1]
break
end
end
# If uses the map name
elsif Wep::Location_type == :map_name
# Load mapinfos for map name
mapinfos = load_data("Data/MapInfos.rxdata")
# Make text
text = mapinfos[$game_map.map_id].name
# If it uses the map tree methods
else
# Iteraves over all base maps searching for tree of the
# actual map.
for locname, locdescription in Wep::Locations_map_tree
# Search for actual map in a defined map tree
if $game_party.tree_includes_map? (locname)
text = locdescription
break
end
end
end
# Draw text
self.contents.clear
# If sub locations use map names, read mapinfos
if Wep::Show_sublocations == :map_names
# Load mapinfos for map name
mapinfos = load_data("Data/MapInfos.rxdata")
# Make text
subtext = Wep::Sublocations_text + mapinfos[$game_map.map_id].name
# Draw using classic style
self.contents.font.color = system_color
self.contents.draw_text(4, -5, 120, 32, text)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, subtext, 2)
# If sub locations use map codes, iterate sublocations
elsif Wep::Show_sublocations == :codes
# Extract text from sublocations
for sublocation in Wep::Sublocations_codes
if sublocation[0].include? $game_map.map_id
subtext = Wep::Sublocations_text + sublocation[1]
break
end
end
# Draw using classic style
self.contents.font.color = system_color
self.contents.draw_text(4, -5, 120, 32, text)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, subtext, 2)
# If not, draw using Locations word
else
self.contents.font.color = system_color
self.contents.draw_text(4, -5, 120, 32, Wep::Locations_text)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, text, 2)
end
end
end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# Added method tree includes map
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# * Tree includes map?
# look for the name given in actual map tree
#--------------------------------------------------------------------------
def tree_includes_map? (name)
# Load mapinfos for map name
mapinfos = load_data("Data/MapInfos.rxdata")
# If his name is the name searched
if mapinfos[$game_map.map_id].name == name
return true
end
map = $game_map.map_id
# Iterate all parents maps
while mapinfos[map].parent_id != 0
if mapinfos[mapinfos[map].parent_id].name == name
return true
else
map = mapinfos[map].parent_id
end
end
end
end
InstructionsNothing special. Just insert it before main.
Authors notesAll my scripts are in development and im open to suggestions, critics, bugs, etc.