Question

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.
Post Reply
Assasin
Posts: 956
Joined: March 15th, 2005, 3:51 am
Location: Where ever my mind takes me
Contact:

Question

Post by Assasin »

How do you code it so to be victorius you must kill all enemies, and not just the leaders?
I speak what's on my mind.

Which is why nothing I say makes sense.
User avatar
Elvish_Pillager
Posts: 8129
Joined: May 28th, 2004, 10:21 am
Location: Everywhere you think, nowhere you can possibly imagine.
Contact:

Re: Question

Post by Elvish_Pillager »

Assasin wrote:How do you code it so to be victorius you must kill all enemies, and not just the leaders?
victory_when_enemies_defeated=no and a seperate event to cause victory. This does not work in MP.
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
Ulf
Posts: 12
Joined: June 23rd, 2005, 6:30 pm

Post by Ulf »

From a scenario I'm writing...

Code: Select all

        victory_when_enemies_defeated=no
(... more code ...)
        # --- Trigger victory when all wolves on side 3 are dead
        [event]
                name=die
                first_time_only=no
                [filter]
                        side=3
                [/filter]
                [if]
                        [have_unit]
                                type=Wolf
                        [/have_unit]
                        [else]
                                 [endlevel]
                                        result=victory
                                        # bonus=yes --- nah...
                                [/endlevel]
                        [/else]
                [/if]
        [/event]
Your event will, of course, be dependant on your scenario objectives. This one checks every time something is killed on side 3.

Forgot to add: In this example, side three has no leader.
I'm in my happy place... with all the dead bodies.
Assasin
Posts: 956
Joined: March 15th, 2005, 3:51 am
Location: Where ever my mind takes me
Contact:

Post by Assasin »

I'm not talking about MP. I want this for the Dark Elf Campagin. My question is, is it possible to do?
I speak what's on my mind.

Which is why nothing I say makes sense.
Ulf
Posts: 12
Joined: June 23rd, 2005, 6:30 pm

Post by Ulf »

The code fragment is from a single person campaign.

Normally victory_when_enemies_defeated is "yes". When the last enemy leader in the scenario is killed, the scenario goes into the end conditions, no matter if they still have troops out or not.

By turning it off, you are telling it you will manage the end condition. So you set up an event, or set of events, that trigger the endlevel stuff and send it the victory or defeat result, whichever is appropriate.

In my case, I have side one (the heroes), side two (the friendly peasants), and side three (the wolves). As the wolves have no leader in the Wesnoth sense, I had to find a way to trigger the end of the scenario when all of the wolves have been killed. This code works for me. Even if they had a "leader" in the Wesnoth sense, by turning off victory_when_enemies_defeated, the scenario would not end until all the 'wolves' on side three were killed.
I'm in my happy place... with all the dead bodies.
Assasin
Posts: 956
Joined: March 15th, 2005, 3:51 am
Location: Where ever my mind takes me
Contact:

Post by Assasin »

so...would it work the same way if I set the have_unit type as Dwarf? Or set the id=dwarf as being the condition?
I speak what's on my mind.

Which is why nothing I say makes sense.
Invisible Philosopher
Posts: 873
Joined: July 4th, 2004, 9:14 pm
Location: My imagination
Contact:

Post by Invisible Philosopher »

Code: Select all

[have_unit]
side=2,3 #whichever sides are your enemies
[/have_unit]
Assasin wrote:so...would it work the same way if I set the have_unit type as Dwarf
Yes, except that there is no unit type "Dwarf". Maybe you are looking for race=dwarf?
Assasin wrote:Or set the id=dwarf as being the condition?
That would not do anything at all. 'id' is not a condition checker.
Play a Silver Mage in the Wesvoid campaign.
ott
Inactive Developer
Posts: 838
Joined: September 28th, 2004, 10:20 am

Post by ott »

See the first scenario of TDH for an example.
This quote is not attributable to Antoine de Saint-Exupéry.
Post Reply