Creating a simple add-on to load units

The place to post your WML questions and answers.

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.
Post Reply
User avatar
Posts: 2133
Joined: October 10th, 2016, 3:06 am

Creating a simple add-on to load units

Post by The_Gnat »

Hi, Stopsignal had asked how to load his unit he has created to play it in game and i thought (since he is planning on creating more units anyway) that creating a simple add-on would probably be the best option for him.

To create a simple add-on you need: :P (maybe this isn't as simple as i had originally said but if you read through the steps you should understand whats going happening)

1. a folder in the userdata/data/add-ons/ folder (this is your add-on's folder)

2. a _main.cfg file (which will load all your add-on for you place it in your addon folder)
what to put into the _main.cfg file
Inside the _main.cfg file you need:
- to load your images using:

Code: Select all

- to load your units using:

Code: Select all

- to only do this if you are playing multiplayer put the above two sections of code inside:

Code: Select all



3. a folder to store your units (just create another folder called units in your addon's folder and put all your units in it)

4. a folder to store your images (just create another folder called images in your addon's folder)
Other steps to create a multiplayer era
5. a folder called utils to store your era files

6. a file called YOUR_ERA.cfg in the utils folder and a file called YOUR_SIDE.cfg
- and inside YOUR_SIDE file put a multiplayer side:

Code: Select all

    name= _"YOUR_SIDES_NAME"
        recruitment_pattern=fighter, fighter, healer, mixed fighter
- and inside YOUR_ERA file put a multiplayer era:

Code: Select all

    name= _ "Default + YOUR_ERA_NAME"
    description= _ "The YOUR_ERA_NAME along with the standard factions"


In the previous two sections of code all the places where is says YOUR_XXXX just remove them and replace them with the what you want to go in their (ex: YOUR_FOLDER_NAME replace with Deepones_Era) (don't change RANDOM_SIDE or MAGENTA_IS_THE_TEAM_COLOR)
- and when you want to upload your add-on to the wesnoth add-on database you need a server.pbl file read this

I have attached a archive for Stopsignal which is an era that loads his units! (EDIT the newest version of stopsignals era the deepones is on the addon server for 1.12 it currently is in beta)

NOTE: the deepones era is available on the 1.12 add-on server.
Second version
(165.91 KiB) Downloaded 192 times
deepones era, EDIT: version 1.2
(134.79 KiB) Downloaded 189 times
Creator of: The Reign of The Lords Era,The Gnats Franken Dungeon
Co-designer of the (not-wesnoth) space combat video game Planet Bounce.
Post Reply