New Campaign Not Loading

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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.
User avatar
junoslord
Posts: 82
Joined: June 11th, 2012, 3:13 pm
Location: Enveloping your left flank.

New Campaign Not Loading

Post by junoslord »

I'm making a simple two scenario campaign to start learning WML and have my _main.cfg file and the first scenario finished.

When I loaded BoW I kept getting cannot load this because of this bug problem, which I fixed, and was finally able to get into BoW without error warnings. When I try to play the thing though it doesn't load, just gives an 'unknown scenario' error message dumps me back to the main menu.

I think when I was debugging I over debugged and maybe took something important out... any help would be great. Thank you in advance.

Also, I write this in one draft, and it's not even meant to really be played, except that it should work. It's meant to learn the tricks of WML, so I'm not looking for story feedback. This is purely a coding exercise. When I do the next one, I'll take all you want to give...

***

Here's my _main.cfg:

Code: Select all

[textdomain]
    	name="wesnoth-Sample Campaign"
[/textdomain]

[campaign]
	id=SampCamp
	name= _ "Sample Campaign"
	abbrev=SC
    	define=CAMPAIGN_SAMPLE_CAMPAIGN

	icon= net.png
	image= fencer.png
	description= _ "My first campaign-- terrible!"
	difficulties=easy

	first_scenario=01_Recon_Patrol.cfg

	{~add-ons/Sample_Campaign/scenarios}
	{~add-ons/Sample_Campaign/maps}
	{~add-ons/Sample_Campaign/units}

[/campaign]
******

Here is the first scenario file, 01_Recon_Patrol.cfg:
Spoiler:
Attachments
map1.map
(4.22 KiB) Downloaded 98 times
01_Recon_Patrol.cfg
(7.63 KiB) Downloaded 97 times
_main.cfg
(441 Bytes) Downloaded 96 times
Last edited by Crendgrim on June 18th, 2012, 5:15 am, edited 1 time in total.
Reason: Added [code] tags
America-- Land of the Free, home of the Brave! "And now that we've taken care of the Braves we're coming after the Free."

"BANNED!!! What the hell do you mean BANNED? All I did was call one narrow-minded, power-hungry Nazi moderator a narrow-minded, power-hungry Nazi!"

Ceres
Forum Regular
Posts: 620
Joined: September 18th, 2010, 7:56 pm
Location: Germany

Re: New Campaign Not Loading

Post by Ceres »

junoslord wrote:

Code: Select all

first_scenario=01_Recon_Patrol.cfg
first_scenario should be your first scenario's id, not the file name.

Code: Select all

{~add-ons/Sample_Campaign/scenarios}
{~add-ons/Sample_Campaign/maps}
{~add-ons/Sample_Campaign/units}
These should be outside the [campaign] tag, and it it should be like

Code: Select all

#ifdef CAMPAIGN_SAMPLE_CAMPAIGN
 {~add-ons/Sample_Campaign/scenarios}
{~add-ons/Sample_Campaign/maps}
{~add-ons/Sample_Campaign/units}
#endif
Otherwise, your campaign files would be loaded every time any campaign is started, slowing down the loading process and preventing you from playing other campaigns in case of errors.

The first units that you create in your scenario's start event have no coordinates given (I don't know whether there're any default values, though).

In Swen's die event you didn't capitalize his id. Ids are always case-sensitive.

User avatar
junoslord
Posts: 82
Joined: June 11th, 2012, 3:13 pm
Location: Enveloping your left flank.

Re: New Campaign Not Loading

Post by junoslord »

Thanks for your quick reply.

I made the changes you pointed out, but am now having problem with an unknown unit type...
America-- Land of the Free, home of the Brave! "And now that we've taken care of the Braves we're coming after the Free."

"BANNED!!! What the hell do you mean BANNED? All I did was call one narrow-minded, power-hungry Nazi moderator a narrow-minded, power-hungry Nazi!"

User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: New Campaign Not Loading

Post by Crendgrim »

You are using the unit types Volunteer Peasant, Regular Bowman, Regular Spearman and Patrol Captain. Are you sure that all of them are defined somewhere (and at a place you include)?

Also, please use [code] tags when posting WML on the forums, which makes it easier to read. :)
UMC Story Images — Story images for your campaign!

