124 lines
3 KiB
INI
124 lines
3 KiB
INI
#textdomain wesnoth
|
|
# This file contains unit utility macros for WML authors.
|
|
#
|
|
# These don't rely on any other macros. Please don't change this.
|
|
|
|
#define GENERIC_UNIT SIDE TYPE X Y
|
|
# Creates a generic unit of TYPE belonging to SIDE at X,Y, which has a
|
|
# random name, gender and traits (just like a recruited unit).
|
|
[unit]
|
|
side={SIDE}
|
|
type={TYPE}
|
|
x={X}
|
|
y={Y}
|
|
generate_description=yes
|
|
random_traits=yes
|
|
random_gender=yes
|
|
upkeep=full
|
|
[/unit]
|
|
#enddef
|
|
|
|
#define NOTRAIT_UNIT SIDE TYPE X Y
|
|
# Creates a unit with no traits, random gender and name.
|
|
#
|
|
# Example:
|
|
#! {NOTRAIT_UNIT (Elvish Fighter) 1 19 16}
|
|
#
|
|
[unit]
|
|
side={SIDE}
|
|
type={TYPE}
|
|
x={X}
|
|
y={Y}
|
|
generate_description=yes
|
|
random_traits=no
|
|
random_gender=yes
|
|
[/unit]
|
|
#enddef
|
|
|
|
#define LOYAL_UNIT SIDE TYPE X Y DESCRIPTION USER_DESCRIPTION
|
|
# Creates a unit with the Loyal trait.
|
|
#
|
|
# Example:
|
|
#! {LOYAL_UNIT 1 (Elvish Fighter) 19 16 DESCRIPTION USER_DESCRIPTION (Myname) ( _ "Myname")}
|
|
#
|
|
[unit]
|
|
type={TYPE}
|
|
description={DESCRIPTION}
|
|
user_description={USER_DESCRIPTION}
|
|
side={SIDE}
|
|
x={X}
|
|
y={Y}
|
|
[modifications]
|
|
{TRAIT_LOYAL}
|
|
[/modifications]
|
|
[/unit]
|
|
#enddef
|
|
|
|
#define LOYAL_UNDEAD_UNIT SIDE TYPE X Y
|
|
# Create a unit with the Undead and Loyal traits.
|
|
[unit]
|
|
type={TYPE}
|
|
side={SIDE}
|
|
x={X}
|
|
y={Y}
|
|
[modifications]
|
|
{TRAIT_UNDEAD}
|
|
{TRAIT_LOYAL}
|
|
[/modifications]
|
|
[/unit]
|
|
#enddef
|
|
|
|
#define RECALL_OR_CREATE TYPE DESCRIPTION
|
|
# A substitute for [recall] that works even when there's no-one to recall
|
|
# useful for testing scenarios out of order.
|
|
[recall]
|
|
description={DESCRIPTION}
|
|
[/recall]
|
|
[if]
|
|
[have_unit]
|
|
description={DESCRIPTION}
|
|
[/have_unit]
|
|
[else]
|
|
[store_starting_location]
|
|
side=1
|
|
variable=tmp
|
|
[/store_starting_location]
|
|
[unit]
|
|
type={TYPE}
|
|
description={DESCRIPTION}
|
|
side=1
|
|
x=$tmp.x
|
|
y=$tmp.y
|
|
[/unit]
|
|
[clear_variable]
|
|
name=tmp
|
|
[/clear_variable]
|
|
[/else]
|
|
[/if]
|
|
#enddef
|
|
|
|
#define STORE_UNIT_VAR FILTER VAR TO_VAR
|
|
# Stores an attribute of a unit to the given variable.
|
|
#
|
|
# Example where this is used to flip all orcs to whatever side James is on:
|
|
#! {STORE_UNIT_VAR description=James side side_of_James}
|
|
#! {MODIFY_UNIT race=orc side $side_of_James}
|
|
[store_unit]
|
|
[filter]
|
|
{FILTER}
|
|
[/filter]
|
|
|
|
kill=no
|
|
variable=STORE_UNIT_VAR_store
|
|
[/store_unit]
|
|
|
|
[set_variable]
|
|
name={TO_VAR}
|
|
format=$STORE_UNIT_VAR_store.{VAR}
|
|
[/set_variable]
|
|
|
|
[clear_variable]
|
|
name=STORE_UNIT_VAR_store
|
|
[/clear_variable]
|
|
#enddef
|
|
|