Victory when killing specific leaders
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.
- revansurik
- Posts: 604
- Joined: October 17th, 2012, 11:40 pm
- Location: Brazil
- Contact:
Victory when killing specific leaders
Hi folks! See if this is possible: in a scenario of my campaign, the player must defeat 2 specific leaders (out of 5) to win the scenario. Problem is, I'm not figuring out a way of making their deaths result in victory; I have used victor_when_enemies_defeated=no and the code below, but none works. Is there a way to make those 2 leaders' deaths the victory condition?
This is the code I tried; sides 3 and 4 are those of the leaders that must be killed; afterwards there is only some dialog and the endlevel=victory tag:
This is the code I tried; sides 3 and 4 are those of the leaders that must be killed; afterwards there is only some dialog and the endlevel=victory tag:
Code: Select all
[event]
name=enemies defeated
[filter]
side=3,4
[/filter]
Author of the Dragon Trilogy.
If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy ;-)
If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy ;-)
- Captain_Wrathbow
- Posts: 1664
- Joined: June 30th, 2009, 2:03 pm
- Location: Guardia
Re: Victory when killing specific leaders
Create two events, one for the death of each leader. In each event, check to see if the other leader is still living; if not, go to the victory event.
- revansurik
- Posts: 604
- Joined: October 17th, 2012, 11:40 pm
- Location: Brazil
- Contact:
Re: Victory when killing specific leaders
I hadn't thought of that... It worked, thanks very much!
Erm, just another little doubt I've just found, how does the store_unit_type tag works? I tried to use it to store all dwarf units on the recall list, but a message popped up saying 'invalid WML found: store_unit_type missing required type = attribute'
the code I used...
Erm, just another little doubt I've just found, how does the store_unit_type tag works? I tried to use it to store all dwarf units on the recall list, but a message popped up saying 'invalid WML found: store_unit_type missing required type = attribute'
the code I used...
Code: Select all
[store_unit_type]
[filter]
side=1
x,y=recall,recall
type=Dwarvish Fighter,Dwarvish Steelclad,Dwarvish Lord,Dwarvish Scout,Dwarvish Pathfinder,Dwarvish Explorer
[/filter]
kill=yes
variable=dwarf_workers
[/store_unit_type]
Author of the Dragon Trilogy.
If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy ;-)
If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy ;-)
Re: Victory when killing specific leaders
[store_unit_type]
only takes type=
as an argument, no [filter]
. If you want to use a filter like that, just use[store_unit]
.Co-Creator of The Fellowship of the Clay (BfW 1.10) ~~ Maintainer of the German Code of Conduct
How to isolate problematic WML code ~~ WML error messages and their reasons
How to isolate problematic WML code ~~ WML error messages and their reasons
- revansurik
- Posts: 604
- Joined: October 17th, 2012, 11:40 pm
- Location: Brazil
- Contact:
Re: Victory when killing specific leaders
Changed the code as below, still not working... I also tried without the 'side' and 'x,y', to no avail...
Maybe I'll just disallow the recruiting of dwarves, the way I want to make it is getting too complicated... later in the scenario, I'd put (or try to) the stored dwarves back to the recall list, and I don't know whether the code I used will work
This is the code, anyway...
Code: Select all
[store_unit_type]
side=1
x,y=recall,recall
type=Dwarvish Fighter,Dwarvish Steelclad,Dwarvish Lord,Dwarvish Scout,Dwarvish Pathfinder,Dwarvish Explorer
variable=dwarf_workers
[/store_unit_type]
This is the code, anyway...
Code: Select all
{PUT_TO_RECALL_LIST (
variable=dwarf_workers
)}
Author of the Dragon Trilogy.
If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy ;-)
If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy ;-)
Re: Victory when killing specific leaders
Use what you had before, but with
[store_unit]
, not [store_unit_type]
.- revansurik
- Posts: 604
- Joined: October 17th, 2012, 11:40 pm
- Location: Brazil
- Contact:
Re: Victory when killing specific leaders
I used [store_unit], and the units disappeared from the recall list; but, when I unstored them (at x,y=recall,recall), only 1 unit was back, and originally there were many.
Did I forget anything in the code, or should I use a different one?
Did I forget anything in the code, or should I use a different one?
Code: Select all
[unstore_unit]
variable=dwarf_workers
x=recall
y=recall
[/unstore_unit]
Author of the Dragon Trilogy.
If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy ;-)
If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy ;-)
- Pentarctagon
- Project Manager
- Posts: 5564
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Victory when killing specific leaders
If you store multiple units it creates an array of them, so you'll have to loop through and unstore all of them.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
- revansurik
- Posts: 604
- Joined: October 17th, 2012, 11:40 pm
- Location: Brazil
- Contact:
Re: Victory when killing specific leaders
and how could I make this loop...? (sorry, my knowledge of coding is still a bit limited )
Author of the Dragon Trilogy.
If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy ;-)
If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy ;-)
- Pentarctagon
- Project Manager
- Posts: 5564
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Victory when killing specific leaders
With the FOREACH macro:
Code: Select all
{FOREACH dwarf_workers i}
[unstore_unit]
variable=dwarf_workers[$i]
x=recall
y=recall
[/unstore_unit]
{NEXT i}
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
- revansurik
- Posts: 604
- Joined: October 17th, 2012, 11:40 pm
- Location: Brazil
- Contact:
Re: Victory when killing specific leaders
Yessss, it worked! Thanks a lot!
Author of the Dragon Trilogy.
If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy ;-)
If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy ;-)