Creating Automaps: Difference between revisions
Line 77: | Line 77: | ||
== Conclusion == | == Conclusion == | ||
It is quite simple to setup a fully functional automap. The main effort for the mapper is to actually draw the map | It is quite simple to setup a fully functional automap. The main effort for the mapper is to actually draw the map. | ||
== Additions == | == Additions == |
Revision as of 13:57, 11 June 2017
Introduction
Normally the player is given a map at mission start, which is showing him the location he is attempting to sneak in. However, it may not seem very realistic that the player already possesses such detailed information without ever been in the specific place. An automap, thus meaning a map that gets drawn while the player proceeds in his mission may seem more realistic.
On the other hand such thing can also add a lot to immersion. The player don't know what is expecting him in the beginning, but benefits from the advantages a map brings to him while he proceeds. In addition an automap provides information about where the player already have been and therefore can avoid frustrating moments when he is searching for one little room he may have overseen.
The following article now describes how to set up such an item.
Preparations
The first step is to actually draw your map. How you do this is your business. After you have done so you should cut out all the seperate rooms you want to appear on the map later on. Make sure to make the background transparent (using gimp for example). If you do so you should have
- one picture containing the parts of the map the player already know at mission start (called startmap furthermore) - several pictures of the rooms he can discover later on
It is your choice if you want to put the startmap on the map_of_.tga file served with the startmap package or keep it seperate. However, for the tutorial let's just assume you have choosen the first possibility.
Furthermore you should get familiar with the zone system as it is needed here.
Setting up the gui
The gui looks like this:
windowDef Desktop { rect 0,0,640,480 nocursor 1 windowDef background_map { rect 64,48, 512, 394 background "guis/automap/map_of" visible 1 } ... // Required include for inventory map #include "guis/readables/inventory_map.guicode" }
In our case guis/automap/map_of is the file that holds the startmap. Where the dots are you have to add the following code for each area visible on the map.
windowDef nameOfArea { rect 100,100,380,300 background "path_to_imagefile" visible "gui::gui_XYZ" }
- nameOFArea can be choosen as you like, but each name must be unique and it makes sense to make it recogniseable
- path_to_imagefile holds the path to the image to be drawn. Where nothing gets drawn the image should be transparent
- the gui variable gui::gui_XYZ determines whether the image is visible or not. XYZ is the name of the corresponding location entity. You can easely get typos, so if something isn't working this is the first place to check
Note that all pictures are using the same area of the gui. This easens the setup, but must be taken into account when creating the images for the map.
The entity Definition
entityDef atdm:automap {
"inherit" "atdm:map_base"
"editor_usage" "game map of terrain for player" // THIS ONLY SHOWS IN ENTITY INSPECTOR
"inv_name" "Map" // SHOWS IN PLAYER'S INVENTORY. "inv_icon" "guis/assets/game_maps/map_of_icon.tga" "gui" "guis/automap/automap.gui" "scriptobject" "inventory_automap"
}
The important parts here are the gui spawnarg, letting it use the before mentioned gui, and the scriptobject spawnarg.
The script object
The scriptobject as well as an example setup can be found here[1]
Conclusion
It is quite simple to setup a fully functional automap. The main effort for the mapper is to actually draw the map.
Additions
If you want to test the alignment in game, just change the lines in the main method in the script file. Set all the values to "1".
If you want to have an automap that marks where the player currently is, the following changes need to be done:
- The mark method is called via "call_on_exit" by the zones. "call_on_entry" calls a similar function that sets the value for the room to "2"
- The show method checks for the values to be "1" or "2" separately. For "2" a highlighted version is shown on the map
- Obviously you have to make these highlighted version first
If you want the map to be fond in the mission you have to do the following to avoid the rooms the player was before finding the map to be drawn on it
- create a hidden, non-mandatory objective "if player possesses item". The item is the map.
- fill the success_script field with drawMap
- in the script file, add a float mapDraw at the beginning of the file
- set this to zero in the main method
- in the beginning of the mark method add the line if (!mapDraw) return;
Obviously you will need to do this several times if the player can find several maps. If so, be sure to make different mark methods for every map to be found (thus meaning entities in the map file)
You can use this setup as a starting point for setting up objectives like "investigate 50% of the area".
Questions, replies and advices of any kind can go here