<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.wesnoth.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sir+Jaques</id>
	<title>The Battle for Wesnoth Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.wesnoth.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sir+Jaques"/>
	<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/Special:Contributions/Sir_Jaques"/>
	<updated>2026-11-15T19:03:40Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=BuildingScenariosIntermediate&amp;diff=42791</id>
		<title>BuildingScenariosIntermediate</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=BuildingScenariosIntermediate&amp;diff=42791"/>
		<updated>2011-05-24T18:58:40Z</updated>

		<summary type="html">&lt;p&gt;Sir Jaques: /* Advanced Sides */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BuildingScenariosNav}}&lt;br /&gt;
&lt;br /&gt;
= Building scenarios: Intermediate =&lt;br /&gt;
In this tutorial we will dig somewhat deeper into the secrets of WML and scenario building: events, explaining the use of some special attributes, setting up somewhat more advanced sides, ...&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
You can trigger certain actions that occur during a scenario using the events mechanism. Let us look at an example of a simple event. Suppose you wanted Konrad to say &amp;quot;it&#039;s getting cold&amp;quot; when he moves to the location (4,8):&lt;br /&gt;
&lt;br /&gt;
  [event]&lt;br /&gt;
    name=moveto&lt;br /&gt;
    [filter]&lt;br /&gt;
      id=Konrad&lt;br /&gt;
      x=4&lt;br /&gt;
      y=8&lt;br /&gt;
     [/filter]&lt;br /&gt;
     [message]&lt;br /&gt;
       speaker=Konrad&lt;br /&gt;
       message= _ &amp;quot;It&#039;s getting cold&amp;quot;&lt;br /&gt;
     [/message]&lt;br /&gt;
  [/event]&lt;br /&gt;
&lt;br /&gt;
First you have the name of the event.&lt;br /&gt;
Here, we have a &#039;moveto&#039; event, meaning it is fired every time a unit moves somewhere.&lt;br /&gt;
For a list of the different possible event names, see [[EventWML]]&lt;br /&gt;
&lt;br /&gt;
Of course, we don&#039;t want this to be fired every single time some unit moves somewhere! So, we use the &#039;&#039;&#039;[filter]&#039;&#039;&#039; tag to filter out what kind of moveto event we want.&lt;br /&gt;
How filters are used is described in [[FilterWML]].&lt;br /&gt;
&lt;br /&gt;
== Special attributes ==&lt;br /&gt;
&lt;br /&gt;
Note that generally, a set of actions is triggered only once.&lt;br /&gt;
You can make a set of actions be triggered every time the event occurs&lt;br /&gt;
by adding the attribute &#039;&#039;&#039;first_time_only=no&#039;&#039;&#039; in the event.&lt;br /&gt;
&lt;br /&gt;
Also, whenever an event is triggered, the player cannot undo the move, even if it was a moveto event. We could make a scenario where moves cannot be undone by adding the event&lt;br /&gt;
&lt;br /&gt;
 [event]&lt;br /&gt;
   name=moveto&lt;br /&gt;
   first_time_only=no&lt;br /&gt;
 [/event]&lt;br /&gt;
&lt;br /&gt;
(which would not do anything, but would prevent the player from undoing moves)&lt;br /&gt;
&lt;br /&gt;
The event:&lt;br /&gt;
&lt;br /&gt;
 [event]&lt;br /&gt;
   name=enemies defeated&lt;br /&gt;
   [endlevel]&lt;br /&gt;
     result=victory&lt;br /&gt;
     bonus=yes&lt;br /&gt;
   [/endlevel]&lt;br /&gt;
 [/event]&lt;br /&gt;
