Difference between revisions of "BuildingScenariosSamples"
GrabberBot (talk | contribs) m (automated change of forum links) |
|||
| Line 24: | Line 24: | ||
id=tough_fight_ogre | id=tough_fight_ogre | ||
speaker=second_unit | speaker=second_unit | ||
| − | message= _ | + | message= _ "Whew! That was a tough fight!" |
[/message] | [/message] | ||
[/event] | [/event] | ||
| Line 36: | Line 36: | ||
id=konrad_scared | id=konrad_scared | ||
description=Konrad | description=Konrad | ||
| − | message= _ | + | message= _ "I feel uneasy about this place" |
[/message] | [/message] | ||
[/event] | [/event] | ||
| Line 47: | Line 47: | ||
id=which_way | id=which_way | ||
speaker=narrator | speaker=narrator | ||
| − | message= _ | + | message= _ "Which way do you wish to go?" |
[option] | [option] | ||
id=go_north | id=go_north | ||
| − | message= _ | + | message= _ "North" |
[command] | [command] | ||
[endlevel] | [endlevel] | ||
result=victory | result=victory | ||
| − | next_scenario= | + | next_scenario="Northern Advance" |
[/endlevel] | [/endlevel] | ||
[/command] | [/command] | ||
| Line 60: | Line 60: | ||
[option] | [option] | ||
id=go_south | id=go_south | ||
| − | message= _ | + | message= _ "South" |
[command] | [command] | ||
[endlevel] | [endlevel] | ||
result=victory | result=victory | ||
| − | next_scenario= | + | next_scenario="Southern Citadel" |
[/endlevel] | [/endlevel] | ||
[/command] | [/command] | ||
| Line 84: | Line 84: | ||
[message] | [message] | ||
description=Fred | description=Fred | ||
| − | message= _ | + | message= _ "I must go now, friends, but will return later!" |
[/message] | [/message] | ||
[kill] | [kill] | ||
| Line 119: | Line 119: | ||
[message] | [message] | ||
description=Fred | description=Fred | ||
| − | message= _ | + | message= _ "I have returned to aid you friends!" |
[/message] | [/message] | ||
[/then] | [/then] | ||
| Line 125: | Line 125: | ||
[message] | [message] | ||
description=Konrad | description=Konrad | ||
| − | message= _ | + | message= _ "I wish Fred were still alive. He would know what to do!" |
[/message] | [/message] | ||
[/else] | [/else] | ||
| Line 143: | Line 143: | ||
[message] | [message] | ||
role=undead_hater | role=undead_hater | ||
| − | message= _ | + | message= _ "The foul hordes of the undead approach, this battle will surely be tough!" |
[/message] | [/message] | ||
| Line 158: | Line 158: | ||
* [[BuildingScenarios]] | * [[BuildingScenarios]] | ||
* [[UsefulWMLFragments]] | * [[UsefulWMLFragments]] | ||
| − | |||
| − | |||
| − | |||
| − | |||
Revision as of 16:29, 21 January 2006
This page contains basic examples of WML. For more examples, you can look at the data of Wesnoth using a text editor.
to flash the screen red for a moment, we might go,
[colour_adjust] red=200 [/colour_adjust] [delay] time=20 [/delay] [colour_adjust] red=0 [/colour_adjust]
A unit remarking what a tough fight it was when they kill an Ogre:
[event] name=die [filter] type=Ogre [/filter] [message] id=tough_fight_ogre speaker=second_unit message= _ "Whew! That was a tough fight!" [/message] [/event]
Konrad remarks that he is scared at the start of a scenario: (Note the difference between the speaker= and the description= attributes in the two examples).
[event] name=start [message] id=konrad_scared description=Konrad message= _ "I feel uneasy about this place" [/message] [/event]
A selection of which way they should go at the end of a scenario:
[event]
name=victory
[message]
id=which_way
speaker=narrator
message= _ "Which way do you wish to go?"
[option]
id=go_north
message= _ "North"
[command]
[endlevel]
result=victory
next_scenario="Northern Advance"
[/endlevel]
[/command]
[/option]
[option]
id=go_south
message= _ "South"
[command]
[endlevel]
result=victory
next_scenario="Southern Citadel"
[/endlevel]
[/command]
[/option]
[/message]
[/event]
Suppose you want to make it so that if a certain character, we will call him Fred the Peasant, survives in a certain scenario, he will leave, but return in a later scenario. We can do this in the first scenario:
[event]
name=victory
[if]
[have_unit]
description=Fred
[/have_unit]
[then]
[message]
description=Fred
message= _ "I must go now, friends, but will return later!"
[/message]
[kill]
description=Fred
[/kill]
[set_variable]
name=fred_is_alive
value=yes
[/set_variable]
[/then]
[/if]
[/event]
This makes it so that if Fred is alive, he says something, then is removed from the game, and the variable 'fred_is_alive' is set to yes.
In a later scenario, we can use the following code:
[event]
name=turn 7
[if]
[variable]
name=fred_is_alive
equals=yes
[/variable]
[then]
[unit]
type=Peasant
description=Fred
side=1
x=8
y=1
[/unit]
[message]
description=Fred
message= _ "I have returned to aid you friends!"
[/message]
[/then]
[else]
[message]
description=Konrad
message= _ "I wish Fred were still alive. He would know what to do!"
[/message]
[/else]
[/if]
[/event]
If the variable 'fred_is_alive' equals 'yes' then this will create a unit, Fred, a Peasant, at (8,1), and he will give a greeting message. Otherwise, Konrad will lament Fred being dead.
Suppose the player has just come across some undead, you might like to find if the player has a unit that would truly hate the undead, and if so, and get it to say something:
[role] role=undead_hater type=Mage of Light,Paladin,White Mage [/role] [message] role=undead_hater message= _ "The foul hordes of the undead approach, this battle will surely be tough!" [/message]
[teleport]
[filter]
name=Garcimore
[/filter]
x=10
y=20
[/teleport]