Setting multiple objectives

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
malthaussen
Posts: 36
Joined: April 6th, 2024, 11:05 pm

Setting multiple objectives

Post by malthaussen »

I'd like to set multiple objectives which all must be met for a side's victory. eg, take cities a AND b, AND kill the enemy leader. It appears from what I've been looking at that all objectives are mutually exclusive, eg take city a OR b, OR kill the enemy leader. I want victory to happen when all three are true.

-- Mal
"Of two choices, I always take the third."
User avatar
Ravana
Forum Moderator
Posts: 3018
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Setting multiple objectives

Post by Ravana »

Check all of these conditions before using [endlevel].
User avatar
malthaussen
Posts: 36
Joined: April 6th, 2024, 11:05 pm

Re: Setting multiple objectives

Post by malthaussen »

I don't suppose you'd care to unpack that a little. How do I perform these checks? Inside what event?

-- Mal
"Of two choices, I always take the third."
white_haired_uncle
Posts: 1226
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: Setting multiple objectives

Post by white_haired_uncle »

You can use die or last breath for when the enemy leader dies and capture for when a village is captured as triggers. Then when one of those things happens you just need to check if the other two conditions are met and if so [endlevel]. [have_unit] can test if the enemy leader is alive/dead. Checking for ownership of a village is left as an exercise for the reader (aka I don't know how to do that, but I'd start https://wiki.wesnoth.org/StandardLocationFilter and search for "owner")

Hint: https://wiki.wesnoth.org/InternalAction ... cations.5D
Speak softly, and carry Doombringer.
User avatar
beetlenaut
Developer
Posts: 2827
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Setting multiple objectives

Post by beetlenaut »

There is also [have_location]. Used with owner_side and x,y coordinates, that would check for village ownership.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
lhybrideur
Posts: 369
Joined: July 9th, 2019, 1:46 pm

Re: Setting multiple objectives

Post by lhybrideur »

You can also use a variable and increment it each time one of the objective is completed or one for each objective, and check the value of the variable(s) to trigger [end_level]
Post Reply