Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Display the Map Location
#1
Display the Map Location
by Mister C Major
Jul 17 2007

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


Good Afternoon Everyone,


Before I begin, I would like to say this idea was not my own. Around an year ago I was looking for a script which served the same purpose as the one I am posting today. To my luck I found it. An year later, after my computer crashed along with my game file, and after Creation Asylum "refreshed" itself, I came to look for the script again. To no avail, I was unable to find the post. So I reprogrammed the idea in my own lines. Again I do not take credit for the idea, just the reprogramming.

So today I post my own variation of the script for all to enjoy.

The Location Window

Obvious from the section this post is in, this is an enhancement script designed to add a very small flair to your game. The final product will be as the picture shown. The only aspect of this picture we will be worrying about today is going to be the white font which reads "Testing".

(Imageshack link broken)


For quick setup, follow the instructions in the code box. For a detailed explanation, skip the code box.


[Spoiler=The Location Window]

At this to Line 31 of the Scene_Title Class


Code:
$data_mapinfos=load_data("Data/MapInfos.rxdata")


To test, add this code to a call script command in an event.


Code:
print $data_mapinfos[$game_map.map_id].name.to_s

Code:
As I try to do with all my posted scripts, not only will I post the code but I will be explaining the Science behind it, aka the meaning and reason I used the code.

Their is a variable within the game which contains the name for all the maps, this is evident because we are able to edit the names of the maps in the editor (the computer has to store them somewhere :-p ). Luckily for us, all the data which concerns our game is stored within the "RMXP Data Structure."

[i]The help file contains a list of all the classes the different data within our game is stored in.[/i]

There are two classes which have the possibility of containing our " Map Name", and they are, RPG:Map and RPG:MapInfo. If you look within the classes, RPG:MapInfo is the class where our name variable is stored, cleverly titled "name". However, this class is one of the few RPG Classes physically defined within the Data Folder in our Game File; therefore, if we were to try to extract any of that data, we would need to extract it from the Map Info file, titled "MapInfos.rxdata."

To access this data, we need to define a variable and load the map info data into the variable. The default RGSS Script actually already has a section where all this type of data is loaded into the game. This can be found in Class Scene_Title lines 18-30. To stay within the lines of good programming we are going to add our own variable within these predefined variables.

Insert the following to Line 31 of the Scene_Title Class


[code]$data_mapinfos=load_data("Data/MapInfos.rxdata")



To access this data, we need to send a call to the $data_mapinfos variable with a call number (more commonly known as a parameter) where the parameter is the id of the map. The current map id can be found in the Game_Map class. To access the variable we use the following code which will return the map_id variable.


Code:
$game_map.map_id



So to print the map name, the code will look as follows,

Code:
$data_mapinfos[$game_map.map_id].name.to_s



where "name" is the variable from the "MapInfos.rxdata" file and "to_s" is the command to turn the data stored in "name" into a format which can be printed on the computer screen (again commonly referred to as a "string").

To test this, paste the following into a "Call Script" command within an event and activate the event.


Code:
print $data_mapinfos[$game_map.map_id].name.to_s



If you guys have any comments on how I can improve my scripts, improve my posts, and/or improve how to teach my scripts, don't hesitate to comment!

Thanks for reading and I hope this helps make your game extra spiffy ^^.
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Gold Display Add-Ons Mister C Major 0 2,020 04-30-2007, 01:00 PM
Last Post: Mister C Major



Users browsing this thread: