Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: legacyblade on February 08, 2010, 12:33:06 am

Title: [XP] Legacy Atlas Script
Post by: legacyblade on February 08, 2010, 12:33:06 am
Legacy Atlas Script
Authors: Legacyblade
Version: 1.01b
Type: Atlas Display System
Key Term: Environment Add-on



Introduction

This script allows you to have a world map with a cursor that corresponds to the player's current position. The player can even "zoom in" on the region they're currently in for a more detailed view. While it was designed for use in a world like the one seen in Wind Waker (lots of little islands on a big ocean), it will work perfectly fine for any world (due to the way the player's location in the world is handled by the script)


Features




Screenshots

Spoiler: ShowHide
(http://legacyblade.com/downloads/scripts/LWA/screens/01.png)

Spoiler: ShowHide
(http://legacyblade.com/downloads/scripts/LWA/screens/02.png)

Spoiler: ShowHide
(http://legacyblade.com/downloads/scripts/LWA/screens/03.png)



Demo

DOWNLOAD (http://legacyblade.com/downloads/scripts/LWA/LegacyWorldAtlas.zip)



Script

Spoiler: ShowHide

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Legacy World Atlas
# Version: 1.01b
# Type: Atlas Display System
# Date v1.00b:  7.2.2010
# Date v1.01b:  8.2.2010
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#  
#  This work is protected by the following license:
# #----------------------------------------------------------------------------
# #  
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #  
# #  You are free:
# #  
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# #  
# #  Under the following conditions:
# #  
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# #  
# #  Noncommercial. You may not use this work for commercial purposes.
# #  
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# #  
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# #  
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# #  
# #  - Nothing in this license impairs or restricts the author's moral rights.
# #  
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Compatibility:
#
#   This script should be 100% compatible with ANY script. If you find a script
#   that's incompatible (without making it yourself specially for that purpose)
#   and report it to me, I'll give you a cookie (and fix the incompatibility)
#
#  
# Features:
#
#   - Display a world map that will point to the player's location.
#   - Zoom in on the map to see a close up veiw of the region you're in.
#   - Easy to set up with any system (as you specify the location of the cursor
#     on the world map with a script call).
#
# Instructions:
#
#   Create a world map to cover the entire world, then region maps for every
#   region you wish to show in game.
#
#
# Version History:
#
# v1.00b:
#   -> Initial release
#
# v1.01b:
#   -> Fixed a small bug that caused the area name to be incorrect.
#   -> Cleaned up the comments just a little bit.
#
#
# Configuration:
#
#   PLAYER_ICON         - The icon in "Icons/Atlas" that will point to the
#                         player's position on the map.
#
#   WORLD_MAP_NAME      - The picture in "Pictures/Atlas/" that will display
#                         as the global map. (the zoomed out map)
#
#   SHOW_LOCATION_NAME  - Toggles whether or not the name of player's current
#                         location will be displayed on the map.
#                              
#   ZOOM_IN_SE          - The sound effect that will play when the player
#                         "zooms" in on the map. (switches from a display of
#                         the global map to the local map)
#
#   ZOOM_OUT_SE         - The sound effect that will play when the player
#                         "zooms" out on the map. (switches from a display of
#                         the local map to the global map)
#
#   EXIT_ATLAS_SE       - The sound effect that will play when the player exits
#                         the atlas scene.
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=



module LBConf

#///////////////////////////////////////////////////////////////////////////////
#     START CONFIGURATION                                                     //
#///////////////////////////////////////////////////////////////////////////////
 # to not show an icon, just set it to ''
 PLAYER_ICON        = 'pointer'
 
 WORLD_MAP_NAME     = 'world'
 
 SHOW_LOCATION_NAME = true
 
 ZOOM_IN_SE         = '003-System02'
 ZOOM_OUT_SE        = '003-System03'
 EXIT_ATLAS_SE      = '003-System03'    
 
   #############################
  #  ATLAS_REGION_IMAGES      #
 ##############################################################################
 # the syntax for defining a region's name is as follows                    
 #
 #       when x then return 'Region Name'                                          
 #
 # x is a number you asign it (it can be anything, but logically you should  
 # order them sequentially.)                                          
 #
 # imageName is the name of the picture found in "Pictures/Atlas/" that will
 # serve as the map for that particular region.
 #
 ##############################################################################
 def self.atlas_region_images(region)
   case region
     when 0 then return ''
   end
   # the text to be displayed on an unconfigured area. The default is a blank
   # string.      
   return 'openOcean'
 end

   #############################
  #  ATLAS_REGION_NAMES       #
 ##############################################################################
 # the syntax for defining a region's name is as follows                    
 #
 #       when x then return 'Region Name'                                          
 #
 # x is a number you asign it (it can be anything, but logically you should  
 # order them sequentially.)                                          
 #
 # 'Region Name' is the name that will be displayed on the map (provided you
 #  are using the Location Name feature)
 #  
 ##############################################################################  
 def self.atlas_region_names(region)
   case region
     when 0 then return ''
     end
   # the text to be displayed on an unconfigured area. The default is a blank
   # string.      
   return ''
 end

   #############################
  #  ATLAS_AREA_NAMES         #
 ##############################################################################
 # the syntax for defining am area's name is as follows                    
 #
 #   when regionID
 #     case region[1]
 #       when x then return 'Area Name'                                          
 #
 # regionID is the number of a region (defined above) which this area belongs
 # to.
 #
 # case region[1] should be left as is
 #
 # x is a number you asign it (it can be anything, but logically you should  
 # order them sequentially.)
 #
 # 'Area Name' is the name that will be displayed on the map (provided you
 #  are using the Location Name feature)
 #  
 ##############################################################################    
 def self.atlas_area_names(area)
   case area
     when 0 then return ''
   
   end
   # the text to be displayed on an unconfigured area. The default is a blank
   # string.
   return ''
 end
     
#///////////////////////////////////////////////////////////////////////////////
#     END CONFIGURATION                                                     //
#///////////////////////////////////////////////////////////////////////////////      
 
end
 
class Game_System
 attr_accessor :region
 attr_accessor :area  
 attr_accessor :globalX
 attr_accessor :globalY
 attr_accessor :localX
 attr_accessor :localY
 alias initialize_atlas_vars_LB initialize
 def initialize
   @region, @area, @globalX, @globalY, @localX, @localY = 0, 0, 0, 0, 0, 0
   initialize_atlas_vars_LB
 end
end

class Scene_Atlas
 
 def initialize()
   @region    = $game_system.region
   @area      = $game_system.area
   @globalX   = $game_system.globalX
   @globalY   = $game_system.globalY
   @localX    = $game_system.localX
   @localY    = $game_system.localY
   
   @zoomed = false
   @atlas = Atlas_Base.new(nil, LBConf::WORLD_MAP_NAME, LBConf::atlas_region_names(@region),
                           @globalX, @globalY)
 end
 
 def main
   # enter the scene's loop #
   Graphics.transition
   
   loop do
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   end
   
   # dispose of the windows #    
   Graphics.freeze

   @atlas.dispose
 end

 def update
   @atlas.update
   if Input.trigger?(Input::C)
     if @zoomed != true
       zoom_in
     else
       zoom_out
     end
   end
   if Input.trigger?(Input::B)
     if @zoomed != true
       $scene = Scene_Map.new
     else
       zoom_out
     end
   end
 end
 
 def zoom_in
   $game_system.se_play($data_system.decision_se)
   @zoomed = true
   @atlas.mapImage = LBConf::atlas_region_images(@region)
   @atlas.mapName  = LBConf::atlas_area_names(@area)
   @atlas.cursorX  = @localX
   @atlas.cursorY  = @localY
 end
 
 def zoom_out
   $game_system.se_play($data_system.cancel_se)
   @zoomed = false
   @atlas.mapImage = LBConf::WORLD_MAP_NAME
   @atlas.mapName  = LBConf::atlas_region_names(@region)
   @atlas.cursorX  = @globalX
   @atlas.cursorY  = @globalY
 end  

 
end

class Atlas_Base < Sprite
 attr_accessor :mapImage
 attr_accessor :mapName
 attr_accessor :cursorX
 attr_accessor :cursorY
 
 def initialize(viewport = nil, mapImage = 'world', mapName = '', cursorX = 0, cursorY = 0)
   super()
   self.x, self.y, self.z, self.opacity = 0, 0, 1, 255
   self.bitmap = Bitmap.new(640, 480)
   @viewport = viewport
   
   @mapImage = mapImage
   @mapName  = mapName

   @cursorX  = cursorX
   @cursorY  = cursorY
   
   refresh
 end
 
 def refresh
   self.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0, 0))
   
   bitmap = RPG::Cache.picture('Atlas/' + @mapImage)
   self.bitmap.blt(0, 0, bitmap, Rect.new(0, 0, 640, 480))
   
   if LBConf::SHOW_LOCATION_NAME == true
     self.bitmap.draw_text(40, 420, 90, 28, 'Location :', 0)
     self.bitmap.draw_text(133, 420, 300, 28, @mapName, 0)
   end
   
   if LBConf::PLAYER_ICON != ''
     bitmap = RPG::Cache.icon('Atlas/' + LBConf::PLAYER_ICON)
     self.bitmap.blt(@cursorX, @cursorY, bitmap, Rect.new(0, 0, 24, 24), 255)
   end
 end
 

 def update
   refresh if self.bitmap != RPG::Cache.picture('Atlas/' + @mapImage)
 end
end



Instructions

Explained in the script (there's not much to explain to begin with)


Compatibility

Should be compatible with ANY scripts. Please let me know if you find an incompatible one.


Credits and Thanks




Author's Notes

This script is built specifically to be easy to use for whatever your needs are. If you want to see a feature in this script, PLEASE ask for it. I only gave it the options I felt I needed for my personal project (and a bit of general configuration options), because I'm not sure what other people are looking for in this kind of script. Also, if you find a bug, PLEASE tell me.
Title: Re: Legacy Atlas Script
Post by: This Side Backwards on February 08, 2010, 01:03:58 am
Great script and nifty idea, there are a few minor flaws that still need to be worked out though.

When I open the first map, it works fine, then, when I teleport to the dock area and check the map, it says that I am still in the Wayward Woods but the cursor points the green house.

If I then teleport to the um... "hi" map, and open the map, it says I'm in Frisca Ville and the cursor points to the area at the foot of the mountains.

I didn't check any further, but I think the script is getting itself mixed up.

Can't wait till it's fixed though! It's an awesome script and I hope to use it in my next project!
Title: Re: Legacy Atlas Script
Post by: legacyblade on February 08, 2010, 01:39:36 am
Oh, that's probobly just some eventing issues on my part (the are and region are assigned via script call). I'll take a look though, Glad you like it :)

(it's supposed to point to the foot of the mountains, as that's where the field is located).

But thank you for pointing out those errors. I'll get on them in the morning. Tonight, I need sleep.
Title: Re: [XP] Legacy Atlas Script
Post by: G_G on February 08, 2010, 01:51:50 am
Very nice LB! *lv's up* I may end up using this!
Title: Re: [XP] Legacy Atlas Script
Post by: Calintz on February 08, 2010, 02:20:52 am
This is worth a LVL up.
Title: Re: [XP] Legacy Atlas Script
Post by: Spaceman McConaughey on February 08, 2010, 11:01:09 am
Nice!~ Levels UP! :D
Title: Re: [XP] Legacy Atlas Script
Post by: legacyblade on February 08, 2010, 12:14:22 pm
Sweet, I'm in the database ^.^ And thanks for the level ups everyone. Now I am a high enough level to defeat the boss >}
Title: Re: [XP] Legacy Atlas Script
Post by: Blizzard on February 08, 2010, 12:37:53 pm
Not yet. Your level has to be 69. :V:
Title: Re: [XP] Legacy Atlas Script
Post by: legacyblade on February 08, 2010, 12:38:19 pm
only three more levels!!!
Title: Re: [XP] Legacy Atlas Script
Post by: Blizzard on February 08, 2010, 12:43:54 pm
You mean 2. :naughty:
Title: Re: [XP] Legacy Atlas Script
Post by: legacyblade on February 08, 2010, 01:51:53 pm
Now just one o.o
Title: Re: [XP] Legacy Atlas Script
Post by: Subsonic_Noise on February 08, 2010, 01:59:29 pm
I did it.
Applause?
Title: Re: [XP] Legacy Atlas Script
Post by: legacyblade on February 08, 2010, 02:13:05 pm
I was kinda hoping to get my 69 with a girl >.> But thanks for the gesture, Subsonic, lol
Title: Re: [XP] Legacy Atlas Script
Post by: Blizzard on February 08, 2010, 02:28:35 pm
I'll power you down so you can get another 69. The only thing better than 69 is a double 69 after all. :V:
Title: Re: [XP] Legacy Atlas Script
Post by: legacyblade on February 08, 2010, 02:30:45 pm
lol, Sure, that sounds rather fun :P

On an on-topic note, I found the bug Sourseb mentioned. It was caused when I changed how the config section worked just before release. I forgot to remove one tiny little thing, and it caused that error (I'm still not sure how it was functioning as well as it did with that error, in all logical-ness, it should have crashed O.o)

Anyways, I'm uploading a fixed version now.

-edit

FIXED. Now there are no bugs that I was able to run into. If anyone finds anything else, please let me know.
Title: Re: [XP] Legacy Atlas Script
Post by: Aqua on February 08, 2010, 02:44:29 pm
Smexy~
Title: Re: [XP] Legacy Atlas Script
Post by: legacyblade on February 08, 2010, 02:56:15 pm
If you think so, Aqua, you should give me my second set of 69  :naughty:
Title: Re: [XP] Legacy Atlas Script
Post by: Zare on February 08, 2010, 03:01:10 pm
great script, lvled you up already, also if this is not what I am looking for xD Could this be configured like this:
I have a worldmap and I want a picture map (Atlas) in the proportion of the worldmap, so you current location is shown in the atlas
Title: Re: [XP] Legacy Atlas Script
Post by: legacyblade on February 08, 2010, 03:17:43 pm
From what I'm gathering, you're asking if you can have a picture of the world map showing the player's current location. That's exactly what the script does (did you try the demo?). If I'm mistaken as to what you're asking, just clarify what you meant, and I'll give you a better answer :P
Title: Re: [XP] Legacy Atlas Script
Post by: Zare on February 08, 2010, 03:42:38 pm
yep i tried the demo :D but I need a "real time location". So it's just one map and the position on this map is changing with every step^^
Title: Re: [XP] Legacy Atlas Script
Post by: Aqua on February 08, 2010, 03:46:23 pm
I think he wants what mine does. XP

http://forum.chaos-project.com/index.php/topic,4283.0.html
Title: Re: [XP] Legacy Atlas Script
Post by: legacyblade on February 08, 2010, 04:16:33 pm
Ah ok. You see, this is why it's good that we have two scripts :P What I wanted would have been a pain with real time updating. (though I'm combining it with continuous maps, so it's going to seem real time to the player ^.^)
Title: Re: [XP] Legacy Atlas Script
Post by: Aqua on February 08, 2010, 04:23:10 pm
Mind could be set up to be like yours XP
It'd just require some careful measurements
Title: Re: [XP] Legacy Atlas Script
Post by: legacyblade on February 08, 2010, 04:49:44 pm
But I didn't want to spend a long LONG time on that (it'd be a very long time) so I set this one up to cater to people who's needs are more like mine :P
Title: Re: [XP] Legacy Atlas Script
Post by: Eternal on February 09, 2010, 04:49:02 am
very useful, I'm most definetely be using this :)