Struggling to Get My Campaign to Load

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
CraZCanuck
Posts: 9
Joined: November 6th, 2020, 4:45 am

Struggling to Get My Campaign to Load

Post by CraZCanuck »

Hi guys,

First post here, very new to coding Wesnoth campaigns, but limited coding experience outside it, and years of playing this game have given me the urge to create a campaign.

I have attempted to follow the instructions as laid out in the wiki, but I will admit i may have been overly ambitious when creating this first scenario, which could be why it will not load. Here's the details.
  • First scenario is meant to be a defend mission, where a specific hex needs to be kept free from enemies for a fixed number of turns, unless you can defeat the boss.
  • There are five passive allies on the battlefield (the character's siblings)
  • I don't think i have properly added the units, which could be causing the issue? I really just need a veteran coder to help me a touch.
  • I have attached my current code. Don't go easy on me, if my code is bad, tell me it's bad and let me know how i can fix it. <3
    Disputed_Inheritance.zip
    (2.21 MiB) Downloaded 158 times
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: Struggling to Get My Campaign to Load

Post by WhiteWolf »

The first_scenario key should refer to the scenario id, and not the filename. So firstly you should replace first_scenario=01_Practice_Siege.cfg with first_scenario="01_Practice_Siege" in your _main.cfg.

I just scrolled through the scenario. One obvious error at the end:

Code: Select all

[event]
		name=die    
[/scenario]    
Either finish that event or comment it out, as it will prevent the game from loading. Also, fixing your indentation to a fixed convention will help you a lot in seeing syntax errors.

I'm personally wary of using accented characters like "É" in id's and keywords that are visible to WML and aren't just displayed strings. It should work in theory, but I just recommend using only unaccented characters in code.

Welcome to the forums btw :)
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
CraZCanuck
Posts: 9
Joined: November 6th, 2020, 4:45 am

Re: Struggling to Get My Campaign to Load

Post by CraZCanuck »

Thanks so much for the quick response! Now it at least loads, which will help me troubleshoot, playtest and get to work on the details.

You're a gem.
CraZCanuck
Posts: 9
Joined: November 6th, 2020, 4:45 am

Re: Struggling to Get My Campaign to Load

Post by CraZCanuck »

WhiteWolf wrote: November 13th, 2020, 6:26 pm I'm personally wary of using accented characters like "É" in id's and keywords that are visible to WML and aren't just displayed strings. It should work in theory, but I just recommend using only unaccented characters in code.

Welcome to the forums btw :)
It appears to be working in practice but i'll keep an eye out for any major issues with it.

Also, is there a way to set a defeat condition if an enemy stands on a specific hex? if so, how would one go about doing so?
Pilauli
Posts: 115
Joined: August 18th, 2020, 12:56 pm

Re: Struggling to Get My Campaign to Load

Post by Pilauli »

Use an [event] with name=moveto. Inside of that, filter by side (the side of the unit that just moved to a hex) and x and y (the coordinates of the hex). Then tell it to [endlevel] with result=defeat.

(Immediate edit because I cannot seem to think these things through):
The above would be how you make it so you actually lose if the enemy stands there. You will also need to write the proper [objectives] to make sure the player knows they need to protect that hex. I would strongly recommend copying an objectives block from some other campaign and changing the names.
gnombat
Posts: 704
Joined: June 10th, 2010, 8:49 pm

Re: Struggling to Get My Campaign to Load

Post by gnombat »

Pilauli wrote: November 13th, 2020, 8:08 pm Use an [event] with name=moveto. Inside of that, filter by side (the side of the unit that just moved to a hex) and x and y (the coordinates of the hex). Then tell it to [endlevel] with result=defeat.
There's an example of this in some mainline campaign scenarios, e.g., "Weldyn Besieged" in Eastern Invasion.
Post Reply