User avatar
junoslord
Posts: 82
Joined: June 11th, 2012, 3:13 pm
Location: Enveloping your left flank.

Re: Unknown Unit: Patrol Captain

Post by junoslord »

Crendgrim wrote:Are you sure that all of them are defined somewhere (and at a place you include)?
All I did was edit and save a Longbowman file as Patrol Captain.

The files are in the units directory. Here is the Patrol Captain file:
Spoiler:


EDIT> I thought if I just put the new units in the /units folder it would work.
America-- Land of the Free, home of the Brave! "And now that we've taken care of the Braves we're coming after the Free."

"BANNED!!! What the hell do you mean BANNED? All I did was call one narrow-minded, power-hungry Nazi moderator a narrow-minded, power-hungry Nazi!"

User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: New Campaign Not Loading

Post by zookeeper »

Filenames don't matter. The id matters, and the id is Master Bowman, not Patrol Captain.

User avatar
junoslord
Posts: 82
Joined: June 11th, 2012, 3:13 pm
Location: Enveloping your left flank.

Re: New Campaign Not Loading

Post by junoslord »

I get that... I even changed it, but it still comes back unknown.

Also, if I change everything out to the core unit names the thing runs.
Spoiler:
America-- Land of the Free, home of the Brave! "And now that we've taken care of the Braves we're coming after the Free."

"BANNED!!! What the hell do you mean BANNED? All I did was call one narrow-minded, power-hungry Nazi moderator a narrow-minded, power-hungry Nazi!"

User avatar
lipk
Developer
Posts: 637
Joined: July 18th, 2011, 1:42 pm

Re: New Campaign Not Loading

Post by lipk »

Your _main.cfg is still wrong. You don't have to include the maps there (I believe you must not, in fact). You get the unknown unit type error because you include the scenario data before the units, so at the time it is being parsed, your custom units are not yet defined. All in all, your #ifdef section should look like this:

Code: Select all

#ifdef CAMPAIGN_SAMPLE_CAMPAIGN
    #as soon as you wish to use custom images, music or whatever content in your campaign, you'll need this, too
    #[binary_path]
    #    path=data/add-ons/Sample_Campaign
    #[/binary_path]

    [+units]
        {~add-ons/Sample_Campaign/units}
    [/units]
    {~add-ons/Sample_Campaign/scenarios}
#endif

User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: New Campaign Not Loading

Post by Crendgrim »

lipk wrote:You don't have to include the maps there (I believe you must not, in fact).
You can include the map directory, but that will do just nothing. See this page for how inclusion works: http://wiki.wesnoth.org/PreprocessorRef ... inclusions
UMC Story Images — Story images for your campaign!

User avatar
Elvish_Hunter
Forum Moderator
Posts: 1438
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: New Campaign Not Loading

Post by Elvish_Hunter »

Moved to WML Workshop.
Current maintainer of these add-ons:
1.14: The Sojournings of Grog, A Rough Life, The White Troll (co-author), Wesnoth Lua Pack
1.12: Children of Dragons

User avatar
junoslord
Posts: 82
Joined: June 11th, 2012, 3:13 pm
Location: Enveloping your left flank.

Re: New Campaign Not Loading

Post by junoslord »

lipk wrote:Your _main.cfg is still wrong. ... All in all, your #ifdef section should look like this:
Thank you for your help! I copy and pasted and now it's working like it should.
America-- Land of the Free, home of the Brave! "And now that we've taken care of the Braves we're coming after the Free."

"BANNED!!! What the hell do you mean BANNED? All I did was call one narrow-minded, power-hungry Nazi moderator a narrow-minded, power-hungry Nazi!"

User avatar
junoslord
Posts: 82
Joined: June 11th, 2012, 3:13 pm
Location: Enveloping your left flank.

First scenario done...

Post by junoslord »

I have the first scenario working as it should and all my new units are loading properly, so thank you for your help with that.

At this point I have the second scenario loading properly... with all the units and dialogue from the first scenario. :wink:

