Difference between revisions of "BuildingScenariosIntermediate"

From The Battle for Wesnoth Wiki
m (automated change of forum links)
m (Reverted edit of GrabberBot, changed back to last version by Drewed)
Line 1: Line 1:
<table width=100% border=0>
+
<table width=100% border=0>
&lt;tr&gt;
+
<tr>
&lt;td&gt;[[BuildingScenarios]]&lt;/td&gt;
+
<td>[[BuildingScenarios]]</td>
&lt;td&gt;[[BuildingScenariosWML]]&lt;/td&gt;
+
<td>[[BuildingScenariosWML]]</td>
&lt;td&gt;[[BuildingScenariosSimple]]&lt;/td&gt;
+
<td>[[BuildingScenariosSimple]]</td>
&lt;td&gt;[[BuildingScenariosIntermediate]]&lt;/td&gt;
+
<td>[[BuildingScenariosIntermediate]]</td>
&lt;td&gt;[[BuildingScenariosAdvanced]]&lt;/td&gt;
+
<td>[[BuildingScenariosAdvanced]]</td>
&lt;/tr&gt;&lt;tr&gt;
+
</tr><tr>
&lt;td&gt;&lt;/td&gt;
+
<td></td>
&lt;td&gt;[[BuildingScenariosComments]]&lt;/td&gt;
+
<td>[[BuildingScenariosComments]]</td>
&lt;td&gt;[[BuildingScenariosSamples]]&lt;/td&gt;
+
<td>[[BuildingScenariosSamples]]</td>
&lt;td&gt;[[BuildingScenariosFAQ]]&lt;/td&gt;
+
<td>[[BuildingScenariosFAQ]]</td>
&lt;td&gt;&lt;/td&gt;
+
<td></td>
&lt;/tr&gt;
+
</tr>
&lt;/table&gt;
+
</table>
  
  
&lt;&lt;&lt;&lt;&lt;&lt;&lt; [[BuildingScenariosIntermediate]]
+
<<<<<<< [[BuildingScenariosIntermediate]]
  
 
You can trigger certain actions that occur during a scenario using the events mechanism. Let us look at an example
 
You can trigger certain actions that occur during a scenario using the events mechanism. Let us look at an example
 
of
 
of
a simple event. Suppose you wanted Konrad to say &quot;it's getting cold&quot; when he moves to the location (4,8):
+
a simple event. Suppose you wanted Konrad to say "it's getting cold" when he moves to the location (4,8):
  
 
   [event]
 
   [event]
Line 31: Line 31:
 
   [message]
 
   [message]
 
   description=Konrad
 
   description=Konrad
   message= _ &quot;It's getting cold&quot;
+
   message= _ "It's getting cold"
 
   [/message]
 
   [/message]
 
   [/event]
 
   [/event]
Line 83: Line 83:
 
shroud prevents seeing all of the map.)
 
shroud prevents seeing all of the map.)
 
==== ====
 
==== ====
&gt;&gt;&gt;&gt;&gt;&gt;&gt; 1.4
+
>>>>>>> 1.4
  
 
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 '''[side]''' tag listed below you can see we are going to learn some more interesting things that can be controlled from there. I'm not going to explain all the keys, just the new ones.
 
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 '''[side]''' tag listed below you can see we are going to learn some more interesting things that can be controlled from there. I'm not going to explain all the keys, just the new ones.
Line 155: Line 155:
 
  [part]
 
  [part]
 
  id=intro_13
 
  id=intro_13
  story=&quot;... but one of the Orcs survived long enough to send the news to the queen...&quot;
+
  story="... but one of the Orcs survived long enough to send the news to the queen..."
 
  image=misc/story6.png
 
  image=misc/story6.png
 
  [/part]
 
  [/part]

Revision as of 16:51, 21 January 2006

BuildingScenarios BuildingScenariosWML BuildingScenariosSimple BuildingScenariosIntermediate BuildingScenariosAdvanced
BuildingScenariosComments BuildingScenariosSamples BuildingScenariosFAQ


<<<<<<< BuildingScenariosIntermediate

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 "it's getting cold" when he moves to the location (4,8):

 [event]
 name=moveto
  [filter]
  description=Konrad
  x=4
  y=8
  [/filter]
  [message]
  description=Konrad
  message= _ "It's getting cold"
  [/message]
 [/event]

Firstly you have the name of the event. This is a 'moveto' event, meaning it is fired every time a unit moves somewhere. For a list of the different possible event names, see EventWML

Of course, we don't want it to be fired everytime any unit moves anywhere, so we use the [filter] tag to filter out the kind of moveto event we want. Events can be filtered on many different parameters. Filters are described in FilterWML.

Special attributes

Note that generally, a set of actions is triggered only once. You can make a set of actions be triggered every time the event occurs by adding the attribute first_time_only=no in the event.

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

[event]
name=moveto
first_time_only=no
[/event]

which would not do anything, but would prevent the player from undoing moves.

The event

[event]
name=enemies defeated
 [endlevel]
 result=victory
 bonus=yes
 [/endlevel]
[/event]

is an implied trigger and appears automatically at the end of each scenario. To prevent this event, add the attribute victory_when_enemies_defeated=no inside the main tag (usually [scenario]).

The attribute disallow_recall=yes prevents the player from recalling units in this scenario.

The attributes fog=yes and shroud=yes can be put in a [side] 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.)

>>>>>>> 1.4

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 [side] tag listed below you can see we are going to learn some more interesting things that can be controlled from there. I'm not going to explain all the keys, just the new ones.

[scenario]
.
.
.

[side]
type=Lich
description=Galga
side=2
canrecruit=1

#ifdef EASY
 recruit=Skeleton,Revenant,Blood Bat,Ghost,Bone Shooter
 recruitment_pattern=fighter,fighter,archer,scout
 gold=300
#endif

#ifdef NORMAL
 recruit=Skeleton,Revenant,Chocobone,Blood Bat,Wraith,Bone Shooter,Dark Adept 
 recruitment_pattern=fighter,fighter,archer,scout
 gold=500
#endif

#ifdef HARD
 recruit=Skeleton,Revenant,Chocobone,Wraith,Bone Shooter,Dark Adept
 recruitment_pattern=fighter,fighter,archer,scout
 gold=700
#endif

aggression=1.0
village_value=0.0
leader_value=50.0
enemy=1
[/side]

[/scenario]

As you can see from the above listing, the [side] tag can get a little complex. The #ifdef is relitivly simple to explain. If the user is playing EASY then everything between #ifdef EASY and #endif is set and the others are ignored. If the user is playing NORMAL then everything between #ifdef NORMAL and #endif is set and the others are ignored. Finally if the user is playing HARD then everything between #ifdef HARD and #endif 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, village_value and leader_value.


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 wouldnt 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 with the [item] tag.

[scenario]
.
.
.

[item]
x=31
y=43
image=item-holywater.png 
[/item]

[/scenario]

The [item] tag is actually very simple to use, as you can see from above. There are three keys, the first two are x and y. They are the location on the map. The third key is image. This it the image file to place in that location. This image must be located in the images directory. Ok, that was simple wasn't it?


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 [story] tag.

[scenario]
.
.
.

[story]
[part]
id=intro_13
story="... but one of the Orcs survived long enough to send the news to the queen..." 
image=misc/story6.png
[/part]
[/story]

[scenario]

FIXME: finish [story]