Question
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.
Question
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.
Which is why nothing I say makes sense.
- Elvish_Pillager
- Posts: 8137
- Joined: May 28th, 2004, 10:21 am
- Location: Everywhere you think, nowhere you can possibly imagine.
- Contact:
Re: Question
victory_when_enemies_defeated=no and a seperate event to cause victory. This does not work in MP.Assasin wrote:How do you code it so to be victorius you must kill all enemies, and not just the leaders?
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.
From a scenario I'm writing...
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.
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]
Forgot to add: In this example, side three has no leader.
I'm in my happy place... with all the dead bodies.
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.
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.
-
- Posts: 873
- Joined: July 4th, 2004, 9:14 pm
- Location: My imagination
- Contact:
Code: Select all
[have_unit]
side=2,3 #whichever sides are your enemies
[/have_unit]
Yes, except that there is no unit type "Dwarf". Maybe you are looking for race=dwarf?Assasin wrote:so...would it work the same way if I set the have_unit type as Dwarf
That would not do anything at all. 'id' is not a condition checker.Assasin wrote:Or set the id=dwarf as being the condition?
Play a Silver Mage in the Wesvoid campaign.