Difference between revisions of "DirectActionsWML"
(→[move_unit]) |
(→[unstore_unit]) |
||
Line 67: | Line 67: | ||
* '''red''', '''green''', '''blue''': (default=0,0,0) the color to display the text in. Values vary from 0-255. You may find it convenient to use the {COLOR_HARM} or {COLOR_HEAL} macro instead. (Use {COLOR_HARM} or {COLOR_HEAL} instead of the whole red,green,blue= line.) | * '''red''', '''green''', '''blue''': (default=0,0,0) the color to display the text in. Values vary from 0-255. You may find it convenient to use the {COLOR_HARM} or {COLOR_HEAL} macro instead. (Use {COLOR_HARM} or {COLOR_HEAL} instead of the whole red,green,blue= line.) | ||
* '''advance''': (default=true) if true the unit is advanced if it has enough XP. When modifying XP make sure to do it from inside a [[EventWML#Multiplayer_safety|synchronized event]] or it may lead to OOS errors especially when several advancement paths exist. Note that advance and post advance events are called, so infinite loops can happen. | * '''advance''': (default=true) if true the unit is advanced if it has enough XP. When modifying XP make sure to do it from inside a [[EventWML#Multiplayer_safety|synchronized event]] or it may lead to OOS errors especially when several advancement paths exist. Note that advance and post advance events are called, so infinite loops can happen. | ||
− | * '''x''' ,'''y''': override unit location | + | * '''x''' ,'''y''': override unit location, "x,y=recall, recall" will put the unit on the unit's side's recall list. |
=== [allow_recruit] === | === [allow_recruit] === |
Revision as of 20:55, 12 September 2010
Contents
- 1 Direct actions
- 1.1 [endlevel]
- 1.2 [unit]
- 1.3 [recall]
- 1.4 [teleport]
- 1.5 [terrain_mask]
- 1.6 [terrain]
- 1.7 [gold]
- 1.8 [unstore_unit]
- 1.9 [allow_recruit]
- 1.10 [disallow_recruit]
- 1.11 [set_recruit]
- 1.12 [modify_side]
- 1.13 [modify_turns]
- 1.14 [capture_village]
- 1.15 [kill]
- 1.16 [move_unit]
- 1.17 [petrify]
- 1.18 [unpetrify]
- 1.19 [object]
- 1.20 [remove_shroud]
- 1.21 [place_shroud]
- 1.22 [allow_undo]
- 1.23 [heal_unit]
- 1.24 [time_area]
- 1.25 [end_turn]
- 1.26 [replace_map]
- 1.27 [replace_schedule]
- 1.28 [tunnel]
- 2 Useful Macros
- 3 See Also
Direct actions
Direct actions are actions that have a direct effect on gameplay. They can be used inside of events.
The following tags are actions:
[endlevel]
Ends the scenario.
- result: before the scenario is over, all events with name=result are triggered. The message result_message with the heading result_heading (see LanguageWML) are displayed. If result=victory, the player progresses to the next level; if result=defeat, the game returns to the main menu. These last two are rarely used: result=continue behaves identically to result=victory except the player's gold is not reduced to 80%, and it does not bring up a "Victory" message or the gold changing message (since it doesn't change); result=continue_no_save works similarly, except the player is not asked whether to save the game, and is taken directly to the next scenario without any messages. Template:DevFeature: All values for result=... except victory and defeat are being discarded in favor of modifying [endlevel] behaviour with single keys.
Unless result=defeat, the following keys can also be used:
- bonus: whether the player should get bonus gold (maximum possible gold that could have been earned by waiting the level out). The default is bonus=yes.
- carryover_report: whether the player should receive a summary of the scenario outcome, the default is carryover_report=yes.
- save: whether a start-of-scenario save should be created for the next scenario, the default is save=yes.
- linger_mode: If ...=yes, the screen is greyed out and there's the possibility to save before advancing to the next scenario, the default is linger_mode=yes.
- reveal_map: (Multiplayer only) (Default is 'yes') If 'no', shroud doesn't disappear when game ended. Template:DevFeature1.9
- next_scenario: (default specified in [scenario] tag) the ID of the next scenario that should be played. All units that side 1 controls at this point become available for recall in next_scenario.
When the result is "victory" the following keys can be used:
- carryover_percentage: by default 80% of the gold is carried over to the next scenario, with this key the amount can be changed.
- carryover_add: if true the gold will be added to the starting gold the next scenario, if false the next scenario will start with the amount of the current scenario (after taxes) or the minimum in the next scenario. Default is false.
- music: (default specified in [scenario] or [game_config] tags) a comma-separated list of music tracks from which one will be chosen and played once after any events related to the end of level result are executed; by default, victory_music is used on victory, and defeat_music on defeat.
- end_text: Text that is shown centered in a black screen at the end of a campaign. Defaults to "The End". Note that this has cumulative effects over the campaign - it persists even if the endlevel does not trigger the end of the campaign. See also CampaignWML.
- end_text_duration: Delay, in milliseconds, before displaying the game credits at the end of a campaign. In other words, for how much time end_text is displayed on screen. Defaults to 3500. Note that this has cumulative effects over the campaign - it persists even if the endlevel does not trigger the end of the campaign. See also CampaignWML.
[unit]
Places a unit on the map. For syntax see SingleUnitWML.
- (Hint: Use the GENERIC_UNIT macro)
- to_variable: spawn directly into a variable instead of on the map.
[recall]
Recalls a unit. The unit is recalled free of charge, and is placed near the leader.
- StandardUnitFilter: the first matching unit will be recalled. If no units match this tag is ignored. Do not use a [filter] tag. If a comma separated list is given, every unit currently considered for recall is checked against all the types (not each single one of the types against all units).
- x,y: the unit is placed here instead of next to the leader.
- show: yes/no, default yes: whether the unit is animated (faded in) or instantly displayed
[teleport]
Teleports a unit on map. (Hint: Use the TELEPORT_UNIT macro)
- [filter]: StandardUnitFilter the first unit matching this filter will be teleported.
- x,y: the position to teleport to.
- clear_shroud: should shroud be cleared on arrival
- animate: should a teleport animation be played (if the unit doesn't have a teleport animation, it will fade out/fade in)
- ignore_passability: Template:DevFeature normally, units will not be teleported into terrain that is impassable for them. Setting this attribute to "yes" permits it.
(Note: There is also a ability named teleport, see AbilitiesWML.)
[terrain_mask]
Changes the terrain on the map. See TerrainMaskWML.
[terrain]
Changes the terrain on the map.
- terrain: the character of the terrain to use. See TerrainCodesWML to see what letter a type of terrain uses.
- x,y: the position (or range of positions) to change.
- layer: (overlay|base|both, default=both) only change the specified layer.
- replace_if_failed: (default=no) When replacing just one layer failed, try to replace the whole terrain. If terrain is an overlay only terrain, use the default_base as base layer. If the terrain has no default base, do nothing.
[gold]
Gives one side gold.
- amount: the amount of gold to give.
- side: (default=1) the number of the side to give the gold to.
[unstore_unit]
Creates a unit from a game variable, and activates it on the playing field. This must be a specific variable describing a unit, and may not be an array -- to unstore an entire array, iterate over it. The variable is not cleared. See also [store_unit], [while] and [clear_variable]. Note units with a negative amount of hitpoints will be unstored with 1 hitpoint.
- variable: the name of the variable.
- find_vacant: whether the unit should be placed on the nearest vacant tile to its specified location. If this is set to 'no'(default), then any unit on the same tile as the unit being unstored will be destroyed.
- text: (translatable) floating text to display above the unit, such as a damage amount
- red, green, blue: (default=0,0,0) the color to display the text in. Values vary from 0-255. You may find it convenient to use the {COLOR_HARM} or {COLOR_HEAL} macro instead. (Use {COLOR_HARM} or {COLOR_HEAL} instead of the whole red,green,blue= line.)
- advance: (default=true) if true the unit is advanced if it has enough XP. When modifying XP make sure to do it from inside a synchronized event or it may lead to OOS errors especially when several advancement paths exist. Note that advance and post advance events are called, so infinite loops can happen.
- x ,y: override unit location, "x,y=recall, recall" will put the unit on the unit's side's recall list.
[allow_recruit]
Allows a side to recruit units it couldn't previously recruit.
- type: the types of units that the side can now recruit.
- side: (default=1) the number of the side that is being allowed to recruit the units.
[disallow_recruit]
Prevents a side from recruiting units it could previously recruit.
- type: the types of units that the side can no longer recruit.
- side: (default=1) the number of the side that may no longer recruit the units.
[set_recruit]
Sets the units a side can recruit.
- recruit: the types of units that the side can now recruit.
- side: (default=1) the number of the side that is having its recruitment set.
[modify_side]
Modifies some details of a given side in the middle of a scenario. The following listed properties are the only properties that [modify_side] can affect!
- side: (default=1) the number of the side that is to be changed.
- income: the income given at the begining of each turn.
- team_name: the team in which the side plays the scenario.
- user_team_name: a translatable string representing the team's description. This has no effect on alliances. Defaults to team_name.
- gold: the amount of gold the side owns.
- village_gold: the income setting per village for the side.
- controller: the identifier string of the side's controller. Uses the same syntax of the controller key in the [side] tag.
- fog: a boolean string (yes/no) describing the status of Fog for the side.
- shroud: a boolean string describing the status of Shroud for the side.
- hidden: a boolean string specifying whether side is shown in status table.
- [ai]: replaces a side's AI parameters with the new specified ones. Uses the same syntax described in AiWML.
- switch_ai: Template:DevFeature replaces a side ai with a new AI from specified file(ignoring those AI parameters above). Path to file follows the usual WML convention.
- share_maps: Template:DevFeature change the share_maps side attribute. Be sure to use shroud=yes for that side and have it as an ally
- share_view: Template:DevFeature change the share_view side attribute. Be sure to use fog=yes for that side and have it as an ally
[modify_turns]
Modifies the turn limit in the middle of a scenario.
- value: the new turn limit.
- add: if used instead of value, specifies the number of turns to add to the current limit (can be negative).
- current: changes the current turn number after applying turn limit modifications, if any. It is possible to change the current turn number to a greater one than the current only; also, it is not possible to change the turn number to exceed the turn limit.
[capture_village]
Changes the ownership of a village.
- side: the side that takes control of the village. This side needs to have a leader (canrecruit=yes). If the side key is not given, the village will become neutral.
- x, y: the location of the village.
[kill]
Removes all units (including units in a recall list) that match the filter from the game.
- StandardUnitFilter: Selection criterion; do not use a [filter] tag.
- animate: if 'yes', displays the unit dying (fading away).
- fire_event: if 'yes', triggers any appropriate 'die' events (See EventWML). Note that any 'last breath' and 'die' events triggered by this are executed immediately, interrupting the current event and thus causing the x1, y1, x2, and y2 variables to be reset for that 'die' event, which in turn causes those variables to be invalid for the remainder of this event.
[move_unit]
Template:DevFeature1.9; works like the MOVE_UNIT macro.
- StandardUnitFilter as argument; do not use a [filter] tag. All units matching the filter are moved. If the target location cannot be moved to (occupied or impassable), the nearest suitable location is chosen.
- to_x (unsigned integer): The units are moved to this x coordinate. Can be a comma-separated list, in which case the unit follows this given path during the move.
- to_y (unsigned integer): The units are moved to this y coordinate. Can be a comma-separated list.
- fire_event (optional, boolean yes|no, default no): Whether any according moveto events shall be fired. The target location ($x1, $y1 in the event) may not be the same location that the unit was tried to be moved to, if the original target location is occupied or impassable.
[petrify]
Petrifies all units that match the filter. In 1.6 and earlier this is [stone].
- [filter] with a StandardUnitFilter as argument. If no unit matches the filter, then nothing happens (probably). If absent, all units on the map are petrified.
[unpetrify]
Unpetrifies all units that match the filter. In 1.6 and earlier this is [unstone].
- [filter] with a StandardUnitFilter as argument. If no unit matches the filter, then nothing happens (probably). If absent, all units on the map are unpetrified.
[object]
Gives some unit an object and removes all items on the tile the unit is on.
- id: (Optional) when the object is picked up, a flag is set for id. The object cannot be picked up if a flag for id has been set. This means that any object with an id can only be used once, even if first_time_only=no is set for the event. This restriction is per level. In a campaign objects with the same id can be assigned once per level.
- [effect]: one or more effect elements may be listed. See EffectWML for a description of [effect].
- duration: if 'level', effects only last until the end of the level (note : 'level' is the scenario, so this doesn't mean it last until the unit levels-up).
- [filter] with a StandardUnitFilter as argument. The first unit found that matches the filter will be given the object. If no unit matches the filter, then a message is displayed and the object is not removed.
- [then]: a subtag that lets you execute actions if the filter conditions are met. The most common action that should be inside here is a [removeitem] tag, but you could probably put any tags that otherwise work in a [then] tag.
- silent: whether or not messages should be suppressed. Default is "no".
- image: the displayed image of the object.
- name: (translatable) displayed as a caption of the image.
- description: (translatable) displayed as a message of the image.
- cannot_use_message: (translatable) displayed instead of description if no unit passes the filter test.
- If you do not supply a filter, the object action will be applied to a unit at the location of the moveto event. Currently this isn't recommended as it is not clear that this will continue working this way. Instead it is better to explicitly include a location filter.
- The object action does not act on units in the recall list. There is a feature request in to allow this, but it is not clear whether or not it will be accepted.
[remove_shroud]
Removes some shroud from the map for a certain side (only relevant for sides that have shroud=yes).
- side: (default=1) the side for which to remove shroud.
- StandardLocationFilter: the range of tiles for which shroud should be removed.
[place_shroud]
Places some shroud on the map for a certain side (only relevant for sides that have shroud=yes).
- side: (default=1) the side for which to place shroud.
- StandardLocationFilter: the range of tiles on which shroud should be placed.
[allow_undo]
Allows the player to undo the event that this tag is inside. Has an effect only inside moveto events. If the move is undone, only the position of the unit will be restored; any altered variables or changes to the game will remain changed after the move is undone. It is up to the scenario designer to avoid abusing this command.
- Technically, if [allow_undo] is inside an [event] with first_time_only=yes (the default setting), and the user undoes the event, then the state of the game has changed in this way: the event will not fire a second time, even though the user undid the move the first time.
[heal_unit]
Heal a unit. The variable $heal_amount will be set to the exact number of points healed (i.e can be lesser than the parameter amount if the unit is fully healed).
- [filter]: StandardUnitFilter the first unit matching the filter will be healed.
- [filter_second]: StandardUnitFilter all the units matching the filter and having the heals ability will have their animation played (if animate is set to true).
- amount: the maximum points the unit will be healed.
- animate: a boolean which indicate if the healing animations must be played.
[time_area]
How a day should progress in a given area. Everywhere not specified in a [time_area] tag is affected by the [time] and [illuminated_time] tags in the [scenario] tag.
- StandardLocationFilter: the locations to affect.
- TimeWML: the new schedule.
- id: an unique identifier assigned to a time_area. Optional, unless you want to remove the time_area later. Can be a comma-separated list when removing time_areas, see below.
- remove: (boolean) yes/no value. Indicates whether the specified time_area should be removed. Requires an identifier. If no identifier is used, however, all time_areas are removed.
[end_turn]
End the current side's turn. Template:DevFeature The current event is finished before the turn is ended.
[replace_map]
Replaces the entire map.
- map: path to a map file.
- expand: if 'yes', allows the map size to increase. The expansion direction is currently always bottom-right.
- reduce: if 'yes', allows the map size to decrease. If the map size is reduced, any units that would no longer be on the map due to its coordinates no longer existing will be put into the recall list.
[replace_schedule]
Replace the time of day schedule of the entire scenario. Template:DevFeature1.9
- TimeWML: the new schedule.
[tunnel]
Create a tunnel between some locations, later usable by units to move from source hex to target hex (using the movement cost of unit on the target terrain). Template:DevFeature1.9 (source)
- id identifier for the tunnel, to allow removing (optional).
- remove: (boolean) yes/no value. If yes, removes all defined tunnels with the same ID (then only id= is necessary). (default: no)
- bidirectional: (boolean) if yes, creates also a tunnel in the other direction. (default: yes)
- always_visible: (boolean) if yes, the possible movement of enemies under fog can be seen. (default: no)
- [source]: StandardLocationFilter the source hex(es) (required).
- [target]: StandardLocationFilter the target hex(es) (required).
- [filter]: StandardUnitFilter the units which can use the tunnel (required). Leave empty for "all units".
(Note: The tunnel tag can also be used inside the [teleport] ability, without remove= and id=).
Useful Macros
There are some predefined macros that you find useful for direct actions. You can find a complete list along with a detailed explanation of how they work here.
- {MOVE_UNIT}: Moves a unit to another location in the map and the player sees the movement (unlike [teleport])
- {FULL_HEAL}: Brings a unit to full HP
- {LOYAL_UNIT}: Create a loyal unit
- {MODIFY_TERRAIN_MASK}: Modify an area of terrain