&lt;br /&gt;
is an implied trigger and appears automatically at the end of each scenario.&lt;br /&gt;
To prevent this event, add the attribute &#039;&#039;&#039;victory_when_enemies_defeated=no&#039;&#039;&#039; inside the main tag (usually [scenario]).&lt;br /&gt;
&lt;br /&gt;
The attribute &#039;&#039;&#039;disallow_recall=yes&#039;&#039;&#039; prevents the player from recalling units in this scenario.&lt;br /&gt;
&lt;br /&gt;
The attributes &#039;&#039;&#039;fog=yes&#039;&#039;&#039; and &#039;&#039;&#039;shroud=yes&#039;&#039;&#039; can be put in a &#039;&#039;&#039;[side]&#039;&#039;&#039; tag to make that side have fog of war/shroud. (Fog of war prevents seeing all enemy movement, shroud prevents seeing all of the map.) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advanced Sides ==&lt;br /&gt;
&lt;br /&gt;
Ok, so as you have seen in [[BuildingScenariosSimple]], you can setup what the human player and AI player start with, and some simple options for controlling how the AI works. From the &#039;&#039;&#039;[side]&#039;&#039;&#039; tag listed below you can see we are going to learn some more interesting things that can be controlled from there. I&#039;m not going to explain all the keys, just the new ones.&lt;br /&gt;
&lt;br /&gt;
 [scenario]&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 &lt;br /&gt;
   [side]&lt;br /&gt;
     type=Lich&lt;br /&gt;
     id=Galga&lt;br /&gt;
     side=2&lt;br /&gt;
     canrecruit=yes&lt;br /&gt;
 &lt;br /&gt;
     #ifdef EASY&lt;br /&gt;
      recruit=Skeleton,Revenant,Blood Bat,Ghost,Bone Shooter&lt;br /&gt;
      recruitment_pattern=fighter,fighter,archer,scout&lt;br /&gt;
      gold=300&lt;br /&gt;
     #endif&lt;br /&gt;
 &lt;br /&gt;
     #ifdef NORMAL&lt;br /&gt;
      recruit=Skeleton,Revenant,Chocobone,Blood Bat,Wraith,Bone Shooter,Dark Adept &lt;br /&gt;
      recruitment_pattern=fighter,fighter,archer,scout&lt;br /&gt;
      gold=500&lt;br /&gt;
     #endif&lt;br /&gt;
 &lt;br /&gt;
     #ifdef HARD&lt;br /&gt;
      recruit=Skeleton,Revenant,Chocobone,Wraith,Bone Shooter,Dark Adept&lt;br /&gt;
      recruitment_pattern=fighter,fighter,archer,scout&lt;br /&gt;
      gold=700&lt;br /&gt;
     #endif&lt;br /&gt;
 &lt;br /&gt;
     aggression=1.0&lt;br /&gt;
     village_value=0.0&lt;br /&gt;
     leader_value=50.0&lt;br /&gt;
     enemy=1&lt;br /&gt;
   [/side]&lt;br /&gt;
 [/scenario]&lt;br /&gt;
&lt;br /&gt;
As you can see from the above listing, the &#039;&#039;&#039;[side]&#039;&#039;&#039; tag can get a little complex. &lt;br /&gt;
The &#039;&#039;&#039;#ifdef&#039;&#039;&#039; is relatively simple to understand. If the user is playing EASY then everything between &#039;&#039;&#039;#ifdef EASY&#039;&#039;&#039; and &#039;&#039;&#039;#endif&#039;&#039;&#039; is set and the others are ignored. If the user is playing NORMAL then everything between &#039;&#039;&#039;#ifdef NORMAL&#039;&#039;&#039; and &#039;&#039;&#039;#endif&#039;&#039;&#039; is set and the others are ignored. Finally if the user is playing HARD then everything between &#039;&#039;&#039;#ifdef HARD&#039;&#039;&#039; and &#039;&#039;&#039;#endif&#039;&#039;&#039; is set and the others are ignored. This allows a scenario to be configured differently for each level of gameplay the user may choose. There are also two new keys listed, &#039;&#039;&#039;village_value&#039;&#039;&#039; and &#039;&#039;&#039;leader_value&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lets get into some more interesting stuff. The map files hold the ground tiles. This is the very bottom layer of things. The units walking around during a game are on the very top layer. This is all well and good, but wouldn&#039;t it be nice to be able to place some unique items on the map? What if you wanted to place a building, or a potion, or anything somewhere in your scenario? Well you can! Using the &#039;&#039;&#039;[item]&#039;&#039;&#039; tag:&lt;br /&gt;
&lt;br /&gt;
 [scenario]&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 &lt;br /&gt;
   [item]&lt;br /&gt;
     x=31&lt;br /&gt;
     y=43&lt;br /&gt;
     image=item-holywater.png &lt;br /&gt;
   [/item]&lt;br /&gt;
 &lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 [/scenario]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;[item]&#039;&#039;&#039; tag is actually very simple to use, as you can see from above. There are three keys, the first two are &#039;&#039;&#039;x&#039;&#039;&#039; and &#039;&#039;&#039;y&#039;&#039;&#039;. They are the location on the map. The third key is &#039;&#039;&#039;image&#039;&#039;&#039;. This it the image file to place in that location. This image must be located in the images directory. Ok, that was simple wasn&#039;t it?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you have enough information to make some interesting looking scenarios with tuned AI players. This is a big step. Next we are going to learn how to make your newly created scenario fit nicely into a campaign. This involves making the intro shown before the scenario is played a bit more descriptive. This is all done from within the &#039;&#039;&#039;[story]&#039;&#039;&#039; tag.&lt;br /&gt;
