#textdomain wesnoth-did # New Macros # Define starting villages #define SET_VILLAGE SIDE X Y [capture_village] x={X} y={Y} side={SIDE} [/capture_village] #enddef # Shorthand for messages, useful for lots of short messages #define SPEAK SPEAKER_STRING MESSAGE_TEXT [message] speaker={SPEAKER_STRING} message={MESSAGE_TEXT} [/message] #enddef # MODIFY_ONE_UNIT alters a unit variable for a single unit # Warning: moving the unit will create a copy, since kill is set to no by necessity #define MODIFY_ONE_UNIT FILTER NAME VALUE [store_unit] [filter] {FILTER} [/filter] variable=MODIFY_UNIT_store kill=no [/store_unit] [set_variable] name=MODIFY_UNIT_store[0].{NAME} value={VALUE} [/set_variable] [unstore_unit] variable=MODIFY_UNIT_store[0] find_vacant=no [/unstore_unit] {CLEAR_VARIABLE MODIFY_UNIT_store} #enddef # Create a new ghost-type "advisor" if Malin doesn't already have one #define CREATE_ADVISOR [recall] # recall an advisor if one already exists role=advisor [/recall] [if] # check if that worked, if not make another unit the advisor [have_unit] role=advisor [/have_unit] [then] # do nothing [/then] [else] [role] role=advisor type=Spectre,Nightgaunt,Wraith,Shadow,Ghost [/role] [recall] role=advisor [/recall] [if] # If player has no such units on the recall list, make a new ghost [have_unit] role=advisor [/have_unit] [then] # do nothing [/then] [else] [store_unit] # store to get location [filter] id=Malin Keshar [/filter] kill=no variable=tempStore [/store_unit] [unit] type=Ghost side=1 x=$tempStore.x y=$tempStore.y role=advisor [/unit] {CLEAR_VARIABLE tempStore} [/else] [/if] [/else] [/if] #enddef #define MANOR_DOORS ALLOWED_SIDES # This places the doors; bridges placed on the map tell us where to put # them and whether to use the sw-se image or the sw-ne image. The prestart # event places the images and replaces the bridge overlays with the # impassable ^Xo overlay. The moveto event triggers when moving next to any # of these locations and will remove both the image and and the impassable # overlay. [event] name=prestart [store_locations] terrain=*^Bw\,*^Bw/ variable=doors [/store_locations] {FOREACH doors i} [if] [have_location] x,y=$doors[$i].x,$doors[$i].y terrain=*^Bw\ [/have_location] [then] [item] x,y=$doors[$i].x,$doors[$i].y image=scenery/gate-rusty-sw.png [/item] [/then] [else] [item] x,y=$doors[$i].x,$doors[$i].y image=scenery/gate-rusty-se.png [/item] [/else] [/if] [terrain] x,y=$doors[$i].x,$doors[$i].y terrain=^Xo layer=overlay [/terrain] {NEXT i} {CLEAR_VARIABLE doors} [/event] [event] name=moveto first_time_only=no [filter] side={ALLOWED_SIDES} [filter_location] [filter_adjacent_location] terrain=*^Xo [/filter_adjacent_location] [/filter_location] [/filter] [store_locations] terrain=*^Xo [filter_adjacent_location] x,y=$x1,$y1 [/filter_adjacent_location] variable=door_to_open [/store_locations] [set_variables] name=door_terrain_layers [split] list=$door_to_open.terrain key=terrain separator="^" [/split] [/set_variables] [terrain] x,y=$door_to_open.x,$door_to_open.y terrain=$door_terrain_layers[0].terrain [/terrain] [remove_item] x,y=$door_to_open.x,$door_to_open.y [/remove_item] {CLEAR_VARIABLE door_to_open,door_terrain_layers} [/event] #enddef #define DELAY NUMBER [delay] time={NUMBER} [/delay] #enddef #define ALLOW_RECRUIT LIST_VALUE [allow_recruit] side=2 type={LIST_VALUE} [/allow_recruit] #enddef