Global
Global functions that are not part of a class or object are listed here. Be sure to check what game modes they are loaded in before use, as not all of them will be loaded in campaign, battle or the frontend.
-
script_error(
messagestring
, [
stack level modifiernumber
], [
suppress assertboolean
])
-
Throws a script error with the supplied message, printing the lua callstack to the
Lua
console output spool. Useful for debugging.Parameters:
1
Message to print.
2
optional, default value=0
By default this function will print the callstack of the calling function. A modifier may be supplied here to alter which function in the callstack should be at the top of the callstack. A positive integer moves the callstack pointer down the callstack, so a supplied value of
1
here would mean the callstack of the function calling the function callingscript_error
would be printed.If the stack level modifier is set to a negative number then no traceback is printed as part of the script error. This can be useful if the error message itself contains a traceback.
3
optional, default value=false
If set to
true
then no assert is generated with this script error.Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/all_scripted.lua, line 31
-
out(string
output)
-
out
is a table that provides multiple methods for outputting text to the various available debug console spools. It may be called as a function to output a string to the mainLua
console spool, but the following table elements within it may also be called to output to different output spools:
- grudges
- ui
- chaos
- traits
- help_pages
- interventions
- invasions
- design
out supplies four additional functions that can be used to show tab characters at the start of lines of output:
Tab levels are managed per output spool. To each of these functions a string argument can be supplied which sets the name of the output spool to apply the modification to. Supply no argument or a blank string to modify the tab level of the main output spool.Function Description out.inc_tab
Increments the number of tab characters shown at the start of the line by one. out.dec_tab
Decrements the number of tab characters shown at the start of the line by one. Decrementing below zero has no effect. out.cache_tab
Caches the number of tab characters currently set to be shown at the start of the line. out.restore_tab
Restores the number of tab characters shown at the start of the line to that previously cached. Parameters:
1
string
output
Returns:
nil
Example - Standard output:
out("Hello World")
out.inc_tab()
out("indented")
out.dec_tab()
out("no longer indented")
Hello World
indented
no longer indented
Example - UI tab:
Output to the ui tab, with caching and restoring of tab levelsout.ui("Hello UI tab")
out.cache_tab("ui")
out.inc_tab("ui")
out.inc_tab("ui")
out.inc_tab("ui")
out.ui("very indented")
out.restore_tab("ui")
out.ui("not indented any more")
Hello UI tab
very indented
not indented any more
Loaded in Campaign defined in ../../Warhammer/working_data/script/all_scripted.lua, line 144
-
force_require(string
filename)
-
Forceably unloads and requires a file by name.
Parameters:
1
string
filename
Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/all_scripted.lua, line 422
-
load_script_libraries()
-
One-shot function to load the script libraries.
Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/all_scripted.lua, line 431
A suite of functions related to vectors. In battle scripting terminology, vectors are 2D/3D positions in the game world.
-
v_to_s(
vectorbattle_vector
)
-
Converts a vector to a string, for debug output
Parameters:
1
vector
Returns:
output stringstring
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 17
-
v_offset(
source vectorbattle_vector
, [
x offsetnumber
], [
y offsetnumber
], [
z offsetnumber
])
-
Takes a source vector and some x/y/z offset values. Returns a target vector which is offset from the source by the supplied values.
Parameters:
1
source vector
2
optional, default value=0
X offset in metres (east-west).
3
optional, default value=0
Y offset in metres (height).
4
optional, default value=0
Z offset in metres (north-south).
Returns:
vector
target vector
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 30
-
v_copy()
-
Returns a copy of a vector.
Returns:
vector
vector copy
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 53
-
v_offset_by_bearing(
source vectorbattle_vector
,
bearingnumber
,
distnumber
, [
v bearingnumber
])
-
Takes a source vector, a bearing, a distance, and an optional vertical bearing, and returns a vector at the computed position from the source vector. The horizontal bearing rotates in a horizontal plane (i.e. looking top-down), the vertical bearing rotates in a vertical plane (i.e. looking from side).
Parameters:
1
source vector
2
horizontal bearing in radians.
3
distance in metres.
4
optional, default value=0
Vertical bearing in radians.
Returns:
target vectorbattle_vector
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 66
-
v_add(
vector abattle_vector
,
vector bbattle_vector
)
-
Takes two vectors, and returns a third which is the sum of both.
Parameters:
1
vector a
2
vector b
Returns:
target vectorbattle_vector
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 93
-
v_subtract(
vector abattle_vector
,
vector bbattle_vector
)
-
Takes two vectors, and returns a third which is the second subtracted from the first.
Parameters:
1
vector a
2
vector b
Returns:
target vectorbattle_vector
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 114
-
v_to_ground(
source positionbattle_vector
, [
height offsetnumber
])
-
Returns a
battle_vector
at a supplied 2D position at a specified height above or below the ground, making use ofbattle:get_terrain_height
.Parameters:
1
Source position. A vertical line will be drawn at this position. Where this line intersects the terrain will be considered height 0.
2
optional, default value=0
Height offset from ground in metres. This can be negative.
Returns:
target vectorbattle_vector
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 135
-
v_min_height(
input positionbattle_vector
, [
minimum altitudenumber
])
-
Returns a
battle_vector
at the supplied position at an altitude of at-least the supplied minimum height. If the supplied position is above the minimum height over the terrain then it is returned unaltered.Parameters:
1
input position
2
optional, default value=2
minimum altitude
Returns:
output positionbattle_vector
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 161
-
centre_point_table(table
position collection)
-
Takes a table of vectors, buildings, units or scriptunits, and returns a vector which is the mean centre of the positions described by those objects.
Parameters:
1
table
Table of vectors/buildings/units/scriptunits.
Returns:
vector
centre position
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 189
-
get_position_near_target(
source position
vector,
min distance
[number],
max distance
[number],
min bearing
[number],
max bearing
[number]
) -
Returns a vector at a random position near to a supplied vector. Additional parameters allow a min/max distance and a min/max angle in degrees from the source vector to be specified.
Parameters:
1
vector
source position
2
number
optional, default value=20
Minimum distance of target position in m.
3
number
optional, default value=50
Maximum distance of target position in m.
4
number
optional, default value=0
Minimum bearing of target position in degrees.
5
number
optional, default value=360
Maximum bearing of target position in degrees.
Returns:
vector
target position
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 237
-
get_furthest(vector
source position, table
position collection)
-
Takes a subject vector and a table of vectors/units/sunits/buildings (or a scriptunits collection). Returns the index of the vector in the table/collection which is furthest from the subject vector.
Parameters:
1
vector
source position
2
table
Table of vector/unit/sunit/building objects, or a scriptunits collection
Returns:
integer
index of furthest object in list
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 368
-
get_nearest(vector
source position, table
position collection)
-
Takes a subject vector and a table of vectors/units/sunits/buildings (or a scriptunits collection). Returns the index of the vector in the table/collection which is closest to the subject vector.
Parameters:
1
vector
source position
2
table
Table of vector/unit/sunit/building objects, or a scriptunits collection
Returns:
integer
index of closest object in list
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 378
-
position_along_line(
first position
battle_vector
,
second position
battle_vector
,
distance
number
,
2D only
[boolean
]
) -
Takes two vector positions as parameters and a distance in metres, and returns a position which is that distance from the first vector in the direction of the second vector.
Parameters:
1
First position.
2
Second position.
3
Distance in metres.
4
optional, default value=false
Disregard height.
Returns:
target positionbattle_vector
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 388
-
position_along_line_unary(
first position
battle_vector
,
second position
battle_vector
,
unary distance
number
,
2D only
[boolean
]
) -
Takes two vector positions as parameters and a unary (0-1) proportion, and returns a position which is that proportional distance from the first vector in the direction of the second vector. Unary values outside the range of 0-1 are supported.
Parameters:
1
First position.
2
Second position.
3
Unary distance.
4
optional, default value=false
Disregard height.
Returns:
target positionbattle_vector
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 421
-
dot(
first positionbattle_vector
,
second positionbattle_vector
)
-
Returns the dot product of two supplied vectors.
Parameters:
1
first position
2
second position
Returns:
dot productnumber
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 446
-
dot3d(
first positionbattle_vector
,
second positionbattle_vector
)
-
Returns the dot product of two supplied vectors in three dimensions.
Parameters:
1
first position
2
second position
Returns:
dot productnumber
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 456
-
normal(
first positionbattle_vector
,
second positionbattle_vector
)
-
Returns the normal vector of two supplied vectors.
Parameters:
1
first position
2
second position
Returns:
normalbattle_vector
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 466
-
distance_to_line(
line position a
battle_vector
,
line position b
battle_vector
,
target position
battle_vector
) -
Takes two vector positions that describe a 2D line of infinite length, and a target vector position. Returns the distance from the line to the target vector. This distance will be negative if the target is on the left side of the line, and positive if on the right side of the line.
Parameters:
1
line position a
2
line position b
3
target position
Returns:
distancenumber
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 476
-
has_crossed_line(
position collection
object,
line position a
battle_vector
,
line position b
battle_vector
,
standing only
boolean
) -
Takes a vector, unit, scriptunit or collection of objects and returns true if any element within it has crossed a line demarked by two supplied vector positions.
An optional fourth parameter instructshas_crossed_line
to only consider the positions of non-routing units, if set to true.
An object is deemed to have 'crossed' the line if it's on the right-hand side of the line.Parameters:
1
object
Collection of position objects to test. Supported collection object types are scriptunits, units, army, armies, alliance or a numerically-indexed table of any supported objects.
2
line position a
3
line position b
4
Do not count positions of any routing or dead units
Returns:
has crossed lineboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 504
-
get_bearing(
source vectorbattle_vector
,
target vectorbattle_vector
, [
vertical bearingnumber
])
-
Returns the bearing in radians from one vector to another. If the vertical bearing flag is supplied then the vertical bearing is returned (i.e. looking from the side), otherwise the horizontal bearing (i.e. looking from above) is returned.
Parameters:
1
source vector
2
target vector
3
optional, default value=false
vertical bearing
Returns:
bearing in radiansnumber
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 598
-
get_vector_offset_by_bearing(
source
battle_vector
,
distance
[number
],
h bearing
[number
],
v bearing
[number
]
) -
Returns a vector that is offset from a supplied source vector, in a particular horizontal 2d bearing (top-down), at a particular distance and vertical bearing. The function is primarily intended to compute camera position offsets from a supplied target but can be used for any purpose.
Parameters:
1
source
2
optional, default value=50
Distance in m.
3
optional, default value=0
Horizontal (top-down) bearing in radians.
4
optional, default value=0
Vertical (from-side) bearing in radians.
Returns:
offset vectorbattle_vector
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_convex_area.lua, line 612
-
is_custom_type(
objecttable
, value
custom type)
-
Returns true if the supplied value is of the supplied custom type. This is not intended to be directly called by client scripts, who should instead call one of the is_
functions listed elsewhere. Parameters:
1
object
2
value
custom type
Returns:
is custom typeboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 97
-
get_custom_type(
objecttable
)
-
Returns the custom type value of the supplied value. If it has no custom type then
nil
is returned.Parameters:
1
object
Returns:
value
custom type, ornil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 107
-
set_class_custom_type(
class tabletable
,
custom typestring
)
-
Sets a supplied class table to the supplied type string by setting its
__custom_type
value. Once this is set, other object tables that are later set to derive from this class withset_object_class
will report this custom type when passed toget_custom_type
oris_custom_type
.Parameters:
1
class table
2
custom type
Returns:
nil
Example:
TYPE_RABBIT = "rabbit"
-- class definition
rabbit = {}
set_class_custom_type(rabbit, TYPE_RABBIT)
-- object definition
thumper = {}
set_object_class(thumper, rabbit)
out("thumper custom type is " .. get_custom_type(thumper)
thumper custom type is rabbit
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 118
-
set_class_tostring(
class tabletable
,
custom typestring
)
-
Sets the tostring value of a supplied class table to the specified value by setting its
__tostring
value. Once this is set, other object tables that are later set to derive from this class withset_object_class
will return this value when passed totostring()
.
The tostring specifier may be supplied as astring
or afunction
. If supplied as a function, that function will be called when thetostring()
function is called with an object derived from the supplied class. The object will be supplied as a single argument to the tostring specifier function, which allows the tostring() value to be assembled at runtime and include elements such as the objects name, co-ordinates or other realtime information. The specifier function should return a string.
The default behaviour is for the generated string to be cached in the object table, at the__cached_tostring
field. Further calls totostring()
will then return the cached string rather than regenerating it each time. If this is undesirable - for example if the generated string might change as the object changes state - then thedo_not_cache
flag may be set on this function.
The flag to not append the memory address may be set if the memory address of the table is not wanted on the end of the returned tostring value. The default behaviour is to append the memory address.Parameters:
1
class table
2
custom type
Returns:
nil
Example - Setting a function tostring specifier:
TYPE_CAT = "cat"
-- class definition
cat = {}
set_class_tostring(cat, function(cat_obj) return TYPE_CAT .. "_" .. cat_obj.name end)
-- object definition
cat_freddy = {name = "freddy"}
set_object_class(cat_freddy, cat)
out(tostring(cat_freddy))
cat_freddy: 000001C2B9D4E730
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 150
-
set_class_custom_type_and_tostring(
class tabletable
,
custom type valuestring
)
-
Sets the custom type and tostring value on the supplied class table to the supplied string value. This function calls
set_class_custom_type
andset_class_tostring
to do this.Parameters:
1
class table
2
custom type value
Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 226
-
set_object_class(
object tabletable
,
class tabletable
, ...
additional interfaces)
-
Sets the supplied object to index from the supplied class in a manner that emulates object-orientation. This will set the class to be the metatable of the object and will set the
__index
field of the metatable also to the supplied class. This means that if functions or values are looked up on the object and are not present they are then looked up on the class. It is through this kind of mechanism that object-orientation may be emulated in lua. Because the class is also the metatable, it means the metatable is shared between objects of the same type. Useset_object_class_unique
if this is not desired.
set_object_class
will also associate the object with any custom type or tostring values that have been previously set up on the class with calls toset_class_custom_type
andset_class_tostring
.
Any number of additional classes and objects may be specified, from which the main supplied object will also derive. If a value (such as a function to be called) is looked up on the object and is not provided on the object or the main class table it derives from, it will be looked up in turn on each additional classes or objects supplied. These additional objects/classes may betable
oruserdata
values.Parameters:
1
Object table.
2
Class table.
3
...
Additional classes or objects to index.
Returns:
object
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 360
-
set_object_class_unique(
object tabletable
,
class tabletable
, ...
additional interfaces)
-
Sets the supplied object to index from the supplied class in a manner that emulates object-orientation. This will set up a metatable unique to this object and will set the
__index
field of this metatable to the supplied class. This means that if functions or values are looked up on the object and are not present they are then looked up on the class. It is through this kind of mechanism that object-orientation may be emulated in lua. In contrast to object-to-class relationships set up withset_object_class
the metatable is not shared between objects of the same type, which is less memory-efficient but may be desirable in certain circumstances.
set_object_class_unique
will also associate the object with any custom type or tostring values that have been previously set up on the class with calls toset_class_custom_type
andset_class_tostring
.
Any number of additional classes and objects may be specified, from which the main supplied object will also derive. If a value (such as a function to be called) is looked up on the object and is not provided on the object or the main class table it derives from, it will be looked up in turn on each additional classes or objects supplied. These additional objects/classes may betable
oruserdata
values.Parameters:
1
Object table.
2
Class table.
3
...
Additional classes or objects to index.
Returns:
object
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 373
-
set_class_metatable(
class tabletable
,
metatabletable
, [
allow overwriteboolean
])
-
Sets the metatable of the specified class table to the supplied table. This also sets the
__is_class_definition
field in the metatable whichset_object_class
uses internally to know the difference between a class definition (which has no concept of self) and an object definition (which does) in certain circumstances. This function is for use in specific situations where a class definition requires a metatable and objects derive from it.Parameters:
1
Class table.
2
Metatable.
3
optional, default value=false
Allow the overwriting of the metatable if one already exists.
Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 386
The functions in this section can be used to check whether variables are a built-in type.
-
is_nil(value
value)
-
Returns true if the supplied value is nil, false otherwise.
Parameters:
1
value
value
Returns:
is nilboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 437
-
is_number(value
value)
-
Returns true if the supplied value is a number, false otherwise.
Parameters:
1
value
value
Returns:
is numberboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 446
-
is_function(value
value)
-
Returns true if the supplied value is a function, false otherwise.
Parameters:
1
value
value
Returns:
is functionboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 455
-
is_string(value
value)
-
Returns true if the supplied value is a string, false otherwise.
Parameters:
1
value
value
Returns:
is stringboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 464
-
is_boolean(value
value)
-
Returns true if the supplied value is a boolean, false otherwise.
Parameters:
1
value
value
Returns:
is booleanboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 473
-
is_table(value
value)
-
Returns true if the supplied value is a table, false otherwise.
Parameters:
1
value
value
Returns:
is tableboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 482
-
is_userdata(value
value)
-
Returns true if the supplied value is userdata, false otherwise.
Parameters:
1
value
value
Returns:
is userdataboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 491
The functions in this section can be used to check whether variables are specific arrangements of built-in types.
-
is_integer(value
value)
-
Returns true if the supplied value is a whole number with no decimal component, or false otherwise.
Parameters:
1
value
value
Returns:
value is integerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 512
-
is_positive_number(value
value)
-
Returns true if the supplied value is a number greater than 0, or false otherwise.
Parameters:
1
value
value
Returns:
value is positive numberboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 521
-
is_non_negative_number(value
value)
-
Returns true if the supplied value is a number greater than or equal to 0, or false otherwise.
Parameters:
1
value
value
Returns:
value is non-negative numberboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 530
-
is_empty_table(value
value)
-
Returns true if the supplied value is an empty table, or false otherwise.
Parameters:
1
value
value
Returns:
value is an empty tableboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 539
-
is_non_empty_table(value
value)
-
Returns true if the supplied value is a table containing one or more values at any keys, or false otherwise. See also
is_non_empty_table_indexed
which checks if the values are stored at numerical keys.Parameters:
1
value
value
Returns:
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 548
-
is_non_empty_table_indexed(value
value)
-
Returns true if the supplied value is a numerically-indexed table containing one or more values, or false otherwise.
Parameters:
1
value
value
Returns:
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 565
-
is_table_of_strings(value
value)
-
Returns true if the supplied value is a numerically-indexed table containing one or more string values, or false otherwise.
Parameters:
1
value
value
Returns:
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 582
-
is_string_or_table_of_strings(value
value)
-
Returns true if the supplied value is a string, or a numerically-indexed table containing one or more string values. If the supplied value is neither of these types then false is returned.
Parameters:
1
value
value
Returns:
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 602
-
is_table_of_strings_allow_empty(value
value)
-
Returns true if the supplied value is an empty table or a numerically-indexed table containing one or more string values, or false otherwise.
Parameters:
1
value
value
Returns:
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 626
-
is_condition(value
value)
-
Returns true if the supplied value is a function or the boolean value
true
. Event conditions in the scripting library commonly adhere to this format, where an event is received and the condition must either be a function that returns a result, or be the boolean value true. If the supplied value is nottrue
or a function, then false is returned.Parameters:
1
value
value
Returns:
value is a conditionboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 645
The functions in this section can be used to check whether variables are of a code type that is not built-in to Lua but common across all our game environments.
-
is_eventcontext(value
value)
-
Returns true if the supplied value is an event context, false otherwise.
Parameters:
1
value
value
Returns:
is event contextboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 669
-
is_uicomponent(value
value)
-
Returns true if the supplied value is a uicomponent, false otherwise.
Parameters:
1
value
value
Returns:
is uicomponentboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 678
-
is_component(value
value)
-
Returns true if the supplied value is a component memory address, false otherwise.
Parameters:
1
value
value
Returns:
is component memory addressboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 687
The functions in this section can be used to check whether variables are of a userdata code type that is provided in the campaign environment. In certain cases the function also works in battle.
-
is_null(value
value)
-
Returns true if the supplied value is a campaign null script interface, false otherwise.
Parameters:
1
value
value
Returns:
is nullboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 709
-
is_model(value
value)
-
Returns true if the supplied value is a campaign model interface, false otherwise.
Parameters:
1
value
value
Returns:
is modelboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 718
-
is_world(value
value)
-
Returns true if the supplied value is a campaign world interface, false otherwise.
Parameters:
1
value
value
Returns:
is worldboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 727
-
is_faction(value
value)
-
Returns true if the supplied value is a campaign faction interface, false otherwise.
Parameters:
1
value
value
Returns:
is factionboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 736
-
is_factionlist(value
value)
-
Returns true if the supplied value is a campaign faction list interface, false otherwise.
Parameters:
1
value
value
Returns:
is faction listboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 745
-
is_character(value
value)
-
Returns true if the supplied value is a campaign character interface, false otherwise.
Parameters:
1
value
value
Returns:
is characterboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 754
-
is_family_member(value
value)
-
Returns true if the supplied value is a campaign family member interface, false otherwise.
Parameters:
1
value
value
Returns:
is family memberboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 763
-
is_characterlist(value
value)
-
Returns true if the supplied value is a campaign character list interface, false otherwise.
Parameters:
1
value
value
Returns:
is character listboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 772
-
is_regionmanager(value
value)
-
Returns true if the supplied value is a campaign region manager interface, false otherwise.
Parameters:
1
value
value
Returns:
is region managerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 781
-
is_region(value
value)
-
Returns true if the supplied value is a campaign region interface, false otherwise.
Parameters:
1
value
value
Returns:
is regionboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 790
-
is_regiondata(value
value)
-
Returns true if the supplied value is a campaign region data interface, false otherwise.
Parameters:
1
value
value
Returns:
is region databoolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 799
-
is_province(value
value)
-
Returns true if the supplied value is a campaign province interface, false otherwise.
Parameters:
1
value
value
Returns:
is provinceboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 808
-
is_factionprovince(value
value)
-
Returns true if the supplied value is a campaign faction province interface, false otherwise.
Parameters:
1
value
value
Returns:
is faction provinceboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 817
-
is_regionlist(value
value)
-
Returns true if the supplied value is a campaign region list interface, false otherwise.
Parameters:
1
value
value
Returns:
is region listboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 826
-
is_garrisonresidence(value
value)
-
Returns true if the supplied value is a campaign garrison residence interface, false otherwise.
Parameters:
1
value
value
Returns:
is garrison residenceboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 835
-
is_settlement(value
value)
-
Returns true if the supplied value is a campaign settlement interface, false otherwise.
Parameters:
1
value
value
Returns:
is settlementboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 844
-
is_slot(value
value)
-
Returns true if the supplied value is a campaign slot interface, false otherwise.
Parameters:
1
value
value
Returns:
is slotboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 853
-
is_slotlist(value
value)
-
Returns true if the supplied value is a campaign slot list interface, false otherwise.
Parameters:
1
value
value
Returns:
is slot listboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 862
-
is_militaryforce(value
value)
-
Returns true if the supplied value is a campaign military force interface, false otherwise.
Parameters:
1
value
value
Returns:
is military forceboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 871
-
is_militaryforcelist(value
value)
-
Returns true if the supplied value is a campaign military force list interface, false otherwise.
Parameters:
1
value
value
Returns:
is military force listboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 880
-
is_unit(value
value)
-
Returns true if the supplied value is a unit object, false otherwise. This works in both campaign and battle on their respective unit object types.
Parameters:
1
value
value
Returns:
is unitboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 889
-
is_unitlist(value
value)
-
Returns true if the supplied value is a campaign unit list interface, false otherwise.
Parameters:
1
value
value
Returns:
is unit listboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 898
-
is_pendingbattle(value
value)
-
Returns true if the supplied value is a campaign pending battle interface, false otherwise.
Parameters:
1
value
value
Returns:
is pending battleboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 907
-
is_campaignmission(value
value)
-
Returns true if the supplied value is a campaign mission interface, false otherwise.
Parameters:
1
value
value
Returns:
is campaign missionboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 916
-
is_campaignai(value
value)
-
Returns true if the supplied value is a campaign ai interface, false otherwise.
Parameters:
1
value
value
Returns:
is campaign aiboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 925
-
is_buildinglist(value
value)
-
Returns true if the supplied value is a building list object, false otherwise.
Parameters:
1
value
value
Returns:
is building listboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 934
-
is_building(value
value)
-
Returns true if the supplied value is a building object in campaign or battle, false otherwise.
Parameters:
1
value
value
Returns:
is buildingboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 943
-
is_foreignslotmanager(value
value)
-
Returns true if the supplied value is a foreign slot manager interface, false otherwise.
Parameters:
1
value
value
Returns:
is foreign slot managerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 953
-
is_foreignslot(value
value)
-
Returns true if the supplied value is a foreign slot interface, false otherwise.
Parameters:
1
value
value
Returns:
is foreign slotboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 962
The functions in this section can be used to check whether variables are of a userdata code type that is provided in the battle environment. In certain cases functions are shared with campaign, in which case they are listed with the campaign type-checking functions.
-
is_battlesoundeffect(value
value)
-
Returns true if the supplied value is a battle sound effect, false otherwise.
Parameters:
1
value
value
Returns:
is battle sound effectboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 987
-
is_battle(value
value)
-
Returns true if the supplied value is an empire battle object, false otherwise.
Parameters:
1
value
value
Returns:
is battleboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 996
-
is_alliances(value
value)
-
Returns true if the supplied value is an alliances object, false otherwise.
Parameters:
1
value
value
Returns:
is alliancesboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1005
-
is_alliance(value
value)
-
Returns true if the supplied value is an alliance, false otherwise.
Parameters:
1
value
value
Returns:
is allianceboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1014
-
is_armies(value
value)
-
Returns true if the supplied value is an armies object, false otherwise.
Parameters:
1
value
value
Returns:
is armiesboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1023
-
is_army(value
value)
-
Returns true if the supplied value is an army object, false otherwise.
Parameters:
1
value
value
Returns:
is armyboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1032
-
is_units(value
value)
-
Returns true if the supplied value is a units object, false otherwise.
Parameters:
1
value
value
Returns:
is unitsboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1041
-
is_unitcontroller(value
value)
-
Returns true if the supplied value is a unitcontroller, false otherwise.
Parameters:
1
value
value
Returns:
is unitcontrollerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1050
-
is_vector(value
value)
-
Returns true if the supplied value is a vector object, false otherwise.
Parameters:
1
value
value
Returns:
is vectorboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1059
-
is_buildings(value
value)
-
Returns true if the supplied value is a buildings object, false otherwise.
Parameters:
1
value
value
Returns:
is buildingsboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1068
-
is_subtitles(value
value)
-
Returns true if the supplied value is a battle subtitles object, false otherwise.
Parameters:
1
value
value
Returns:
is subtitlesboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1077
The functions in this section can be used to check whether variables are of a script data type that is provided in multiple game environments.
-
is_core(value
value)
-
Returns true if the supplied value is a
core
object, false otherwise.Parameters:
1
value
value
Returns:
is coreboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1102
-
is_timermanager(value
value)
-
Returns true if the supplied value is a timer manager, false otherwise.
Parameters:
1
value
value
Returns:
is timer managerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1111
-
is_scriptmessager(value
value)
-
Returns true if the supplied value is a script messager, false otherwise.
Parameters:
1
value
value
Returns:
is script messagerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1120
-
is_customcontext(value
value)
-
Returns true if the supplied value is a custom event context, false otherwise.
Parameters:
1
value
value
Returns:
is custom contextboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1129
-
is_objectivesmanager(value
value)
-
Returns true if the supplied value is an
objectives_manager
, false otherwise.Parameters:
1
value
value
Returns:
is objectives managerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1138
-
is_infotextmanager(value
value)
-
Returns true if the supplied value is an
infotext_manager
, false otherwise.Parameters:
1
value
value
Returns:
is infotext managerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1147
-
is_linkparser(value
value)
-
Returns true if the supplied value is a link parser, false otherwise.
Parameters:
1
value
value
Returns:
is link parserboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1156
-
is_tooltiplistener(value
value)
-
Returns true if the supplied value is a tooltip listener, false otherwise.
Parameters:
1
value
value
Returns:
is tooltip listenerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1165
-
is_contextvisibilitymonitor(value
value)
-
Returns true if the supplied value is a context visibility monitor, false otherwise.
Parameters:
1
value
value
Returns:
is context visibility monitorboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1174
-
is_tooltippatcher(value
value)
-
Returns true if the supplied value is a tooltip patcher, false otherwise.
Parameters:
1
value
value
Returns:
is tooltip patcherboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1183
-
is_helppagemanager(value
value)
-
Returns true if the supplied value is a help page manager, false otherwise.
Parameters:
1
value
value
Returns:
is help page managerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1192
-
is_helppage(value
value)
-
Returns true if the supplied value is a help page, false otherwise.
Parameters:
1
value
value
Returns:
is help pageboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1201
-
is_textpointer(value
value)
-
Returns true if the supplied value is a text pointer, false otherwise.
Parameters:
1
value
value
Returns:
is text pointerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1210
-
is_activepointer(value
value)
-
Returns true if the supplied value is an active pointer, false otherwise.
Parameters:
1
value
value
Returns:
is active pointerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1219
-
is_scriptedtour(value
value)
-
Returns true if the supplied value is a scripted tour, false otherwise.
Parameters:
1
value
value
Returns:
is scripted tourboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1228
-
is_navigabletour(value
value)
-
Returns true if the supplied value is a navigable tour, false otherwise.
Parameters:
1
value
value
Returns:
is navigable tourboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1237
-
is_navigabletoursection(value
value)
-
Returns true if the supplied value is a navigable tour section, false otherwise.
Parameters:
1
value
value
Returns:
is navigable tour sectionboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1246
-
is_movieoverlay(value
value)
-
Returns true if the supplied value is a
movie_overlay
, false otherwise.Parameters:
1
value
value
Returns:
is movie overlayboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1255
-
is_windowedmovieplayer(value
value)
-
Returns true if the supplied value is a
windowed_movie_player
, false otherwise.Parameters:
1
value
value
Returns:
is windowed movie playerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1264
-
is_topicleader(value
value)
-
Returns true if the supplied value is a
topic_leader
, false otherwise.Parameters:
1
value
value
Returns:
is topic leaderboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1273
The functions in this section can be used to check whether variables are of a script data type that is provided in campaign.
-
is_campaignmanager(value
value)
-
Returns true if the supplied value is a campaign manager, false otherwise.
Parameters:
1
value
value
Returns:
is campaign managerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1296
-
is_factionstart(value
value)
-
Returns true if the supplied value is a faction start object, false otherwise.
Parameters:
1
value
value
Returns:
is faction startboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1305
-
is_factionintrodata(value,
value)
-
Returns true if the supplied value is a faction intro data object, false otherwise.
Parameters:
1
value,
value
Returns:
is intro databoolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1314
-
is_campaigncutscene(value
value)
-
Returns true if the supplied value is a campaign cutscene, false otherwise.
Parameters:
1
value
value
Returns:
is campaign cutsceneboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1323
-
is_uioverride(value
value)
-
Returns true if the supplied value is a ui override, false otherwise.
Parameters:
1
value
value
Returns:
is ui overrideboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1332
-
is_campaignuimanager(value
value)
-
Returns true if the supplied value is a campaign ui manager, false otherwise.
Parameters:
1
value
value
Returns:
is campaign ui managerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1341
-
is_missionmanager(value
value)
-
Returns true if the supplied value is a mission manager, false otherwise.
Parameters:
1
value
value
Returns:
is mission managerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1350
-
is_chaptermission(value
value)
-
Returns true if the supplied value is a chapter mission, false otherwise.
Parameters:
1
value
value
Returns:
is chapter missionboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1359
-
is_intervention(value
value)
-
Returns true if the supplied value is an intervention, false otherwise.
Parameters:
1
value
value
Returns:
is interventionboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1368
-
is_interventionmanager(value
value)
-
Returns true if the supplied value is an intervention manager, false otherwise.
Parameters:
1
value
value
Returns:
is intervention managerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1377
-
is_invasionmanager(value
value)
-
Returns true if the supplied value is an invasion manager, false otherwise.
Parameters:
1
value
value
Returns:
is invasion managerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1386
-
is_randomarmy(value
value)
-
Returns true if the supplied value is a random army manager, false otherwise.
Parameters:
1
value
value
Returns:
is random army managerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1395
-
is_narrativeevent(value
value)
-
Returns true if the supplied value is a
narrative_event
, false otherwise.Parameters:
1
value
value
Returns:
is narrative eventboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1404
-
is_narrativequery(value
value)
-
Returns true if the supplied value is a
narrative_query
, false otherwise.Parameters:
1
value
value
Returns:
is narrative queryboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1413
-
is_narrativetrigger(value
value)
-
Returns true if the supplied value is a
narrative_trigger
, false otherwise.Parameters:
1
value
value
Returns:
is narrative triggerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1422
The functions in this section can be used to check whether variables are of a script data type that is provided in battle.
-
is_battlemanager(value
value)
-
Returns true if the supplied value is a
battle_manager
, false otherwise.Parameters:
1
value
value
Returns:
is battle managerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1509
-
is_cutscene(value
value)
-
Returns true if the supplied value is a battle cutscene, false otherwise.
Parameters:
1
value
value
Returns:
is cutsceneboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1518
-
is_convexarea(value
value)
-
Returns true if the supplied value is a
convex_area
, false otherwise.Parameters:
1
value
value
Returns:
is convex areaboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1527
-
is_scriptunit(value
value)
-
Returns true if the supplied value is a
script_unit
, false otherwise.Parameters:
1
value
value
Returns:
is scriptunitboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1536
-
is_scriptunits(value
value)
-
Returns true if the supplied value is a
script_units
object, false otherwise.Parameters:
1
value
value
Returns:
is scriptunitsboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1545
-
is_patrolmanager(value
value)
-
Returns true if the supplied value is a patrol manager, false otherwise.
Parameters:
1
value
value
Returns:
is patrol managerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1554
-
is_waypoint(value
value)
-
Returns true if the supplied value is a patrol manager waypoint, false otherwise.
Parameters:
1
value
value
Returns:
is waypointboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1563
-
is_scriptaiplanner(value
value)
-
Returns true if the supplied value is a script ai planner, false otherwise.
Parameters:
1
value
value
Returns:
is script ai plannerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1572
-
is_generatedbattle(value
value)
-
Returns true if the supplied value is a generated battle, false otherwise.
Parameters:
1
value
value
Returns:
is generated battleboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1581
-
is_generatedarmy(value
value)
-
Returns true if the supplied value is a generated army, false otherwise.
Parameters:
1
value
value
Returns:
is generated armyboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1590
-
is_generatedcutscene(value
value)
-
Returns true if the supplied value is a generated cutscene, false otherwise.
Parameters:
1
value
value
Returns:
is generated cutsceneboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1599
-
is_advicemanager(value
value)
-
Returns true if the supplied value is an advice manager, false otherwise.
Parameters:
1
value
value
Returns:
is advice managerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1608
-
is_advicemonitor(value
value)
-
Returns true if the supplied value is an advice monitor, false otherwise.
Parameters:
1
value
value
Returns:
is advice monitorboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1617
-
is_attacklanemanager(value
value)
-
Returns true if the supplied value is an attack lane manager, false otherwise.
Parameters:
1
value
value
Returns:
is attack lane managerboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_types.lua, line 1626
A handful of sound-related functions in battle require a volume type to be specified when they are called. The values described below represent those volume types. They can be passed into functions such as battle:set_volume
and battle:get_volume
to specify a volume type.
Variables in this section:
These variables may be accessed via <interface>.<variable_name>
:
VOLUME_TYPE_MUSIC |
number
|
Volume type representing music, that can be used with sound-related functions. Value is 0 .
|
VOLUME_TYPE_SFX |
number
|
Volume type representing sfx, that can be used with sound-related functions. Value is 1 .
|
VOLUME_TYPE_ADVISOR |
number
|
Volume type representing advisor sounds, that can be used with sound-related functions. Value is 2 .
|
VOLUME_TYPE_VO |
number
|
Volume type representing voiceover sounds, that can be used with sound-related functions. Value is 3 .
|
VOLUME_TYPE_INTERFACE |
number
|
Volume type representing user interface sounds, that can be used with sound-related functions. Value is 4 .
|
VOLUME_TYPE_MOVIE |
number
|
Volume type representing movie sounds, that can be used with sound-related functions. Value is 5 .
|
VOLUME_TYPE_VOICE_CHAT |
number
|
Volume type representing voice chat audio, that can be used with sound-related functions. Value is 6 .
|
VOLUME_TYPE_MASTER |
number
|
Volume type representing the master volume level, that can be used with sound-related functions. Value is 7 .
|
-
model_pairs(object
parent list object)
-
An iterator for use with model objects in campaign and battle. When used in a for loop with a model list object, the iterator function returns the index and next item provided by the list object each loop pass.
In campaign, this iterator supports all model list objects such asregion_list
,character_list
,military_force_list
etc. In battle, this iterator supports model list objects such asbattle_alliances
,battle_armies
andbattle_units
, as well asscript_units
script collection objects.Parameters:
1
object
parent list object
Returns:
object
child list item
Example - model_pairs usage in campaign:
local region_list = cm:model():world():region_manager():region_list();
for i, region in model_pairs(region_list) do
out(i .. " " .. region:name());
end;
list of all regions
Example - model_pairs usage in battle:
for i, unit in model_pairs(bm:get_player_army():units()) do
bm:out(i .. ": unit with id " .. unit:unique_ui_id() .. " is at position " .. v_to_s(unit:position()));
end;
list of player units
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 41
-
uic_pairs(
parent uicomponent objectuicomponent
)
-
An iterator for use with
uicomponent
objects, which returns each child in succession. When used in a for loop with a uicomponent object, the iterator function returns the index number and the child corresponding to that index each loop pass.Parameters:
1
parent uicomponent object
Returns:
object
child uicomponent iterator
Example:
local uic_parent = find_uicomponent(core:get_ui_root(), "some_parent")
out("Listing children of some_parent:");
for i, uic_child in uic_pairs(uic_parent) do
out("\tChild " .. i .. " is " .. uic_child:Id());
end;
Listing children of some_parent:
Child 0 is first_child
Child 1 is some_other_child
Child 2 is yet_another_child
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 87
-
r_to_d(number
angle)
-
Converts a supplied angle in radians to degrees.
Parameters:
1
number
Angle in radians
Returns:
number
angle in degrees
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 122
-
d_to_r(number
angle)
-
Converts a supplied angle in degrees to radians.
Parameters:
1
number
Angle in degrees
Returns:
number
angle in radians
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 135
Functions to help get the filename and path of the calling script.
-
get_file_and_folder_path_as_table([integer
stack offset])
-
Returns the file and path of the calling script as a table of strings.
Parameters:
1
integer
optional, default value=0
Supply a positive integer here to return a result for a different file on the callstack e.g. supply '1' to return the file and folder path of the script file calling the the script file calling this function, for example.
Returns:
table
table of strings
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 160
-
get_folder_name_and_shortform([integer
stack offset])
-
Returns the folder name of the calling file and the shortform of its filename as separate return parameters. The shortform of the filename is the portion of the filename before the first "_", if one is found. If no shortform is found the function returns only the folder name.
A shortform used to be prepended on battle script files to allow them to be easily differentiated from one another in text editors e.g. "TF_battle_main.lua" vs "PY_battle_main.lua" rather than two "battle_main.lua"'s.Parameters:
1
integer
optional, default value=0
Supply a positive integer here to return a result for a different file on the callstack e.g. supply '1' to return the folder name/shortform of the script file calling the the script file calling this function, for example.
Returns:
string
name of folder containing calling filestring
shortform of calling filename, if any
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 223
-
get_full_file_path([integer
stack offset])
-
Gets the full filepath and name of the calling file.
Parameters:
1
integer
optional, default value=0
Supply a positive integer here to return a result for a different file on the callstack e.g. supply '1' to return the file path of the script file calling the the script file calling this function, for example.
Returns:
string
file path
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 261
-
get_file_name_and_path([integer
stack offset])
-
Returns the filename and the filepath of the calling file as separate return parameters.
Parameters:
1
integer
optional, default value=0
Supply a positive integer here to return a result for a different file on the callstack e.g. supply '1' to return the file name and path of the script file calling the the script file calling this function, for example.
Returns:
string
file namestring
file path
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 277
-
find_child_uicomponent(uicomponent
parent ui component, string
name)
-
Takes a uicomponent and a string name. Searches the direct children (and no further - not grandchildren etc) of the supplied uicomponent for another uicomponent with the supplied name. If a uicomponent with the matching name is found then it is returned, otherwise
false
is returned.Parameters:
1
uicomponent
parent ui component
2
string
name
Returns:
uicomponent
child, or false if not found
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 338
-
find_child_uicomponent_by_index(uicomponent
parent ui component, number
index)
-
Takes a uicomponent and an index. Searches the direct children (and no further - not grandchildren etc) of the supplied uicomponent. If a uicomponent with the correct index is found then it is returned, otherwise
false
is returned.Parameters:
1
uicomponent
parent ui component
2
number
starting at 0
Returns:
uicomponent
child, or false if not found
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 354
-
find_uicomponent([
parent ui componentuicomponent
], ...
list of string names)
-
Finds and returns a uicomponent based on a set of strings that define its path in the ui hierarchy. This parent uicomponent can be supplied as the first argument - if omitted, the root uicomponent is used. Starting from the parent or root, the function searches through all descendants for a uicomponent with the next supplied uicomponent name in the sequence. If a uicomponent is found, its descendants are then searched for a uicomponent with the next name in the list, and so on until the list is finished or no uicomponent with the supplied name is found. A fragmentary path may be supplied if it still unambiguously specifies the intended uicomponent.
Parameters:
1
optional, default value=nil
parent ui component
2
...
list of string names
Returns:
uicomponent
child, or false if not found.
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 406
-
find_uicomponent_from_table(
parent ui component
uicomponent,
table of string names
table,
on failure
[assert]
) -
Takes a start uicomponent and a numerically-indexed table of string uicomponent names. Starting from the supplied start uicomponent, the function searches through all descendants for a uicomponent with the next supplied uicomponent name in the table. If a uicomponent is found, its descendants are then searched for a uicomponent with the next name in the list, and so on until the list is finished or no uicomponent with the supplied name is found. This allows a uicomponent to be searched for by matching its name and part of or all of its path.
Parameters:
1
uicomponent
Parent uicomponent.
2
table
Table of string names, indexed by number.
3
assert
optional, default value=false
Fire a script error if the search fails.
Returns:
uicomponent
child, or false if not found.
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 436
-
uicomponent_descended_from(uicomponent
subject uic, string
parent name)
-
Takes a uicomponent and a string name. Returns true if any parent ancestor component all the way up to the ui root has the supplied name (i.e. the supplied component is descended from it), false otherwise.
Parameters:
1
uicomponent
subject uic
2
string
parent name
Returns:
uic is descended from a component with the supplied name.boolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 474
-
uicomponent_to_str(uicomponent
subject uic)
-
Converts a uicomponent to a string showing its path, for output purposes.
Parameters:
1
uicomponent
subject uic
Returns:
string
output
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 515
-
output_uicomponent(uicomponent
subject uic, [boolean
omit children])
-
Outputs extensive debug information about a supplied uicomponent to the
Lua - UI
console spool.Parameters:
1
uicomponent
Subject uicomponent.
2
boolean
optional, default value=false
Do not show information about the uicomponent's children.
Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 554
-
output_uicomponent_on_click()
-
Starts a listener which outputs debug information to the
Lua - UI
console spool about every uicomponent that's clicked on.Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 619
-
print_all_uicomponent_children([
subject uicuicomponent
], [
full outputboolean
])
-
Prints the name and path of the supplied uicomponent and all its descendents. Very verbose, and can take a number of seconds to complete.
Parameters:
1
optional, default value=uiroot
subject uic
2
optional, default value=false
full output
Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 634
-
pulse_uicomponent(
ui component
uicomponent,
should pulse
boolean,
brightness
[number],
progagate
[boolean],
state name
[string]
) -
Activates or deactivates a pulsing highlight effect on a particular state of the supplied uicomponent. This is primarily used for scripts which activate when the player moves the mouse cursor over certain words in the help pages, to indicate to the player what UI feature is being talked about on the page.
Parameters:
1
uicomponent
Subject ui component.
2
boolean
Set to
true
to activate the pulsing effect,false
to deactivate it.3
number
optional, default value=0
Pulse brightness. Set a higher number for a more pronounced pulsing effect.
4
boolean
optional, default value=false
Propagate the effect through the component's children. Use this with care, as the visual effect can stack and often it's better to activate the effect on specific uicomponents instead of activating this.
5
string
optional, default value=nil
Optional state name to affect. If no string state name is supplied here then the current state is used.
Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 655
-
is_fully_onscreen(
uicomponentuicomponent
)
-
Returns true if the uicomponent is fully on-screen, false otherwise.
Parameters:
1
uicomponent
Returns:
is onscreenboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 699
-
is_partially_onscreen(
uicomponentuicomponent
)
-
Returns true if the uicomponent is partially on-screen, false otherwise.
Parameters:
1
uicomponent
Returns:
is onscreenboolean
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 715
-
set_component_visible(boolean
set visible, ...
list of string names)
-
Sets a uicomponent visible or invisible by its path. The path should be one or more strings which when sequentially searched for from the ui root lead to the target uicomponent (see documentation for
find_uicomponent_from_table
, which performs the search).Parameters:
1
boolean
set visible
2
...
list of string names
Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 733
-
set_component_visible_with_parent(
set visible
boolean,
parent uicomponent
uicomponent,
list of string names
...
) -
Sets a uicomponent visible or invisible by its path. The path should be one or more strings which when sequentially searched for from a supplied uicomponent parent lead to the target uicomponent (see documentation for
find_uicomponent_from_table
, which performs the search).Parameters:
1
boolean
set visible
2
uicomponent
parent uicomponent
3
...
list of string names
Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 754
-
set_component_active(boolean
set active, ...
list of string names)
-
Sets a uicomponent to be active or inactive by its path. The path should be one or more strings which when sequentially searched for from the ui root lead to the target uicomponent (see documentation for
find_uicomponent_from_table
, which performs the search).Parameters:
1
boolean
set active
2
...
list of string names
Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 774
-
set_component_active_with_parent(
set active
boolean,
parent uicomponent
uicomponent,
list of string names
...
) -
Sets a uicomponent to be active or inactive by its path. The path should be one or more strings which when sequentially searched for from a supplied uicomponent parent lead to the target uicomponent (see documentation for
find_uicomponent_from_table
, which performs the search).Parameters:
1
boolean
set active
2
uicomponent
parent uicomponent
3
...
list of string names
Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 795
-
highlight_component(boolean
activate highlight, boolean
is square, ...
list of string names)
-
Highlights or unhighlights a uicomponent by its path. The path should be one or more strings which when sequentially searched for from the ui root lead to the target uicomponent (see documentation for
find_uicomponent_from_table
, which performs the search).Parameters:
1
boolean
Set
true
to activate the highlight,false
to deactivate.2
boolean
Set to
true
if the target uicomponent is square,false
if it's circular.3
...
list of string names
Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 829
-
highlight_visible_component(boolean
activate highlight, boolean
is square, ...
list of string names)
-
Highlights or unhighlights a uicomponent by its path, but only if it's visible. The path should be one or more strings which when sequentially searched for from the ui root lead to the target uicomponent (see documentation for
find_uicomponent_from_table
, which performs the search).Parameters:
1
boolean
Set
true
to activate the highlight,false
to deactivate.2
boolean
Set to
true
if the target uicomponent is square,false
if it's circular.3
...
list of string names
Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 839
-
highlight_all_visible_children(uicomponent
parent, [number
visual padding])
-
Draws a box highlight around all visible children of the supplied uicomponent. A padding value in pixels may also be supplied to increase the visual space between the highlight and the components being highlighted.
Parameters:
1
uicomponent
parent
2
number
optional, default value=0
visual padding
Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 863
-
unhighlight_all_visible_children()
-
Cancels any and all highlights created with
highlight_all_visible_children
.Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 890
-
highlight_component_table(number
visual padding, ...
uicomponents)
-
Draws a box highlight stretching around the supplied list of components. A padding value in pixels may also be supplied to increase the visual space between the highlight and the components being highlighted.
Parameters:
1
number
Visual padding in pixels.
2
...
Variable number of uicomponents to draw highlight over.
Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 897
-
unhighlight_component_table()
-
Cancels any and all highlights created with
highlight_component_table
.Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 987
-
play_component_animation(string
animation name, ...
list of string names)
-
Plays a specified component animation on a uicomponent by its path. The path should be one or more strings which when sequentially searched for from the ui root lead to the target uicomponent (see documentation for
find_uicomponent_from_table
, which performs the search).Parameters:
1
string
animation name
2
...
list of string names
Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 994
-
uicomponent_has_parent_filter(
uicomponentuicomponent
,
filterfunction
)
-
Returns
true
if the supplied uicomponent has a parent or ancestor that matches the supplied filter, orfalse
otherwise. The filter should be a function that accepts a uicomponent as a single argument and returnstrue
orfalse
depending on whether the uicomponent passes the filter. The first matching ancestor is also returned.Parameters:
1
uicomponent
2
filter
Returns:
uic parent passes filterboolean
first matching ancestoruicomponent
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 1008
-
get_advisor_progress_button()
-
Returns the advisor progress/close button uicomponent.
Returns:
uicomponent
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 1050
-
show_advisor_progress_button([boolean
show button])
-
Shows or hides the advisor progress/close button.
Parameters:
1
boolean
optional, default value=true
show button
Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 1074
-
highlight_advisor_progress_button([boolean
show button])
-
Activates or deactivates a highlight on the advisor progress/close button.
Parameters:
1
boolean
optional, default value=true
show button
Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_common.lua, line 1104
-
get_infotext_manager()
-
Gets an infotext manager, or creates one if one doesn't already exist.
Returns:
infotext_manager
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_infotext.lua, line 114
-
get_objectives_manager()
-
Gets an objectives manager, or creates one if one doesn't already exist.
Returns:
objectives_manager
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_objectives.lua, line 67
-
get_messager()
-
Gets or creates a
script_messager
object.Returns:
script_messager
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_script_messager.lua, line 10
-
ModLog(
output textstring
)
-
Writes output to the
lua_mod_log.txt
text file, and also to the game console.Parameters:
1
output text
Returns:
nil
Loaded in Campaign defined in ../../Warhammer/working_data/script/_lib/lib_mod_loader.lua, line 34
Variables in this section:
These variables may be accessed via <interface>.<variable_name>
:
VOLUME_TYPE_MUSIC |
number
|
Volume type representing music, that can be used with sound-related functions. Value is 0 .
|
VOLUME_TYPE_SFX |
number
|
Volume type representing sfx, that can be used with sound-related functions. Value is 1 .
|
VOLUME_TYPE_ADVISOR |
number
|
Volume type representing advisor sounds, that can be used with sound-related functions. Value is 2 .
|
VOLUME_TYPE_VO |
number
|
Volume type representing voiceover sounds, that can be used with sound-related functions. Value is 3 .
|
VOLUME_TYPE_INTERFACE |
number
|
Volume type representing user interface sounds, that can be used with sound-related functions. Value is 4 .
|
VOLUME_TYPE_MOVIE |
number
|
Volume type representing movie sounds, that can be used with sound-related functions. Value is 5 .
|
VOLUME_TYPE_VOICE_CHAT |
number
|
Volume type representing voice chat audio, that can be used with sound-related functions. Value is 6 .
|
VOLUME_TYPE_MASTER |
number
|
Volume type representing the master volume level, that can be used with sound-related functions. Value is 7 .
|
Functions in this section:
-
UIComponent(address
component address)
-
Casts a component memory address, returned by several functions such as
uicomponent:Find
, into a validuicomponent
script object so that functions in theuicomponent
script interface may be called on it.
This function is provided by the UI code.Parameters:
1
address
component address
Returns:
uicomponent
Loaded in Campaign defined in ../../common/UiComponentLib/Source/LuaComponentInterface.cpp, line 463