From The Battle for Wesnoth Wiki

Making 'shroud_data'

As pointed out in SideWML you can add the key shroud_data to a [side] tag to describe what parts of the map should be shrouded for a side and what parts not. This comes in handy when you need to unshroud a large part of the map from the start of the game. When you would use the [remove_shroud] tag for that purpose (eg in the prestart event) you would have to a list of x,y coordinates and this can become somewhat lengthy, and it's difficult to find out what coordinates need to be set.

This tutorial is going to make a file containing the data that will unshroud those parts of the map you'd like to see unshrouded. All you need is:

  • the wesnoth map editor
  • your favorite text editor (with a search & replace function)
  • a spreadsheet like Microsoft Excel or Libreoffice Calc

Making your map

First of all you will need a map. This can be made in the wesnoth map editor (see BuildingMaps for more information) Once you've got that, make a copy. If you like to, you can renaim this copy to eg MapName_Shroud to indicate this file will contain the shroud data.

Selecting what tiles will be unshrouded + flipping the map

(Open MapName_Shroud again in the editor if you closed it) You can now select the tiles in the editor you want to be unshrouded. Hold shift and click left to (un)select a single tile and hold shift+alt and click left to select adjecent terrain tiles of the same type. Now fill your selection with one terrain type, and then select all the other tiles and fill it with another type.

Once that's done, you can save again and quit the editor.

Import the file in your spreadsheet (in Insert->Sheet From File) and select the comma as seperator. You should see an example of what it will look like, if each lettercombination has it's own cell, then things are good. Select all of the cells and press ctrl+x (Edit->Cut). Then select the top left most cell on the sheet and right click in it. Select 'Paste special'. A dialog window appears. There should be a checkbox name 'transpose', check it. Now you've switched the rows and columns in the map. Select all of your cells again and press ctrl+c (Edit->Copy). Open your favorite text editor and press ctrl+v in a new file. Save this file over your MapName_Shroud file.

Rewriting the data of the map

(Open MapName_Shroud in your text editor if you closed it) Now you'll see a (text) table containing the map data. You should see only two letter combinations are present, one for the shrouded part and one without. Use search and replace to search for the 'unshroud' letter combination (include leading and trailing spaces) and replace it with a '1' (without quotes). Then do the same for the 'shroud' combination and replace it with a '0'. Make sure nothing separates the zeros from the ones. Once All that is done you only need to add a pipe in front of each line in this file. The result should look something like this:


Save the file and reference it in you scenario .cfg-file like this (make sure the quotes are present, if not this will break the file):


Happy Unshrouding!

Fog Data

The same holds true for setting fog in scenarios (though of limited use), just replace shroud_data with fog_data in the side definition.

This page was last modified on 22 April 2015, at 07:49.