&lt;br /&gt;
 [scenario]&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 &lt;br /&gt;
   [story]&lt;br /&gt;
    [part]&lt;br /&gt;
     background=portraits/elves/transparent/high-lord.png&lt;br /&gt;
     story= _ &amp;quot;...And so he entered the dark and gloomy cave...&amp;quot;&lt;br /&gt;
    [/part]&lt;br /&gt;
     .&lt;br /&gt;
     .&lt;br /&gt;
     . &lt;br /&gt;
   [/story]&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 . &lt;br /&gt;
 [/scenario]&lt;br /&gt;
&lt;br /&gt;
The story tag contains the story told before the player starts the scenario. You can ommit this, then you will skip the introductionary screens. A story tag exists out of parts (inside [part] tags). Each part can contain several keys describing what content it has got. See [[IntroWML]] for more information.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[ScenarioWML]] &amp;amp; [[SyntaxWML]]&lt;br /&gt;
* [[BuildingScenarios]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Create]]&lt;/div&gt;</summary>
		<author><name>Sir Jaques</name></author>
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=BuildingScenariosIntermediate&amp;diff=42790</id>
		<title>BuildingScenariosIntermediate</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=BuildingScenariosIntermediate&amp;diff=42790"/>
		<updated>2011-05-24T18:58:16Z</updated>

		<summary type="html">&lt;p&gt;Sir Jaques: /* Advanced Sides */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BuildingScenariosNav}}&lt;br /&gt;
&lt;br /&gt;
= Building scenarios: Intermediate =&lt;br /&gt;
In this tutorial we will dig somewhat deeper into the secrets of WML and scenario building: events, explaining the use of some special attributes, setting up somewhat more advanced sides, ...&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
You can trigger certain actions that occur during a scenario using the events mechanism. Let us look at an example of a simple event. Suppose you wanted Konrad to say &amp;quot;it&#039;s getting cold&amp;quot; when he moves to the location (4,8):&lt;br /&gt;
&lt;br /&gt;
  [event]&lt;br /&gt;
    name=moveto&lt;br /&gt;
    [filter]&lt;br /&gt;
      id=Konrad&lt;br /&gt;
      x=4&lt;br /&gt;
      y=8&lt;br /&gt;
     [/filter]&lt;br /&gt;
     [message]&lt;br /&gt;
       speaker=Konrad&lt;br /&gt;
       message= _ &amp;quot;It&#039;s getting cold&amp;quot;&lt;br /&gt;
     [/message]&lt;br /&gt;
  [/event]&lt;br /&gt;
