Hi there, here is my first ever script, so please don't be afraid to criticize, basically this script allows you to use a picture for your map, and setup pictures to show at locations, e.g zoomed images of towns ect. I do plan on adding a lot more to this script as my understanding in ruby gets better, so if you can think of any features that could be a good addition to this, don't hesitate to ask Features

use a custom picture as your main map image

setup pictures to show at locations for zoomed town images ect

customizable window size, and opacity for location windows

call from an item or event

configure names for locations

completely customize text to your liking

menu modifaction so the map can be called directly from the menu

use a variable to direct where your cursor will start when calling the map

#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:

Place above main and below all the default scripts, to call the script through events call: $scene = Scene_MapMenu.new(i)i is the number of the index you want it to start at when opening the map, see the index reference image for a better understanding, all other instructions/configuration can be found in the script or demo.if your using the customized menu, you need all the scripts above(replace old ones and place Scene_Party below Scene_Menu) Scene_Menu and Scene_Party are the major edited ones, but the rest have been edited so when you escape out of them you end up in the right place in the menu.also the new Scene_Menu has a small config at the top where you can set the menu's x,y and set the variable id the map uses to call it to the right index.

I will provide updates on this, so it is up to standards also i have used images from pokemon for the map, just for a good understanding how it works.if you are already using the interpreter fix script in your project then you can remove that part from the map script.UPDATE:26/4/2012added configurable text to the windows. added more configuration.added a modified menu to call the map from.updated the demo. UPDATE:9/5/2012added teleporting methods that can be enabled/disabledsee the demo or script for instructionsUPDATE:3/6/2012added configuration so you can change the size of the maps grid, see inside the script config for details.

Ummm. I need to show you some things. You have a 12,000 line script that could be done in probably about 150-300 lines, probably less.There is no reason to re-define so many things when the only difference is a number in the name.

Give me a few minutes and I'll make up some examples for you to check out.

Logged

I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

#----------------------------------------------## credits to Diagostimo if you use this script ##----------------------------------------------## use of this script for comercial purposes is ## prohibited. ##----------------------------------------------##-------------##beging config##-------------#

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 endend

I made a much simpler configuration, which also eliminated the need for multiple global variables, and is much easier to setup. The user needs only to add a line for any map they want to set up. If its not found, it returns a default "".

I eliminated the 500-something Scene and Window classes and replaced them with just 2 that are simply initialized with an index. This index is used to get the name of the image from the config.

On another quick note, which I am sure you will quickly find out as you continue to learn RGSS. In a refresh method, where you are redrawing a bitmap or a window, you should first clear it.

@bitmap.clear# of@window.contents.clearIt doesn't matter when the image will be drawn only once, but you will find that most things are not this way, and if you do not clear it, the new drawing will simply be placed over the old. This makes text rather hard to read when it is 10 words layered on top of each other .

Either way, see what you can learn from my couple quick edits, and feel free to ask any questions you may have.

Logged

I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

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'how are those being directed at the index? what i mean is before if i wanted pallet town to be shown at index 193 i would have that as the number, if you get what im saying?edit: doesnt matter i forgot to delete the old script to test with what you did, my only question now is how do i force it to return at the index point you used to call the window? also do i need else? the image is been called wherever i selectedit2: no worries iv figured out what i needed to know, wow i over complicated it so much at least now i can now focus on making it alot more interactive without worrying about updating 500 windows and scenes

thanks , 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

* Quickly moves to database *

What do you mean, its already there.

EDIT:Just a little tip for the future, don't edit the template, especially the header. You removed the "s" from "Authors" in the header (I know, I know, very minor), and it caused it to get all crazy looking in the Script Index. Its no big deal, I just added it back and all is good. Just saying for when you make your next script.

« Last Edit: April 27, 2012, 03:38:22 AM by ForeverZer0 »

Logged

I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.