I have a few questions for this one and rather than you guys just plop down answers I was hoping for "go to Liberty, #7" to see an example of this WML. (I have to admit to only playing half a dozen or so mainline campaigns and aren't very familiar with many of them.) With that said here goes:

1. How do I not activate a enemy leader until [event/whatever]?
............This has game play implications down the road, plus I'd like it for the second scenario. (If someone could give me a scenario example and leader id.)

2. How do I define village ownership?
............This would be nice for inactive leaders to not spend turns collecting near villages after they start.

3. If I try to recall a dead unit will the scenario crash or skip over the recall?
............How do I maintain story integrity if one of my speaking NPC's is toast? How do I replace, or reassign their lines?

4. Here's a piece of code:
Spoiler:
Quick Note: Not for this campaign, but I came across this and had a thought for another campaign where I have a unit sergeant as the main NPC, and narrator. Not a hero, but in every episode. There's another with player controlled faction leaders, the Outlaw, mercenary, and dwarvish factions all have one.

Using this code could I replace him with another unit to become the main NPC and narrator? Or a new faction leader?

Also, if I am correct this code is a way to select a random unit, not Harper, to be a talking part during this event? And I could continue the [not] list down to include Jack and Jill, and whoever, as well?
America-- Land of the Free, home of the Brave! "And now that we've taken care of the Braves we're coming after the Free."

"BANNED!!! What the hell do you mean BANNED? All I did was call one narrow-minded, power-hungry Nazi moderator a narrow-minded, power-hungry Nazi!"

User avatar
UnwiseOwl
Posts: 486
Joined: April 9th, 2010, 4:58 am

Re: New Campaign Not Loading

Post by UnwiseOwl »

1. How do I not activate a enemy leader until [event/whatever]?
This is done primarily by use of the no_leader=yes tag when defining the opponent side, but will probably also need victory_when_enemies_defeated=no in the scenario which effectively cancels the victory condition when there are no enemy leaders, and will require you to define how you actually win the scenario. I can't think of a version of this in mainline, for some reason, though I'm sure that there must be many of them, but this is how scenario 1 of the Imperial Era camapign 'Fall of Silvium' works. You can download it (and Imperial Era Fixed) from the 1.8 add-ons server to see the code.
2. How do I define village ownership?
From the ever useful http://www.wesnoth.org/macro-reference.html:
STARTING_VILLAGES SIDE RADIUS
Macro to make a side start a scenario with villages. Creates an event, so it must be called from within the toplevel scenario tag. Also note that this relies on the side having a unit with canrecruit-yes at start; if it doesn't, you should use STARTING_VILLAGES_AREA instead.
STARTING_VILLAGES_AREA SIDE X Y RADIUS
Make a side start with ownership of villages in a given area. Creates an event, so it must be called from within the toplevel scenario tag.
STARTING_VILLAGES_ALL SIDE
Make a side start with ownership of all villages. Creates an event, so it must be called from within the toplevel scenario tag.
Again, the first of these is used in 'Fall of Silvium', first in scenario 2 "The Raid"
3. If I try to recall a dead unit will the scenario crash or skip over the recall?
It will just skip the recall. This is detailed here:http://wiki.wesnoth.org/DirectActionsWML#.5Brecall.5D and of course you can see it in action is basically every campaign ever. 'Fall of Silvium' has three or four loyal recalls in every mission.

And yep, right on about the [role] tags.
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.

User avatar
Alarantalara
Art Contributor
Posts: 784
Joined: April 23rd, 2010, 8:17 pm
Location: Canada

Re: New Campaign Not Loading

Post by Alarantalara »

UnwiseOwl wrote:
junoslord wrote: 1. How do I not activate a enemy leader until [event/whatever]?
I can't think of a version of this in mainline, for some reason, though I'm sure that there must be many of them...
If you want some mainline examples, Under the Burning Suns does it in scenarios 1, 2, 3, 5, 6a, 6b, 8, 9 and 10.

User avatar
junoslord
Posts: 82
Joined: June 11th, 2012, 3:13 pm
Location: Enveloping your left flank.

Re: New Campaign Not Loading

Post by junoslord »

Thanks guys, I think you just gave me 2 or 3 days with new stuff to try.
America-- Land of the Free, home of the Brave! "And now that we've taken care of the Braves we're coming after the Free."

"BANNED!!! What the hell do you mean BANNED? All I did was call one narrow-minded, power-hungry Nazi moderator a narrow-minded, power-hungry Nazi!"

Post Reply