How to add custom terrain type
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
-
- Posts: 23
- Joined: July 26th, 2019, 4:10 pm
How to add custom terrain type
Hello. I want to add custom terrain type (village) and have it available in map editor. I was reading about TerrainWML and tried to copy this function from another modification. I can't do it. Can anyone explain me step by step how to do it?
- MoonyDragon
- Posts: 149
- Joined: November 29th, 2017, 5:46 pm
Re: How to add custom terrain type
I assume that you want to add a custom terrain to your own add-on as hacking into wesnoth is a rather ugly solution. So let's begin explaining the process step-by-step, using the fictitious "add-ons/My_Cool_UMC/".
1. You need to reference the folder containing the terrain files into your _main.cfg file. Usually, this is the
2. Copy the terrain images into a folder inside
3. Copy the [terrain_type] of your terrain into the file
4. Copy the [terrain_graphics] macros of your terrain into the file
That's it! But because a file says more than a thousand words...
1. You need to reference the folder containing the terrain files into your _main.cfg file. Usually, this is the
My_Cool_UMC/terrain/
folder, so including a {./terrain/}
is all you will need. Also, set up an [editor_group] to avoid confusion of custom and core terrain. To make your terrain accessible to the editor, include an additional #ifdef EDITOR
as in the link.2. Copy the terrain images into a folder inside
My_Cool_UMC/terrain/images/terrain/
. The engine automatically assumes that terrain images are there.3. Copy the [terrain_type] of your terrain into the file
My_Cool_UMC/terrain/terrain.cfg
. Don't forget to change the editor_group=
key to fit the editor group you defined in the first step.4. Copy the [terrain_graphics] macros of your terrain into the file
My_Cool_UMC/terrain/terrain-graphics.cfg
. Don't forget to change the paths of the images to fit the new location inside your add-on. You don't have to write out the path from step 2.That's it! But because a file says more than a thousand words...
Default L0 Era - Level 1 leaders with level 0 recruits!
-
- Posts: 23
- Joined: July 26th, 2019, 4:10 pm
Re: How to add custom terrain type
I did it. Thanks for help.