Creating a campaign
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.
- Daniel17022002
- Posts: 53
- Joined: November 22nd, 2015, 3:54 pm
- Location: Romania,Bucharest
Creating a campaign
Hey everyone! Sorry if I waste your time with my post but I'm willing to try create my first campaign around here and I don't really know where to start from ( I'm learning C++ currently and I know nothing about the language of coding of wesnoth yet so, well... ). Any tips?
My steam : http://steamcommunity.com/id/DanTheAssassin/
Re: Creating a campaign
The very first thing to do would be to find your add-ons directory and look through someone else's add-on (there are a couple simple add-ons designed exactly for this, one is called something like "Campaign-How-To, a simple campaign"). Just explore to get an idea for how things are organized, and glance through some of the .cfg files. They're written in WML, which is really beginner friendly. When that gets boring, copy the whole folder and start changing stuff to make it your own. Start with the file called _main.cfg, then probably the first scenario.
If that approach doesn't work well for you, take a look at the "Create" section of the website, right next to "Forums" on the black bar at the top of this page. It has lots of information about basically everything. Especially useful is ReferenceWML, which is a very good wiki describing just about everything there is to know about WML. I also found this article very useful, not for details on what code to put where, but for big-picture design principles.
And of course, if you run into errors that you can't solve yourself, then you can always post questions here.
If that approach doesn't work well for you, take a look at the "Create" section of the website, right next to "Forums" on the black bar at the top of this page. It has lots of information about basically everything. Especially useful is ReferenceWML, which is a very good wiki describing just about everything there is to know about WML. I also found this article very useful, not for details on what code to put where, but for big-picture design principles.
And of course, if you run into errors that you can't solve yourself, then you can always post questions here.
The last few months have been nothing but one big, painful reminder that TIMTLTW.
Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
- Daniel17022002
- Posts: 53
- Joined: November 22nd, 2015, 3:54 pm
- Location: Romania,Bucharest
Re: Creating a campaign
Hey! Is't very simple.
Go to your addon directory and create new folder. In this folder create new text file. Change name of file to _main and extension to .cgf so you have _main.cfg. Now you are set, you have your own addon. WML is not like C++, it's more like HTML, but even simplier. To add something new to game, you just need to create proper tag. If your _main.cfg looks like:
your addon adds now new camaping to the game. It's all just that simple. You can customize you campaing by changing default values of keys inside of this tag. Some of this keys, like id, must be set, becouse have no default values (or your addon will crash). Notice that your campaing will aslo need scenarios to work and scenarions will need maps made in wesnoth map editor. If you want split your code to difetent .cfg files, you can add {~add-ons/<your_addon_folder_name>/<rest_of_path_to_file_or_folder_to_load_all_files_in_this_folder>} in yout _main.cfg. Check like things are done in other addons. It will help you a lot. Good luck!
Some documenation links for you:
https://wiki.wesnoth.org/CampaignWML
https://wiki.wesnoth.org/ScenarioWML
Go to your addon directory and create new folder. In this folder create new text file. Change name of file to _main and extension to .cgf so you have _main.cfg. Now you are set, you have your own addon. WML is not like C++, it's more like HTML, but even simplier. To add something new to game, you just need to create proper tag. If your _main.cfg looks like:
Code: Select all
[campaign]
[/campaign]
Some documenation links for you:
https://wiki.wesnoth.org/CampaignWML
https://wiki.wesnoth.org/ScenarioWML
- Daniel17022002
- Posts: 53
- Joined: November 22nd, 2015, 3:54 pm
- Location: Romania,Bucharest
Re: Creating a campaign
quick dumb question, what is the .cfg extension as it seems I am unable to open it
edit : nevermind, I guess it is notepad as I learned a little bit of HTML this week ( luckily )
edit : nevermind, I guess it is notepad as I learned a little bit of HTML this week ( luckily )
My steam : http://steamcommunity.com/id/DanTheAssassin/
Re: Creating a campaign
It's text file. You can open it with any text editor. If you are on windows i recomend notepad++.
- Daniel17022002
- Posts: 53
- Joined: November 22nd, 2015, 3:54 pm
- Location: Romania,Bucharest
Re: Creating a campaign
I spent an hour and got the campaign to appear on my campaign list, it now also has a name, a description, icon and picture! Now I'll have to learn do all the rest
My steam : http://steamcommunity.com/id/DanTheAssassin/
Re: Creating a campaign
Stick with it, I'm sure you'll get there. Five years into campaign creating and I'm still hoping that 'the rest' will click into place for me some time!
Maintainer of the Imperial Era and the campaigns Dreams of Urduk, Epic of Vaniyera, Up from Slavery, Fall of Silvium, Alfhelm the Wise and Gali's Contract.
But perhaps 'maintainer' is too strong a word.
But perhaps 'maintainer' is too strong a word.
- Daniel17022002
- Posts: 53
- Joined: November 22nd, 2015, 3:54 pm
- Location: Romania,Bucharest
Re: Creating a campaign
I started from 0 as I want to fully understand everything and I will probably look up for some tutorials and explanations for WML
My steam : http://steamcommunity.com/id/DanTheAssassin/
- Daniel17022002
- Posts: 53
- Joined: November 22nd, 2015, 3:54 pm
- Location: Romania,Bucharest
Re: Creating a campaign
I have a little problem , I seem to not be able to put units for the difficulties? (I tried with official examples from the WML pages but nothing happens, only the text.
My steam : http://steamcommunity.com/id/DanTheAssassin/
Re: Creating a campaign
What do you mean by this? Please post your not working code.
- Daniel17022002
- Posts: 53
- Joined: November 22nd, 2015, 3:54 pm
- Location: Romania,Bucharest
Re: Creating a campaign
This is the code( with the things that don't work removed , sorry but I removed them before seeing your post):
Well, the first scenario sure doesn't work ( I don't know why, guess I need an ifdef or something but I still don't understand that part well) and if you could send me the code for difficulty icons it would be great ( and also where to find the icons' names)
Code: Select all
[campaign]
name=_ "Sample"
id=Sample
define=SAMPLE
abbrev="SAM"
first_scenario=01_Template
difficulties=Easy,Normal,Hard
icon=data/add-ons/Sample/images/bookshelf-full.png
image=portraits/humans/assassin.png
description=_"My first Campaign!"
[/campaign]
My steam : http://steamcommunity.com/id/DanTheAssassin/
Re: Creating a campaign
Adduming you mean the images for difficulcy descptions, this depends on which wesnoth version you use since the syntax has changed in 1.13.x. So if you develop for wewnoth 1.12 i reccomend not bother learning the old syntax descptions syntax and instead focus on creating an actual playable scenario first.Daniel17022002 wrote:I have a little problem , I seem to not be able to put units for the difficulties? (I tried with official examples from the WML pages but nothing happens, only the text.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: Creating a campaign
You should use an #ifdef, but it's actually only necessary for making the campaign play well with others. What you didn't do is tell the game where your scenario is. You need a line like this:Daniel17022002 wrote:I need an ifdef or something
{~add-ons/Sample/scenarios}
pointing to the folder where you put the scenario .cfg. "~add-ons" is a code that specifies the normal add-ons folder, wherever that is on the system. The curly braces mean "put all this stuff here", which in the context of a _main.cfg basically means "load this". You will eventually need lines like that for other folders too like custom units and macros.Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
- Daniel17022002
- Posts: 53
- Joined: November 22nd, 2015, 3:54 pm
- Location: Romania,Bucharest
Re: Creating a campaign
thanks a ton! now I actually should get learning about the scenario.cfg file, the macros and ifdef
My steam : http://steamcommunity.com/id/DanTheAssassin/