&lt;br /&gt;
First you have the name of the event.&lt;br /&gt;
Here, we have a &#039;moveto&#039; event, meaning it is fired every time a unit moves somewhere.&lt;br /&gt;
For a list of the different possible event names, see [[EventWML]]&lt;br /&gt;
&lt;br /&gt;
Of course, we don&#039;t want this to be fired every single time some unit moves somewhere! So, we use the &#039;&#039;&#039;[filter]&#039;&#039;&#039; tag to filter out what kind of moveto event we want.&lt;br /&gt;
How filters are used is described in [[FilterWML]].&lt;br /&gt;
&lt;br /&gt;
== Special attributes ==&lt;br /&gt;
&lt;br /&gt;
Note that generally, a set of actions is triggered only once.&lt;br /&gt;
You can make a set of actions be triggered every time the event occurs&lt;br /&gt;
by adding the attribute &#039;&#039;&#039;first_time_only=no&#039;&#039;&#039; in the event.&lt;br /&gt;
&lt;br /&gt;
Also, whenever an event is triggered, the player cannot undo the move, even if it was a moveto event. We could make a scenario where moves cannot be undone by adding the event&lt;br /&gt;
&lt;br /&gt;
 [event]&lt;br /&gt;
   name=moveto&lt;br /&gt;
   first_time_only=no&lt;br /&gt;
 [/event]&lt;br /&gt;
&lt;br /&gt;
(which would not do anything, but would prevent the player from undoing moves)&lt;br /&gt;
&lt;br /&gt;
The event:&lt;br /&gt;
&lt;br /&gt;
 [event]&lt;br /&gt;
   name=enemies defeated&lt;br /&gt;
   [endlevel]&lt;br /&gt;
     result=victory&lt;br /&gt;
     bonus=yes&lt;br /&gt;
   [/endlevel]&lt;br /&gt;
 [/event]&lt;br /&gt;
&lt;br /&gt;
is an implied trigger and appears automatically at the end of each scenario.&lt;br /&gt;
To prevent this event, add the attribute &#039;&#039;&#039;victory_when_enemies_defeated=no&#039;&#039;&#039; inside the main tag (usually [scenario]).&lt;br /&gt;
&lt;br /&gt;
The attribute &#039;&#039;&#039;disallow_recall=yes&#039;&#039;&#039; prevents the player from recalling units in this scenario.&lt;br /&gt;
&lt;br /&gt;
The attributes &#039;&#039;&#039;fog=yes&#039;&#039;&#039; and &#039;&#039;&#039;shroud=yes&#039;&#039;&#039; can be put in a &#039;&#039;&#039;[side]&#039;&#039;&#039; tag to make that side have fog of war/shroud. (Fog of war prevents seeing all enemy movement, shroud prevents seeing all of the map.) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Advanced Sides ==&lt;br /&gt;
&lt;br /&gt;
Ok, so as you have seen in [[BuildingScenariosSimple]], you can setup what the human player and AI player start with, and some simple options for controlling how the AI works. From the &#039;&#039;&#039;[side]&#039;&#039;&#039; tag listed below you can see we are going to learn some more interesting things that can be controlled from there. I&#039;m not going to explain all the keys, just the new ones.&lt;br /&gt;
&lt;br /&gt;
 [scenario]&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 &lt;br /&gt;
   [side]&lt;br /&gt;
     type=Lich&lt;br /&gt;
     id=Galga&lt;br /&gt;
     side=2&lt;br /&gt;
     canrecruit=yes&lt;br /&gt;
 &lt;br /&gt;
     #ifdef EASY&lt;br /&gt;
      recruit=Skeleton,Revenant,Blood Bat,Ghost,Bone Shooter&lt;br /&gt;
      recruitment_pattern=fighter,fighter,archer,scout&lt;br /&gt;
      gold=300&lt;br /&gt;
     #endif&lt;br /&gt;
 &lt;br /&gt;
     #ifdef NORMAL&lt;br /&gt;
      recruit=Skeleton,Revenant,Chocobone,Blood Bat,Wraith,Bone Shooter,Dark Adept &lt;br /&gt;
      recruitment_pattern=fighter,fighter,archer,scout&lt;br /&gt;
      gold=500&lt;br /&gt;
     #endif&lt;br /&gt;
 &lt;br /&gt;
     #ifdef HARD&lt;br /&gt;
      recruit=Skeleton,Revenant,Chocobone,Wraith,Bone Shooter,Dark Adept&lt;br /&gt;
      recruitment_pattern=fighter,fighter,archer,scout&lt;br /&gt;
      gold=700&lt;br /&gt;
     #endif&lt;br /&gt;
 &lt;br /&gt;
     aggression=1.0&lt;br /&gt;
     village_value=0.0&lt;br /&gt;
     leader_value=50.0&lt;br /&gt;
     enemy=1&lt;br /&gt;
   [/side]&lt;br /&gt;
 [/scenario]&lt;br /&gt;
&lt;br /&gt;
As you can see from the above listing, the &#039;&#039;&#039;[side]&#039;&#039;&#039; tag can get a little complex. &lt;br /&gt;
The &#039;&#039;&#039;#ifdef&#039;&#039;&#039; is relatively simple to understand. If the user is playing EASY then everything between &#039;&#039;&#039;#ifdef EASY&#039;&#039;&#039; and &#039;&#039;&#039;#endif&#039;&#039;&#039; is set and the others are ignored. If the user is playing NORMAL then everything between &#039;&#039;&#039;#ifdef NORMAL&#039;&#039;&#039; and &#039;&#039;&#039;#endif&#039;&#039;&#039; is set and the others are ignored. Finally if the user is playing HARD then everything between &#039;&#039;&#039;#ifdef HARD&#039;&#039;&#039; and &#039;&#039;&#039;#endif&#039;&#039;&#039; is set and the others are ignored. This allows a scenario to be configured differently for each level of gameplay the user may choose. There are also two new keys listed, &#039;&#039;&#039;village_value&#039;&#039;&#039; and &#039;&#039;&#039;leader_value&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lets get into some more interesting stuff. The map files hold the ground tiles. This is the very bottom layer of things. The units walking around during a game are on the very top layer. This is all well and good, but wouldn&#039;t it be nice to be able to place some unique items on the map? What if you wanted to place a building, or a potion, or anything somewhere in your scenario? Well you can! Using the &#039;&#039;&#039;[item]&#039;&#039;&#039; tag:&lt;br /&gt;
&lt;br /&gt;
 [scenario]&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 &lt;br /&gt;
   [item]&lt;br /&gt;
     x=31&lt;br /&gt;
     y=43&lt;br /&gt;
     image=item-holywater.png &lt;br /&gt;
   [/item]&lt;br /&gt;
 &lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 [/scenario]&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;[item]&#039;&#039;&#039; tag is actually very simple to use, as you can see from above. There are three keys, the first two are &#039;&#039;&#039;x&#039;&#039;&#039; and &#039;&#039;&#039;y&#039;&#039;&#039;. They are the location on the map. The third key is &#039;&#039;&#039;image&#039;&#039;&#039;. This it the image file to place in that location. This image must be located in the images directory. Ok, that was simple wasn&#039;t it?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you have enough information to make some interesting looking scenarios with tuned AI players. This is a big step. Next we are going to learn how to make your newly created scenario fit nicely into a campaign. This involves making the intro shown before the scenario is played a bit more descriptive. This is all done from within the &#039;&#039;&#039;[story]&#039;&#039;&#039; tag.&lt;br /&gt;
&lt;br /&gt;
 [scenario]&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 &lt;br /&gt;
   [story]&lt;br /&gt;
    [part]&lt;br /&gt;
     background=portraits/elves/transparent/high-lord.png&lt;br /&gt;
     story= _ &amp;quot;...And so he entered the dark and gloomy cave...&amp;quot;&lt;br /&gt;
        [/part]&lt;br /&gt;
     .&lt;br /&gt;
     .&lt;br /&gt;
     . &lt;br /&gt;
   [/story]&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 . &lt;br /&gt;
 [/scenario]&lt;br /&gt;
&lt;br /&gt;
The story tag contains the story told before the player starts the scenario. You can ommit this, then you will skip the introductionary screens. A story tag exists out of parts (inside [part] tags). Each part can contain several keys describing what content it has got. See [[IntroWML]] for more information.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[ScenarioWML]] &amp;amp; [[SyntaxWML]]&lt;br /&gt;
* [[BuildingScenarios]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Create]]&lt;/div&gt;</summary>
		<author><name>Sir Jaques</name></author>
	</entry>
</feed>