Operators

## Preface

This reference created from updated LAV's header\_operations.py. Changes are made by me, Vetrogor. If you want to add or edit information PM me on the forum or discord. Special thanks for Dalion who is also the main contributer. Information from Earandil git header\_operations.py is added. He doesn't track changes on this wiki so this is the most relevant source.

## Introduction and credits

Everyone who has ever tried to mod Mount&Blade games knows perfectly well, that the documentation for it's Module System is severely lacking. Warband Module System, while introducing many new and useful operations, did not improve considerably in the way of documentation. What's worse, a number of outright errors and inconsistencies appeared between what was documented in the comments to the header\_operations.py file (which was the root source of all Warband scripting documentation, whether you like it or not), and what was actually implemented in the game engine. Sooner or later someone was bound to dedicate some time and effort to fix this problem by properly documenting the file. It just so happened that I was the first person crazy enough to accept the challenge. I have tried to make this file a self-sufficient source of information on every operation that the Warband scripting engine knows of. Naturally I failed - there are still many operations for which there is simply not enough information, or operations with effects that have not yet been thoroughly tested and confirmed. But as far as I know, there is currently no other reference more exhaustive than this. I tried to make the file useful to both seasoned scripters and complete newbies, and to a certain degree this file can even serve as a tutorial into Warband scripting - though it still won't replace the wealth of tutorials produced by the Warband modding community. I really hope you will find it useful as well.

Alexander Lomski AKA Lav. Jan 18th, 2012.

## The credits

First of all, I should credit Taleworlds for the creation of this game and it's Module System. Without them, I wouldn't be able to work on this file so even though I'm often sceptical about their programming style and quality of their code, they still did a damn good job delivering this game to all of us. And then I should credit many members from the Warband modding community who have shared their knowledge and helped me clear out many uncertainties and inconsistencies. Special credits (in no particular order) go to cmpxchg8b, Caba'drin, SonKidd, MadVader, dunde, Ikaguia, MadocComadrin, Cjkjvfnby, shokkueibu, Dalion, Dj\_FRedy, Vetrogor, VonDegurechaff, Theoris, Swyter.

## Operations modifiers

neg = 0x80000000

(neg|<operation\_name>, ...),
Used in combination with conditional operations to invert their results.
this\_or\_next = 0x40000000

(this\_or\_next|<operation\_name>, ...),
Used in combination with conditional operations to group them into OR blocks.
## Flow control

try\_for\_agents = 12

call\_script = 1

`(call_script, <script_id>, [<script_param>...]),`
Calls specified script with or without parameters. Maximum number of parameters you can pass with the operation is 16.
try\_begin = 4

`(try_begin),`
Opens a conditional block.
else\_try = 5

`(else_try),`
If conditional operations in the conditional block fail, this block of code will be executed.
Works also within try\_for\_agents and try\_for\_range. Each loop will execute code block after else\_try if code block before failed. There can be multiple else\_try in the loops.
else\_try\_begin = 5

`(else_try_begin),`
Deprecated form of (else\_try).
try\_end = 3

`(try_end),`
Concludes a conditional block or a cycle.
end\_try = 3

`(end_try),`
Deprecated form of (try\_end),
try\_for\_range = 6

`(try_for_range, <destination>, <lower_bound>, <upper_bound>),`
Iterates from the <lower bound> to <<upper bound> -1>. <destination> is the variable iterated in the loop, which always increments to the next value at the end of the loop. Break the loop by lowering the upper bound.
try\_for\_range\_backwards = 7

`(try_for_range_backwards, <destination>, <lower_bound>, <upper_bound>),`
Iterates from <<upper bound> - 1> to the <lower bound>. <destination> is the variable iterated in the loop, which always decrements to the next value at the end of the loop. Break the loop by increasing the lower bound.
try\_for\_parties = 11

`(try_for_parties, <destination>),`
Runs a cycle, iterating all parties on the map.
try\_for\_agents = 12

`(try_for_agents, <agent_no>[, <position_no>, <radius_fixed_point>]),`
Runs a cycle, iterating all agents on the scene.
The reference <agent\_no> is active untill the next mission or scene is loaded. So don't check agent\_is\_active. It will always return true.
Optional parameters allow to check agents only within specific radius around certain position. Radius is fixed point value so you need to specify fixed\_point\_multiplier before using this operator.
Avoid using pos0. This will pass zero to the second argument and radius and position will be skipped. Like optional arguments were ommited.
Radius can be used to break loop if assigned to 0 wich will just run a loop without body.
Square loops (using try\_for\_agents inside other try\_for\_agents) can cause stutters. Large and long battles when thousands of agents spawned in on session can cause even bigger stutters as the dead agents remain active and consume memory aproximately 40Kb. And try\_for\_agents iterates dead agents too.
try\_for\_prop\_instances = 16

`(try_for_prop_instances, <instance_no>, [<object_id>][, <object_type>]),`
Version 1.161+. Runs a cycle, iterating all scene prop instances on the scene.
<object\_id> refers to <scene\_prop\_id> or <item\_kind\_id>.
If <object\_id> and <object\_type> is not given, it loops through all instances.
Bug: When iterating all instances sometimes it returns not valid zero instance. Zero instance usually refered to "spr\_inventory". This bug is fixed in the WSE.
For object types see list of "somt\_" in header\_common.py.
To iterate without <object\_id> pass 0. Wich refers to invalid item or prop. I.e. itm\_no\_item = 0, spr\_invalid\_object = 0.
Example `(try_for_prop_instances, ":instance", 0, somt_spawned_item),`
try\_for\_players = 17

`(try_for_players, <destination>, [skip_server]),`
Version 1.165+. Iterates through all active players in a multiplayer game. Set optional parameter to 1 to skip server player entry.
## Mathematical operations

Mathematical operations deal with numbers. Warband Module System can only deal with integers. Floating point numbers are emulated by the so-called "fixed point numbers". Wherever you encounter a fixed point parameter for some Module System operation, keep in mind that it is actually just a regular integer number, HOWEVER it is supposed to represent a floating point number equal to fixed\_point\_number / fixed\_point\_multiplier. As you might have guessed, to convert a floating point number to fixed point, you have to multiply it by fixed\_point\_multiplier. You can change the value of multiplier with the operation (set\_fixed\_point\_multiplier), thus influencing the precision of all operations dealing with fixed point numbers.

A notion very important for Warband modding is that you reference all Warband objects by their numeric values. In other words, you can do maths with your items, troops, agents, scenes, parties et cetera. This is used extensively in the code, so don't be surprised to see code looking like (store\_add, ":value", "itm\_pike", 4). This code is just calculating a reference to an item which is located 4 positions after "itm\_pike" inside the module\_items.py file.

### Conditional operations

gt = 32

(gt, <value1>, <value2>),
Checks that value1 > value2
ge = 30

(ge, <value1>, <value2>),
Checks that value1 >= value2
eq = 31

(eq, <value1>, <value2>),
Checks that value1 == value2
neq = neg|eq

(neq, <value1>, <value2>),
Checks that value1 != value2
le = neg|gt

(le, <value1>, <value2>),
Checks that value1 <= value2
lt = neg|ge

(lt, <value1>, <value2>),
Checks that value1 < value2
is\_between = 33

(is\_between, <value>, <lower\_bound>, <upper\_bound>),
Checks that lower\_bound <= value < upper\_bound
### Mathematical and assignment operations

assign = 2133

(assign, <destination>, <value>),
Directly assigns a value to a variable or register.
store\_add = 2120

(store\_add, <destination>, <value>, <value>),
Assigns <destination>:= <value> + <value>
store\_sub = 2121

(store\_sub, <destination>, <value>, <value>),
Assigns <destination>:= <value> - <value>
store\_mul = 2122

(store\_mul, <destination>, <value>, <value>),
Assigns <destination>:= <value> \* <value>
store\_div = 2123

(store\_div, <destination>, <value>, <value>),
Assigns <destination>:= <value> / <value>
Fractional part will be truncated. Negative values will be rounded up.
store\_mod = 2119

(store\_mod, <destination>, <value>, <value>),
Assigns <destination>:= <value> MOD <value>
val\_add = 2105

(val\_add, <destination>, <value>),
Assigns <destination>:= <destination> + <value>
val\_sub = 2106

(val\_sub, <destination>, <value>),
Assigns <destination>:= <destination> - <value>
val\_mul = 2107

(val\_mul, <destination>, <value>),
Assigns <destination>:= <destination> \* <value>
val\_div = 2108

(val\_div, <destination>, <value>),
Assigns <destination>:= <destination> / <value>
Fractional part will be truncated. Negative values will be rounded up.
val\_mod = 2109

(val\_mod, <destination>, <value>),
Assigns <destination>:= <destination> MOD <value>
val\_min = 2110

(val\_min, <destination>, <value>),
Assigns the right value if the right value is less than left.
val\_max = 2111

(val\_max, <destination>, <value>),
Assigns the right value if the right value is greater than left.
val\_clamp = 2112

(val\_clamp, <destination>, <lower\_bound>, <upper\_bound>),
Enforces <destination> value to be within <lower\_bound>..<upper\_bound>-1 range.
val\_abs = 2113

(val\_abs, <destination>),
Assigns <destination>:= ABS (<destination>)
store\_or = 2116

(store\_or, <destination>, <value>, <value>),
Binary OR
store\_and = 2117

(store\_and, <destination>, <value>, <value>),
Binary AND
val\_or = 2114

(val\_or, <destination>, <value>),
Binary OR, overwriting first operand.
val\_and = 2115

(val\_and, <destination>, <value>),
Binary AND, overwriting first operand.
val\_lshift = 2100

(val\_lshift, <destination>, <value>),
Bitwise shift left (dest = dest \* 2 ^ value)
val\_rshift = 2101

(val\_rshift, <destination>, <value>),
Bitwise shift right (dest = dest / 2 ^ value)
store\_sqrt = 2125

(store\_sqrt, <destination\_fixed\_point>, <value\_fixed\_point>),
Assigns dest:= SQRT (value)
store\_pow = 2126

(store\_pow, <destination\_fixed\_point>, <value\_fixed\_point>, <power\_fixed\_point),
Assigns dest:= value ^ power
store\_sin = 2127

(store\_sin, <destination\_fixed\_point>, <value\_fixed\_point>),
Assigns dest:= SIN (value)
store\_cos = 2128

(store\_cos, <destination\_fixed\_point>, <value\_fixed\_point>),
Assigns dest:= COS (value)
store\_tan = 2129

(store\_tan, <destination\_fixed\_point>, <value\_fixed\_point>),
Assigns dest:= TAN (value)
store\_asin = 2140

(store\_asin, <destination\_fixed\_point>, <value\_fixed\_point>),
Assigns dest:= ARCSIN (value)
store\_acos = 2141

(store\_acos, <destination\_fixed\_point>, <value\_fixed\_point>),
Assigns dest:= ARCCOS (value)
store\_atan = 2142

(store\_atan, <destination\_fixed\_point>, <value\_fixed\_point>),
Assigns dest:= ARCTAN (value)
store\_atan2 = 2143

(store\_atan2, <destination\_fixed\_point>, <y\_fixed\_point>, <x\_fixed\_point>),
Returns the angle between the x axis and a point with coordinates (X,Y) in degrees. Note the angle is calculated counter-clockwise, i.e. (1,1) will return 45, not -45.
### Random number generation

store\_random = 2135

`(store_random, <destination>, <upper_range>),`
Stores a random value in the range of 0..<upper\_range>-1. Deprecated, use (store\_random\_in\_range) instead.
store\_random\_in\_range = 2136

`(store_random_in_range, <destination>, <range_low>, <range_high>),`
Stores a random value in the range of <range\_low>..<range\_high>-1.
shuffle\_range = 2134

`(shuffle_range, <reg_no>, <upper_bound>),`
Randomly shuffles a range of registers from <reg\_no> up to <upper\_bound - 1>, reordering the values contained in them. Commonly used for list randomization.
### Fixed point values handling

set\_fixed\_point\_multiplier = 2124

(set\_fixed\_point\_multiplier, <value>),
Affects all operations dealing with fixed point numbers. Default value is 1.
convert\_to\_fixed\_point = 2130

(convert\_to\_fixed\_point, <destination\_fixed\_point>),
Converts integer value to fixed point (multiplies by the fixed point multiplier).
convert\_from\_fixed\_point = 2131

(convert\_from\_fixed\_point, <destination>),
Converts fixed point value to integer (divides by the fixed point multiplier).
## Script/trigger parameters and results

Many scripts can accept additional parameters, and many triggers have some parameters of their own (as details in header\_triggers.py file). You can only pass numeric values as parameters. Since string constants are also Warband objects, you can pass them as well, and you can also pass string or position registers. However you cannot pass quick strings (string defined directly in the code). You can declare your scripts with as many parameters as you wish. Triggers, however, are always called with their predefined parameters. Also the game engine does not support more than 3 parameters per trigger. As the result, some triggers receive extra information which could not be fit into those three parameters in numeric, string or position registers. Some triggers and scripts called from the game engine (those have names starting with "game\_") expect you to return some value to the game engine. That value may be either a number or a string and is set by special operations listed below. Scripts called from the Module System, however, typically use registers to store their return data. Note that if you call a script from a trigger, you can still use operations to retrieve trigger's calling parameters, and they will retrieve values that have been passed to the trigger, not values that have been passed to the script.

store\_script\_param\_1 = 21

(store\_script\_param\_1, <destination>),
Retrieve the value of the first script parameter.
store\_script\_param\_2 = 22

(store\_script\_param\_2, <destination>),
Retrieve the value of the second script parameter.
store\_script\_param = 23

(store\_script\_param, <destination>, <script\_param\_index>),
Retrieve the value of arbitrary script parameter (generally used when script accepts more than two). Parameters are enumerated starting from 1.
set\_result\_string = 60

(set\_result\_string, <string>),
Sets the return value of a game\_\* script, when a string value is expected by game engine.
store\_trigger\_param\_1 = 2071

(store\_trigger\_param\_1, <destination>),
Retrieve the value of the first trigger parameter. Will retrieve trigger's parameters even when called from inside a script, for as long as that script is running within trigger context.
store\_trigger\_param\_2 = 2072

(store\_trigger\_param\_2, <destination>),
Retrieve the value of the second trigger parameter. Will retrieve trigger's parameters even when called from inside a script, for as long as that script is running within trigger context.
store\_trigger\_param\_3 = 2073

(store\_trigger\_param\_3, <destination>),
Retrieve the value of the third trigger parameter. Will retrieve trigger's parameters even when called from inside a script, for as long as that script is running within trigger context.
store\_trigger\_param = 2070

(store\_trigger\_param, <destination>, <trigger\_param\_no>),
Version 1.153+. Retrieve the value of arbitrary trigger parameter. Parameters are enumerated starting from 1. Will retrieve trigger's parameters even when called from inside a script, for as long as that script is running within trigger context.
get\_trigger\_object\_position = 702

(get\_trigger\_object\_position, <position>),
Retrieve the position of an object which caused the trigger to fire (when appropriate).
set\_trigger\_result = 2075

(set\_trigger\_result, <value>),
Sets the return value of a trigger or game\_\* script, when an integer value is expected by game engine.
## Keyboard and mouse input

The game provides modders with limited ability to control keyboard input and mouse movements. It is also possible to tamper with game keys (i.e. keys bound to specific game actions), including the ability to override game's reaction to those keys. Note that mouse buttons are keys too, and can be detected with the corresponding operations.

### Conditional operations

key\_is\_down = 70

(key\_is\_down, <key\_code>),
Checks if the specified key is clicked in the current frame, ignoring if it was clicked in the previous frame. See header\_triggers.py for key code reference.
key\_clicked = 71

(key\_clicked, <key\_code>),
Checks if the specified key is clicked in the current frame and wasn't clicked in the previous frame. See header\_triggers.py for key code reference.
game\_key\_is\_down = 72

(game\_key\_is\_down, <game\_key\_code>),
Checks if the specified game key is clicked in the current frame, ignoring if it was clicked in the previous frame. See header\_triggers.py for game key code reference.
game\_key\_clicked = 73

(game\_key\_clicked, <game\_key\_code>),
Checks if the specified game key is clicked in the current frame and wasn't clicked in the previous frame. See header\_triggers.py for game key code reference.
Doesn't work for party window on global map.
### Generic operations

omit\_key\_once = 77

(omit\_key\_once, <key\_code>),
Forces the game to ignore default bound action for the specified key on next press. Some keys can't be omited. Open the link to see all keys that can be omited.
clear\_omitted\_keys = 78

(clear\_omitted\_keys),
Clear all omitted keys.
mouse\_get\_position = 75

(mouse\_get\_position, <position>),
Stores mouse x and y coordinates in the specified position.
## World map

Generally, all operations which only make sense on the worldmap and have no specific category have been assembled here. These mostly deal with weather, time and resting.

### Conditional operations

is\_currently\_night = 2273

(is\_currently\_night),
Checks that it's currently night in the game.
map\_free = 37

(map\_free),
Checks that the player is currently on the global map and no game screens are open.
### Weather-handling operations

get\_global\_cloud\_amount = 90

(get\_global\_cloud\_amount, <destination>),
Returns current cloudiness (a value between 0..100).
set\_global\_cloud\_amount = 91

(set\_global\_cloud\_amount, <value>),
Sets current cloudiness (value is clamped to 0..100).
get\_global\_haze\_amount = 92

(get\_global\_haze\_amount, <destination>),
Returns current fogginess (value between 0..100).
set\_global\_haze\_amount = 93

(set\_global\_haze\_amount, <value>),
Sets current fogginess (value is clamped to 0..100).
### Time-related operations

store\_current\_hours = 2270

(store\_current\_hours, <destination>),
Stores number of hours that have passed since beginning of the game. Commonly used to track time when accuracy up to hours is required.
store\_time\_of\_day = 2271

(store\_time\_of\_day, <destination>),
Stores current day hour (value in 0..24 range).
store\_current\_day = 2272

(store\_current\_day, <destination>),
Stores number of days that have passed since beginning of the game. Commonly used to track time when high accuracy is not required.
rest\_for\_hours = 1030

(rest\_for\_hours, <rest\_time\_in\_hours>, [time\_speed\_multiplier], [remain\_attackable]),
Forces the player party to rest for specified number of hours. Time can be accelerated and player can be made immune or subject to attacks.
rest\_for\_hours\_interactive = 1031

(rest\_for\_hours\_interactive, <rest\_time\_in\_hours>, [time\_speed\_multiplier], [remain\_attackable]),
Forces the player party to rest for specified number of hours. Player can break the rest at any moment. Time can be accelerated and player can be made immune or subject to attacks.
## Game settings and statistics

This group of operations allows you to retrieve some of the game settings as configured by the player on Options page, and change them as necessary (possibly forcing a certain level of difficulty on the player). Operations dealing with achievements (an interesting, but underdeveloped feature of Warband) are also placed in this category.

### Conditional operations

is\_trial\_version = 250

(is\_trial\_version),
Checks if the game is in trial mode (has not been purchased). Player cannot get higher than level 6 in this mode.
is\_edit\_mode\_enabled = 255

(is\_edit\_mode\_enabled),
Version 1.153+. Checks that Edit Mode is currently enabled in the game. Useful for making additions to the default UI.
is\_cheat\_mode\_enabled = 53

(is\_cheat\_mode\_enabled),
Checks if Cheat Mode is currently enabled in the game i.e. "Enable Cheats" is ticked on in the launcher.
### Generic operations

get\_operation\_set\_version = 55

(get\_operation\_set\_version, <destination>),
Version 1.165+. 4research. Apparently returns the current version of Module System operations set, allowing transparent support for multiple Warband engine versions.
set\_player\_troop = 47

(set\_player\_troop, <troop\_id>),
Changes the troop player controls. Generally used in quick-battle scenarios to give player a predefined character.
show\_object\_details\_overlay = 960

(show\_object\_details\_overlay, <value>),
Turns various popup tooltips on (value = 1) and off (value = 0). This includes agent names and dropped item names during missions, item stats in inventory on mouse over, etc.
auto\_save = 985

(auto\_save),
Version 1.161+. Saves the game to the current save slot.
allow\_ironman = 988

(allow\_ironman, <value>),
1 = allow, 0 = disallow. Used on new games to disable realistic mode.
### Access to game options

options\_get\_damage\_to\_player = 260

(options\_get\_damage\_to\_player, <destination>),
0 = 1/4, 1 = 1/2, 2 = 1/1
options\_set\_damage\_to\_player = 261

(options\_set\_damage\_to\_player, <value>),
0 = 1/4, 1 = 1/2, 2 = 1/1
options\_get\_damage\_to\_friends = 262

(options\_get\_damage\_to\_friends, <destination>),
0 = 1/2, 1 = 3/4, 2 = 1/1
options\_set\_damage\_to\_friends = 263

(options\_set\_damage\_to\_friends, <value>),
0 = 1/2, 1 = 3/4, 2 = 1/1
options\_get\_combat\_ai = 264

(options\_get\_combat\_ai, <destination>),
0 = good, 1 = average, 2 = poor
options\_set\_combat\_ai = 265

(options\_set\_combat\_ai, <value>),
0 = good, 1 = average, 2 = poor
game\_get\_reduce\_campaign\_ai = 424

(game\_get\_reduce\_campaign\_ai, <destination>),
Deprecated operation. Use options\_get\_campaign\_ai instead
options\_get\_campaign\_ai = 266

(options\_get\_campaign\_ai, <destination>),
0 = good, 1 = average, 2 = poor
options\_set\_campaign\_ai = 267

(options\_set\_campaign\_ai, <value>),
0 = good, 1 = average, 2 = poor
options\_get\_combat\_speed = 268

(options\_get\_combat\_speed, <destination>),
0 = slowest, 1 = slower, 2 = normal, 3 = faster, 4 = fastest
options\_set\_combat\_speed = 269

(options\_set\_combat\_speed, <value>),
0 = slowest, 1 = slower, 2 = normal, 3 = faster, 4 = fastest
options\_get\_battle\_size = 270

(options\_get\_battle\_size, <destination>),
Version 1.161+. Retrieves current battle size slider value (in the range of 0..1000). Note that this is the slider value, not the battle size itself.
options\_set\_battle\_size = 271

(options\_set\_battle\_size, <value>),
Version 1.161+. Sets battle size slider to provided value (in the range of 0..1000). Note that this is the slider value, not the battle size itself.
To change the real battlesize you need to change entry string in the begining of the mission. Multiplier start from 1.25 to 5.25 according to options slider. Below is an example of the mission lead\_charge. Read more about entry string declaration in the begining of module\_mission\_templates.py file.

```
(1, mtef_team_0|mtef_defenders, 0, aif_start_alarmed, 40, []),

```

Battle reinforcements are half of the start:

```
(store_normalized_team_count, ":num_defenders", 0),
(lt, ":num_defenders", 20),                         # if less then 50%=20/40
(add_reinforcements_to_entry, 4, 20),               # add new wave 50%=20/40

```

To make options show the rigth battlesize values you need to change in **module.ini**

```
battle_size_min = 100 # (40+40)*1.25
battle_size_max = 420 # (40+40)*5.25

```

get\_average\_game\_difficulty = 990

(get\_average\_game\_difficulty, <destination>),
Returns calculated game difficulty rating (as displayed on the Options page). Commonly used for score calculation when ending the game.
### Achievements and kill stats

get\_achievement\_stat = 370

(get\_achievement\_stat, <destination>, <achievement\_id>, <stat\_index>),
Retrieves the numeric value associated with an achievement. Used to keep track of player's results before finally unlocking it.
set\_achievement\_stat = 371

(set\_achievement\_stat, <achievement\_id>, <stat\_index>, <value>),
Sets the new value associated with an achievement. Used to keep track of player's results before finally unlocking it.
unlock\_achievement = 372

(unlock\_achievement, <achievement\_id>),
Unlocks player's achievement. Apparently doesn't have any game effects.
get\_player\_agent\_kill\_count = 1701

(get\_player\_agent\_kill\_count, <destination>, [get\_wounded]),
Retrieves the total number of enemies killed by the player. Call with non-zero <get\_wounded> parameter to retrieve the total number of knocked down enemies. Returns lifetime kill counts.
get\_player\_agent\_own\_troop\_kill\_count = 1705

(get\_player\_agent\_own\_troop\_kill\_count, <destination>, [get\_wounded]),
Retrieves the total number of allies killed by the player. Call with non-zero <get\_wounded> parameter to retrieve the total number of knocked down allies.
## Factions

Despite the importance of factions to the game, there aren't that many actions to deal with them. Essentially, you can control colors and name of existing game factions, set or retrieve relations between them, and work with faction slots. There's also a number of operations which assign or retrieve the factional allegiance of other game objects, like parties and troops, but these have been placed in the respective sections of the file.

### Slot operations for factions

faction\_set\_slot = 502

(faction\_set\_slot, <faction\_id>, <slot\_no>, <value>),
faction\_get\_slot = 522

(faction\_get\_slot, <destination>, <faction\_id>, <slot\_no>),
faction\_slot\_eq = 542

(faction\_slot\_eq, <faction\_id>, <slot\_no>, <value>),
faction\_slot\_ge = 562

(faction\_slot\_ge, <faction\_id>, <slot\_no>, <value>),
### Generic operations

set\_relation = 1270

(set\_relation, <faction\_id\_1>, <faction\_id\_2>, <value>),
Sets relation between two factions. Relation is in -100..100 range.
store\_relation = 2190

(store\_relation, <destination>, <faction\_id\_1>, <faction\_id\_2>),
Retrieves relation between two factions. Relation is in -100..100 range.
faction\_set\_name = 1275

(faction\_set\_name, <faction\_id>, <string>),
Sets the name of the faction. See also (str\_store\_faction\_name) in String Operations.
faction\_set\_color = 1276

(faction\_set\_color, <faction\_id>, <color\_code>),
Sets the faction color. All parties and centers belonging to this faction will be displayed with this color on global map.
faction\_get\_color = 1277

(faction\_get\_color, <destination>, <faction\_id>),
Gets the faction color value.
## Parties and party templates

Parties are extremely important element of single-player modding, because they are the only object which can be present on the world map. Each party is a semi-independent object with it's own behavior. Note that you cannot control party's behavior directly, instead you can change various factors which affect party behavior (including party AI settings).

There are two things of importance when dealing with parties. First, parties can be attached to each other, this allows you, for example, to stack a number of armies inside a single city. Second, parties may encounter each other. When two AI parties are in encounter, it usually means they are fighting. Player's encounter with an AI party is usually much more complex and may involve pretty much anything, which is why player's encounters are covered in a separate section of the file.

Each party consists of troop stacks. Each troop stack is either a single hero (troop defined as tf\_hero in module\_troops.py file) or a number of regular troops (their number may vary from 1 and above). Each party has two sets of troop stacks: members (or companions) set of stacks, and prisoners set of stacks. Many operations will only affect members, others may only affect prisoners, and there are even operations to switch their roles.

Another important concept is a party template. It's definition looks very similar to a party. Templates are used when there's a need to create a number of parties with similar set of members, parameters or flags. Also templates can be easily used to differentiate parties from each other, so they are akin to a "party\_type" in the game.

Note that parties are the only game object which is persistent (i.e. it will be saved to the savegame file and restored on load), has slots and can be created during runtime. This makes parties ideal candidates for dynamic information storage of unlimited volume, which the game otherwise lacks.

### Conditional operations

hero\_can\_join = 101

(hero\_can\_join, [party\_id]),
Checks if party can accept one hero troop. Player's party is default value.
hero\_can\_join\_as\_prisoner = 102

(hero\_can\_join\_as\_prisoner, [party\_id]),
Checks if party can accept one hero prisoner troop. Player's party is default value.
party\_can\_join = 103

(party\_can\_join),
During encounter dialog, checks if encountered party can join player's party.
party\_can\_join\_as\_prisoner = 104

(party\_can\_join\_as\_prisoner),
During encounter dialog, checks if encountered party can join player's party as prisoners.
troops\_can\_join = 105

(troops\_can\_join, <value>),
Checks if player party has enough space for provided number of troops.
troops\_can\_join\_as\_prisoner = 106

(troops\_can\_join\_as\_prisoner, <value>),
Checks if player party has enough space for provided number of prisoners..
party\_can\_join\_party = 107

(party\_can\_join\_party, <joiner\_party\_id>, <host\_party\_id>, [flip\_prisoners]),
Checks if first party can join second party (enough space for both troops and prisoners). If flip\_prisoners flag is 1, then members and prisoners in the joining party are flipped.
main\_party\_has\_troop = 110

(main\_party\_has\_troop, <troop\_id>),
Checks if player party has specified troop.
party\_is\_in\_town = 130

(party\_is\_in\_town, <party\_id>, <town\_party\_id>),
Checks that the party has successfully reached it's destination (after being set to ai\_bhvr\_travel\_to\_party) and that it's destination is actually the referenced town\_party\_id.
party\_is\_in\_any\_town = 131

(party\_is\_in\_any\_town, <party\_id>),
Checks that the party has successfully reached it's destination (after being set to ai\_bhvr\_travel\_to\_party).
party\_is\_active = 132

(party\_is\_active, <party\_id>),
Checks that <party\_id> is valid and not disabled.
### Slot operations for parties and party templates

party\_template\_set\_slot = 504

(party\_template\_set\_slot, <party\_template\_id>, <slot\_no>, <value>),
party\_template\_get\_slot = 524

(party\_template\_get\_slot, <destination>, <party\_template\_id>, <slot\_no>),
party\_template\_slot\_eq = 544

(party\_template\_slot\_eq, <party\_template\_id>, <slot\_no>, <value>),
party\_template\_slot\_ge = 564

(party\_template\_slot\_ge, <party\_template\_id>, <slot\_no>, <value>),
party\_set\_slot = 501

(party\_set\_slot, <party\_id>, <slot\_no>, <value>),
party\_get\_slot = 521

(party\_get\_slot, <destination>, <party\_id>, <slot\_no>),
party\_slot\_eq = 541

(party\_slot\_eq, <party\_id>, <slot\_no>, <value>),
party\_slot\_ge = 561

(party\_slot\_ge, <party\_id>, <slot\_no>, <value>),
### Generic operations

set\_party\_creation\_random\_limits = 1080

(set\_party\_creation\_random\_limits, <min\_value>, <max\_value>),
Affects party sizes spawned from templates. May be used to spawn larger parties when player is high level. Values should be in 0..100 range.
set\_spawn\_radius = 1103

(set\_spawn\_radius, <value>),
Sets radius for party spawning with subsequent <spawn\_around\_party> operations.
spawn\_around\_party = 1100

(spawn\_around\_party, <party\_id>, <party\_template\_id>),
Creates a new party from a party template and puts it's <party\_id> into reg0.
disable\_party = 1230

(disable\_party, <party\_id>),
Party disappears from the map. Note that (try\_for\_parties) will still iterate over disabled parties, so you need to make additional checks with (party\_is\_active).
enable\_party = 1231

(enable\_party, <party\_id>),
Reactivates a previously disabled party.
remove\_party = 1232

(remove\_party, <party\_id>),
Destroys a party completely. Should ONLY be used with dynamically spawned parties, as removing parties pre-defined in module\_parties.py file will corrupt the savegame. Non-spawned parties may be disabled...
party\_get\_current\_terrain = 1608

(party\_get\_current\_terrain, <destination>, <party\_id>),
Returns a value from header\_terrain\_types.py
party\_relocate\_near\_party = 1623

(party\_relocate\_near\_party, <relocated\_party\_id>, <target\_party\_id>, <spawn\_radius>),
Teleports party into vicinity of another party.
party\_get\_position = 1625

(party\_get\_position, <dest\_position>, <party\_id>),
Stores current position of the party on world map.
party\_set\_position = 1626

(party\_set\_position, <party\_id>, <position>),
Teleports party to a specified position on the world map.
set\_camera\_follow\_party = 1021

(set\_camera\_follow\_party, <party\_id>),
Self-explanatory. Can be used on world map only. Commonly used to make camera follow a party which has captured player as prisoner.
party\_attach\_to\_party = 1660

(party\_attach\_to\_party, <party\_id>, <party\_id\_to\_attach\_to>),
Attach a party to another one (like lord's army staying in a town/castle).
party\_detach = 1661

(party\_detach, <party\_id>),
Remove a party from attachments and place it on the world map.
party\_collect\_attachments\_to\_party = 1662

(party\_collect\_attachments\_to\_party, <source\_party\_id>, <collected\_party\_id>),
Mostly used in various battle and AI calculations. Will create an aggregate party from all parties attached to the source party.
party\_get\_cur\_town = 1665

(party\_get\_cur\_town, <destination>, <party\_id>),
When a party has reached it's destination (using ai\_bhvr\_travel\_to\_party), this operation will retrieve the party\_id of the destination party.
party\_get\_attached\_to = 1694

(party\_get\_attached\_to, <destination>, <party\_id>),
Retrieves the party that the referenced party is attached to, if any.
party\_get\_num\_attached\_parties = 1695

(party\_get\_num\_attached\_parties, <destination>, <party\_id>),
Retrieves total number of parties attached to referenced party.
party\_get\_attached\_party\_with\_rank = 1696

(party\_get\_attached\_party\_with\_rank, <destination>, <party\_id>, <attached\_party\_index>),
Extract party\_id of a specified party among attached.
party\_set\_name = 1669

(party\_set\_name, <party\_id>, <string>),
Sets party name (will be displayed as label and/or in the party details popup).
party\_set\_extra\_text = 1605

(party\_set\_extra\_text, <party\_id>, <string>),
Allows to put extra text in party details popup. Used in Native to set status for villages or towns (being raided, razed, under siege...).
party\_get\_icon = 1681

(party\_get\_icon, <destination>, <party\_id>),
Retrieve map icon used for the party.
party\_set\_icon = 1676

(party\_set\_icon, <party\_id>, <map\_icon\_id>),
Sets what map icon will be used for the party.
party\_set\_banner\_icon = 1677

(party\_set\_banner\_icon, <party\_id>, <map\_icon\_id>),
Sets what map icon will be used as the party banner. Use 0 to remove banner from a party.
party\_set\_extra\_icon = 1682

(party\_set\_extra\_icon, <party\_id>, <map\_icon\_id>, <vertical\_offset\_fixed\_point>, <up\_down\_frequency\_fixed\_point>, <rotate\_frequency\_fixed\_point>, <fade\_in\_out\_frequency\_fixed\_point>),
frequencies are in number of revolutions per second
Adds or removes an extra map icon to a party, possibly with some animations. To remove extra icon set all params to 0.
party\_add\_particle\_system = 1678

(party\_add\_particle\_system, <party\_id>, <particle\_system\_id>),
Appends some special visual effects to the party on the map. Used in Native to add fire and smoke over villages.
party\_clear\_particle\_systems = 1679

(party\_clear\_particle\_systems, <party\_id>),
Removes all special visual effects from the party on the map.
context\_menu\_add\_item = 980

(context\_menu\_add\_item, <string\_id>, <value>),
Must be called inside script\_game\_context\_menu\_get\_buttons. Adds context menu option for a party and it's respective identifier (will be passed to script\_game\_event\_context\_menu\_button\_clicked).
party\_get\_template\_id = 1609

(party\_get\_template\_id, <destination>, <party\_id>),
Retrieves what party template was used to create the party (if any). Commonly used to identify encountered party type.
party\_set\_faction = 1620

(party\_set\_faction, <party\_id>, <faction\_id>),
Sets party faction allegiance. Party color is changed appropriately.
store\_faction\_of\_party = 2204

(store\_faction\_of\_party, <destination>, <party\_id>),
Retrieves current faction allegiance of the party.
store\_random\_party\_in\_range = 2254

(store\_random\_party\_in\_range, <destination>, <lower\_bound>, <upper\_bound>),
Retrieves one random party from the range. Generally used only for predefined parties (towns, villages etc).
store01\_random\_parties\_in\_range = 2255

(store01\_random\_parties\_in\_range, <lower\_bound>, <upper\_bound>),
Stores two random, different parties in a range to reg0 and reg1. Generally used only for predefined parties (towns, villages etc).
store\_distance\_to\_party\_from\_party = 2281

(store\_distance\_to\_party\_from\_party, <destination>, <party\_id>, <party\_id>),
Retrieves distance between two parties on the global map.
store\_num\_parties\_of\_template = 2310

(store\_num\_parties\_of\_template, <destination>, <party\_template\_id>),
Stores number of active parties which were created using specified party template.
store\_random\_party\_of\_template = 2311

(store\_random\_party\_of\_template, <destination>, <party\_template\_id>),
Retrieves one random party which was created using specified party template. Fails if no party exists with provided template. (expensive)
store\_num\_parties\_created = 2300

(store\_num\_parties\_created, <destination>, <party\_template\_id>),
Stores the total number of created parties of specified type. Not used in Native.
store\_num\_parties\_destroyed = 2301

(store\_num\_parties\_destroyed, <destination>, <party\_template\_id>),
Stores the total number of destroyed parties of specified type.
store\_num\_parties\_destroyed\_by\_player = 2302

(store\_num\_parties\_destroyed\_by\_player, <destination>, <party\_template\_id>),
Stores the total number of parties of specified type which have been destroyed by player.
party\_get\_morale = 1671

(party\_get\_morale, <destination>, <party\_id>),
Returns a value in the range of 0..100. Party morale does not affect party behavior on the map, but will be taken in account if the party is engaged in battle (except auto-calc).
party\_set\_morale = 1672

(party\_set\_morale, <party\_id>, <value>),
Value should be in the range of 0..100. Party morale does not affect party behavior on the map, but will be taken in account if the party is engaged in battle (except auto-calc).
### Party members manipulation

party\_join = 1201

(party\_join),
During encounter, joins encountered party to player's party
party\_join\_as\_prisoner = 1202

(party\_join\_as\_prisoner),
During encounter, joins encountered party to player's party as prisoners
troop\_join = 1203

(troop\_join, <troop\_id>),
Specified hero joins player's party
troop\_join\_as\_prisoner = 1204

(troop\_join\_as\_prisoner, <troop\_id>),
Specified hero joins player's party as prisoner
add\_companion\_party = 1233

(add\_companion\_party, <troop\_id\_hero>),
Creates a new empty party with specified hero as party leader and the only member. Party is spawned at the position of player's party.
party\_add\_members = 1610

(party\_add\_members, <party\_id>, <troop\_id>, <number>),
Returns total number of added troops in reg0.
party\_add\_prisoners = 1611

(party\_add\_prisoners, <party\_id>, <troop\_id>, <number>),
Returns total number of added prisoners in reg0.
party\_add\_leader = 1612

(party\_add\_leader, <party\_id>, <troop\_id>, [number]),
Adds troop(s) to the party and makes it party leader.
party\_force\_add\_members = 1613

(party\_force\_add\_members, <party\_id>, <troop\_id>, <number>),
Adds troops to party ignoring party size limits. Mostly used to add hero troops.
party\_force\_add\_prisoners = 1614

(party\_force\_add\_prisoners, <party\_id>, <troop\_id>, <number>),
Adds prisoners to party ignoring party size limits. Mostly used to add hero prisoners. Doesn't add if troop already exists in the party.
party\_add\_template = 1675

(party\_add\_template, <party\_id>, <party\_template\_id>, [reverse\_prisoner\_status]),
Reinforces the party using the specified party template. Optional flag switches troop/prisoner status for reinforcements.
distribute\_party\_among\_party\_group = 1698

(distribute\_party\_among\_party\_group, <party\_to\_be\_distributed>, <group\_root\_party>),
Distributes troops from first party among all parties attached to the second party. Commonly used to divide prisoners and resqued troops among NPC parties.
remove\_member\_from\_party = 1210

(remove\_member\_from\_party, <troop\_id>, [party\_id]),
Removes hero member from party. Player party is default value. Will display a message about companion leaving the party. Should not be used with regular troops (it will successfully remove one of them, but will produce some meaningless spam).
remove\_regular\_prisoners = 1211

(remove\_regular\_prisoners, <party\_id>),
Removes all non-hero prisoners from the party.
remove\_troops\_from\_companions = 1215

(remove\_troops\_from\_companions, <troop\_id>, <value>),
Removes troops from player's party with message of removed troops number.
Unlike (party\_remove\_members) will not store number of removed in reg0.
Apparently bugged. In the message the name of the troop will be (null) and it will not show the number of troops removed but the value of troops to remove passed as argument. But with npc it works fine.
remove\_troops\_from\_prisoners = 1216

(remove\_troops\_from\_prisoners, <troop\_id>, <value>),
Removes prisoners from player's party.
party\_remove\_members = 1615

(party\_remove\_members, <party\_id>, <troop\_id>, <number>),
Removes specified number of troops from a party. Stores number of actually removed troops in reg0.
party\_remove\_prisoners = 1616

(party\_remove\_prisoners, <party\_id>, <troop\_id>, <number>),
Removes specified number of prisoners from a party. Stores number of actually removed prisoners in reg0.
party\_clear = 1617

(party\_clear, <party\_id>),
Removes all members and prisoners from the party.
add\_gold\_to\_party = 1070

(add\_gold\_to\_party, <value>, <party\_id>),
Marks the party as carrying the specified amount of gold, which can be pillaged by player if he destroys it. Operation must not be used to give gold to player's party.
### Calculating party and stack sizes

party\_get\_num\_companions = 1601

`(party_get_num_companions, <destination>, <party_id>),`
Returns total number of party members, including leader.
party\_get\_num\_prisoners = 1602

`(party_get_num_prisoners, <destination>, <party_id>),`
Returns total number of party prisoners.
party\_count\_members\_of\_type = 1630

`(party_count_members_of_type, <destination>, <party_id>, <troop_id>),`
Returns total number of party members of specific type.
party\_count\_companions\_of\_type = 1631

`(party_count_companions_of_type, <destination>, <party_id>, <troop_id>),`
Duplicates (party\_count\_members\_of\_type).
party\_count\_prisoners\_of\_type = 1632

`(party_count_prisoners_of_type, <destination>, <party_id>, <troop_id>),`
Returns total number of prisoners of specific type.
party\_get\_free\_companions\_capacity = 1633

`(party_get_free_companions_capacity, <destination>, <party_id>),`
Calculates how many members can be added to the party.
party\_get\_free\_prisoners\_capacity = 1634

`(party_get_free_prisoners_capacity, <destination>, <party_id>),`
Calculates how many prisoners can be added to the party.
party\_get\_num\_companion\_stacks = 1650

`(party_get_num_companion_stacks, <destination>, <party_id>),`
Returns total number of troop stacks in the party (including player and heroes).
party\_get\_num\_prisoner\_stacks = 1651

`(party_get_num_prisoner_stacks, <destination>, <party_id>),`
Returns total number of prisoner stacks in the party (including any heroes).
party\_stack\_get\_troop\_id = 1652

`(party_stack_get_troop_id, <destination>, <party_id>, <stack_no>),`
Extracts troop type of the specified troop stack.
party\_stack\_get\_size = 1653

`(party_stack_get_size, <destination>, <party_id>, <stack_no>),`
Extracts number of troops in the specified troop stack.
party\_stack\_get\_num\_wounded = 1654

`(party_stack_get_num_wounded, <destination>, <party_id>, <stack_no>),`
Extracts number of wounded troops in the specified troop stack.
For heroes always return 0 - use 'troop\_is\_wounded = 1508'.
party\_stack\_get\_troop\_dna = 1655

`(party_stack_get_troop_dna, <destination>, <party_id>, <stack_no>),`
Extracts DNA from the specified troop stack. Used to properly generate appereance in conversations.
party\_prisoner\_stack\_get\_troop\_id = 1656

`(party_prisoner_stack_get_troop_id, <destination>, <party_id>, <stack_no>),`
Extracts troop type of the specified prisoner stack.
party\_prisoner\_stack\_get\_size = 1657

`(party_prisoner_stack_get_size, <destination>, <party_id>, <stack_no>),`
Extracts number of troops in the specified prisoner stack.
party\_prisoner\_stack\_get\_troop\_dna = 1658

`(party_prisoner_stack_get_troop_dna, <destination>, <party_id>, <stack_no>),`
Extracts DNA from the specified prisoner stack. Used to properly generate appereance in conversations.
store\_num\_free\_stacks = 2154

`(store_num_free_stacks, <destination>, <party_id>),`
Deprecated, as Warband no longer has limits on number of stacks in the party. Always returns 10.
store\_num\_free\_prisoner\_stacks = 2155

`(store_num_free_prisoner_stacks, <destination>, <party_id>),`
Deprecated, as Warband no longer has limits on number of stacks in the party. Always returns 10.
store\_party\_size = 2156

`(store_party_size, <destination>,[party_id]),`
Stores total party size (all members and prisoners).
store\_party\_size\_wo\_prisoners = 2157

`(store_party_size_wo_prisoners, <destination>, [party_id]),`
Stores total number of members in the party (without prisoners), duplicating (party\_get\_num\_companions).
store\_troop\_kind\_count = 2158

`(store_troop_kind_count, <destination>, <troop_type_id>),`
Counts number of troops of specified type in player's party. Deprecated, use party\_count\_members\_of\_type instead.
store\_num\_regular\_prisoners = 2159

`(store_num_regular_prisoners, <destination>, <party_id>),`
Deprecated and does not work. Do not use.
store\_troop\_count\_companions = 2160

`(store_troop_count_companions, <destination>, <troop_id>, [party_id]),`
Apparently deprecated, duplicates (party\_get\_num\_companions). Not used in Native.
store\_troop\_count\_prisoners = 2161

`(store_troop_count_prisoners, <destination>, <troop_id>, [party_id]),`
Apparently deprecated, duplicates (party\_get\_num\_prisoners). Not used in Native.
store\_main\_party\_wounded = 2180

`(store_main_party_wounded, <destination>),`
Calculates wounded regulars and NPCs of the main player party and stores into <destination>.
### Party experience and skills

party\_add\_xp\_to\_stack = 1670

`(party_add_xp_to_stack, <party_id>, <stack_no>, <xp_amount>),`
Awards specified number of xp points to a single troop stack in the party.
party\_upgrade\_with\_xp = 1673

`(party_upgrade_with_xp, <party_id>, <xp_amount>, <upgrade_path>),`
upgrade\_path can be:
Awards specified number of xp points to entire party (split between all stacks) and upgrades all eligible troops. Upgrade direction: (0 = random, 1 = first, 2 = second).
party\_add\_xp = 1674

`(party_add_xp, <party_id>, <xp_amount>),`
Awards specified number of xp points to entire party (split between all stacks).
party\_get\_skill\_level = 1685

`(party_get_skill_level, <destination>, <party_id>, <skill_no>),`
Retrieves skill level for the specified party (usually max among the heroes). Makes a callback to (script\_game\_get\_skill\_modifier\_for\_troop).
If party doesn't have a single hero, than skill of the top stack will be counted.
### Combat related operations

heal\_party = 1225

(heal\_party, <party\_id>),
Heals all wounded party members.
party\_wound\_members = 1618

(party\_wound\_members, <party\_id>, <troop\_id>, <number>),
Wounds a specified number of troops in the party.
party\_remove\_members\_wounded\_first = 1619

(party\_remove\_members\_wounded\_first, <party\_id>, <troop\_id>, <number>),
Removes a certain number of troops from the party, starting with wounded. Stores total number removed in reg0.
party\_quick\_attach\_to\_current\_battle = 1663

(party\_quick\_attach\_to\_current\_battle, <party\_id>, <side>),
Adds any party into current encounter at specified side (0 = ally, 1 = enemy, 2 = enemy if (neq, "$g\_enemy\_party", "$g\_encountered\_party"),).
party\_leave\_cur\_battle = 1666

(party\_leave\_cur\_battle, <party\_id>),
Forces the party to leave it's current battle (if it's engaged).
party\_set\_next\_battle\_simulation\_time = 1667

(party\_set\_next\_battle\_simulation\_time, <party\_id>, <next\_simulation\_time\_in\_hours>),
Defines the period of time (in hours) after which the battle must be simulated for the specified party for the next time. When a value <= 0 is passed, the combat simulation round is performed immediately.
party\_get\_battle\_opponent = 1680

(party\_get\_battle\_opponent, <destination>, <party\_id>),
When a party is engaged in battle with another party, returns it's opponent party. Otherwise returns -1.
inflict\_casualties\_to\_party\_group = 1697

(inflict\_casualties\_to\_party, <parent\_party\_id>, <damage\_amount>, <party\_id\_to\_add\_causalties\_to>),
Delivers auto-calculated damage to the party (and all other parties attached to it). Killed troops are moved to another party to keep track of.
party\_end\_battle = 108

(party\_end\_battle, <party\_no>),
Version 1.153+. UNTESTED. Supposedly ends the battle in which the party is currently participating.
### Party AI

party\_set\_marshall = 1604

(party\_set\_marshall, <party\_id>, <value>),
party\_set\_marshal = party\_set\_marshall: (party\_set\_marshal, <party\_id>, <value>),

Sets party as a marshall party or turns it back to normal party. Value is either 1 or 0. This affects party behavior, but exact effects are not known. Alternative operation name spelling added to enable compatibility with Viking Conquest DLC module system.
party\_set\_flags = 1603

(party\_set\_flag, <party\_id>, <flag>, <clear\_or\_set>),
Sets (1) or clears (0) party flags in runtime. See header\_parties.py for flags reference.
party\_set\_aggressiveness = 1606

(party\_set\_aggressiveness, <party\_id>, <number>),
Sets aggressiveness value for the party (range 0..15).
party\_set\_courage = 1607

(party\_set\_courage, <party\_id>, <number>),
Sets courage value for the party (range 4..15).
party\_get\_ai\_initiative = 1638

(party\_get\_ai\_initiative, <destination>, <party\_id>),
Gets party current AI initiative value (range 0..100).
party\_set\_ai\_initiative = 1639

(party\_set\_ai\_initiative, <party\_id>, <value>),
Sets AI initiative value for the party (range 0..100).
party\_set\_ai\_behavior = 1640

(party\_set\_ai\_behavior, <party\_id>, <ai\_bhvr>),
Sets AI behavior for the party. See header\_parties.py for reference.
party\_set\_ai\_object = 1641

(party\_set\_ai\_object, <party\_id>, <object\_party\_id>),
Sets another party as the object for current AI behavior (follow that party).
party\_set\_ai\_target\_position = 1642

(party\_set\_ai\_target\_position, <party\_id>, <position>),
Sets a specific world map position as the object for current AI behavior (travel to that point).
party\_set\_ai\_patrol\_radius = 1643

(party\_set\_ai\_patrol\_radius, <party\_id>, <radius\_in\_km>),
Sets a radius for AI patrolling behavior.
party\_ignore\_player = 1644

(party\_ignore\_player, <party\_id>, <duration\_in\_hours>),
Makes AI party ignore player for the specified time.
party\_set\_bandit\_attraction = 1645

(party\_set\_bandit\_attraction, <party\_id>, <attaraction>),
Sets party attractiveness to parties with bandit behavior (range 0..100).
party\_get\_helpfulness = 1646

(party\_get\_helpfulness, <destination>, <party\_id>),
Gets party current AI helpfulness value (range 0..100).
party\_set\_helpfulness = 1647

(party\_set\_helpfulness, <party\_id>, <number>),
Sets AI helpfulness value for the party (range 0..10000, default 100).
Official: tendency to help friendly parties under attack.
get\_party\_ai\_behavior = 2290

(get\_party\_ai\_behavior, <destination>, <party\_id>),
Retrieves current AI behavior pattern for the party.
get\_party\_ai\_object = 2291

(get\_party\_ai\_object, <destination>, <party\_id>),
Retrieves what party is currently used as object for AI behavior.
party\_get\_ai\_target\_position = 2292

(party\_get\_ai\_target\_position, <position>, <party\_id>),
Retrieves what position is currently used as object for AI behavior.
get\_party\_ai\_current\_behavior = 2293

(get\_party\_ai\_current\_behavior, <destination>, <party\_id>),
Retrieves current AI behavior pattern when it was overridden by current situation (fleeing from enemy when en route to destination).
get\_party\_ai\_current\_object = 2294

(get\_party\_ai\_current\_object, <destination>, <party\_id>),
Retrieves what party has caused temporary behavior switch.
party\_set\_ignore\_with\_player\_party = 1648

(party\_set\_ignore\_with\_player\_party, <party\_id>, <value>),
Version 1.161+. Effects uncertain. 4research
party\_get\_ignore\_with\_player\_party = 1649

(party\_get\_ignore\_with\_player\_party, <party\_id>),
Version 1.161+. Effects uncertain. Documented official syntax is suspicious and probably incorrect. 4research
## Troops

What troops are.

There are two major types of troops: heroes and regulars. They are treated very differently by the game, so it's important not to confuse them. At the same time, most Module System operations will not make any differentiation between hero and regular troops.

First of all, hero troops do not stack. You cannot have a stack of heroes in a party, each hero will always occupy a separate troop slot. At the same time, you can put any number of regular troops into a single troop slot.

Second, the way the game treats equipment of heroes and troops is also different. All heroes' items are treated in the same way as player's (no big surprise, since player is actually a hero troop himself). Meanwhile, items that the troop has are just suggestions for what this troop \*might\* take into battle. On the battlefield, each agent spawned from the regular troop, will only take a limited number of items from the inventory provided by the troop definition in module\_troops.py. Choice is absolutely random (Vetrogor: it is not random. If you restart battle with 2 agents of the same troop their equipment will be the same. For research...) and modder has only limited control over it through the use of guarantee flags.

There's one more additional caveat: while you can easily change the outfit of a hero troop and your changes will persist through the game, same applies to regular troops. In other words, by changing equipment of some regular troop, you are changing all instances of that troop throughout the entire game. In other words, you cannot re-equip a stack of regulars in a single party - your changes will affect all parties in the world.

Third, while all heroes have a single predefined face code, which is used consistently through the game, troops have entire range of face codes. This range is used to randomize each agent's face within those constraints, so a group of 12 pikemen will not look like a bunch of clones.

Fourth, hero troops can't be killed in battle. Every time hero's hit points are reduced to zero, hero is always knocked down. For regular troops, chance to be knocked down depends on the number of factors, but their default fate when driven to zero health is death.

### Conditional operators

troop\_has\_item\_equipped = 151

(troop\_has\_item\_equipped, <troop\_id>, <item\_id>),
Checks that the troop has this item equipped (worn or wielded).
troop\_is\_mounted = 152

(troop\_is\_mounted, <troop\_id>),
Checks the troop for tf\_mounted flag (see header\_troops.py). Does NOT check that the troop has a horse.
troop\_is\_guarantee\_ranged = 153

(troop\_is\_guarantee\_ranged, <troop\_id>),
Checks the troop for tf\_guarantee\_ranged flag (see header\_troops.py). Does not check that troop actually has some ranged weapon.
troop\_is\_guarantee\_horse = 154

(troop\_is\_guarantee\_horse, <troop\_id>),
Checks the troop for tf\_guarantee\_horse flag (see header\_troops.py). Does not check that troop actually has some horse.
troop\_is\_hero = 1507

(troop\_is\_hero, <troop\_id>),
Checks the troop for tf\_hero flag (see header\_troops.py). Hero troops are actual characters and do not stack in party window.
troop\_is\_wounded = 1508

(troop\_is\_wounded, <troop\_id>),
Checks that the troop is wounded. Only works for hero troops.
player\_has\_item = 150

(player\_has\_item, <item\_id>),
Checks that player has the specified item.
### Slot operations for troops

Slots numbers start from 0 and end at maximum 1'048'575=0xFFFFF. Any other slot will return 0 as value.

troop\_set\_slot = 500

(troop\_set\_slot, <troop\_id>, <slot\_no>, <value>),
troop\_get\_slot = 520

(troop\_get\_slot, <destination>, <troop\_id>, <slot\_no>),
troop\_slot\_eq = 540

(troop\_slot\_eq, <troop\_id>, <slot\_no>, <value>),
troop\_slot\_ge = 560

(troop\_slot\_ge, <troop\_id>, <slot\_no>, <value>),
### Troop attributes and skills

troop\_set\_type = 1505

(troop\_set\_type, <troop\_id>, <skin>),
Changes the troop skin. There are two skins in Native: male and female, so in effect this operation sets troop gender. However mods may declare other skins.
troop\_get\_type = 1506

(troop\_get\_type, <destination>, <troop\_id>),
Returns troop current skin (i.e. gender).
troop\_set\_class = 1517

(troop\_set\_class, <troop\_id>, <value>),
Sets troop class (infantry, archers, cavalry or any of custom classes). Accepts values in range 0..8. See grc\_\* constants in header\_mission\_templates.py.
troop\_get\_class = 1516

(troop\_get\_class, <destination>, <troop\_id>),
Retrieves troop class. Returns values in range 0..8.
class\_set\_name = 1837

(class\_set\_name, <sub\_class>, <string\_id>),
Sets a new name for troop class (aka "Infantry", "Cavalry", "Custom Group 3"...).
add\_xp\_to\_troop = 1062

(add\_xp\_to\_troop, <value>, [troop\_id]),
Adds some xp points to troop. Only makes sense for player and hero troops. Default troop\_id is player. Amount of xp can be negative.
add\_xp\_as\_reward = 1064

(add\_xp\_as\_reward, <value>),
Adds the specified amount of xp points to player. Typically used as a quest reward operation.
troop\_get\_xp = 1515

(troop\_get\_xp, <destination>, <troop\_id>),
Retrieves total amount of xp specified troop has.
store\_attribute\_level = 2172

(store\_attribute\_level, <destination>, <troop\_id>, <attribute\_id>),
Stores current value of troop attribute. See ca\_\* constants in header\_troops.py for reference.
troop\_raise\_attribute = 1520

(troop\_raise\_attribute, <troop\_id>, <attribute\_id>, <value>),
Increases troop attribute by the specified amount. See ca\_\* constants in header\_troops.py for reference. Use negative values to reduce attributes. When used on non-hero troop, will affect all instances of that troop.
store\_skill\_level = 2170

(store\_skill\_level, <destination>, <skill\_id>, [troop\_id]),
Stores current value of troop skill. See header\_skills.py for reference.
troop\_raise\_skill = 1521

(troop\_raise\_skill, <troop\_id>, <skill\_id>, <value>),
Increases troop skill by the specified value. Value can be negative. See header\_skills.py for reference. When used on non-hero troop, will affect all instances of that troop.
store\_proficiency\_level = 2176

(store\_proficiency\_level, <destination>, <troop\_id>, <attribute\_id>),
Stores current value of troop weapon proficiency. See wpt\_\* constants in header\_troops.py for reference.
troop\_raise\_proficiency = 1522

(troop\_raise\_proficiency, <troop\_id>, <proficiency\_no>, <value>),
Increases troop weapon proficiency by the specified value. Value can be negative. Increase is subject to limits defined by Weapon Master skill. When used on non-hero troop, will affect all instances of that troop.
troop\_raise\_proficiency\_linear = 1523

(troop\_raise\_proficiency\_linear, <troop\_id>, <proficiency\_no>, <value>),
Same as (troop\_raise\_proficiency), but does not take Weapon Master skill into account (i.e. can increase proficiencies indefinitely).
troop\_add\_proficiency\_points = 1525

(troop\_add\_proficiency\_points, <troop\_id>, <value>),
Adds some proficiency points to a hero troop which can later be distributed by player.
store\_troop\_health = 2175

(store\_troop\_health, <destination>, <troop\_id>, [absolute]),: set absolute to 1 to get actual health; otherwise this will return percentage health in range (0-100)
Retrieves current troop health. Use absolute = 1 to retrieve actual number of hp points left, use absolute = 0 to retrieve a value in 0..100 range (percentage).
troop\_set\_health = 1560

(troop\_set\_health, <troop\_id>, <relative health (0-100)>),
Sets troop health. Accepts value in range 0..100 (percentage).
troop\_get\_upgrade\_troop = 1561

(troop\_get\_upgrade\_troop, <destination>, <troop\_id>, <upgrade\_path>),
Retrieves possible directions for non-hero troop upgrade. Use 0 to retrieve first upgrade path, and 1 to return second. Result of 0 means there's no such upgrade path for this troop.
store\_character\_level = 2171

(store\_character\_level, <destination>, [troop\_id]),
Retrieves character level of the troop. Default troop is the player.
get\_level\_boundary = 991

(get\_level\_boundary, <destination>, <level\_no>),
Returns the amount of experience points required to reach the specified level (will return 0 for 1st level). Maximum possible level in the game is 63.
add\_gold\_as\_xp = 1063

(add\_gold\_as\_xp, <value>, [troop\_id]),: Default troop is player
Adds a certain amount of experience points, depending on the amount of gold specified. Conversion rate is unclear and apparently somewhat randomized (three runs with 1000 gold produced values 1091, 804 and 799).
### Troop equipment handling

troop\_set\_auto\_equip = 1509

(troop\_set\_auto\_equip, <troop\_id>, <value>),
Sets (value = 1) or disables (value = 0) auto-equipping the troop with any items added to it's inventory or purchased. Similar to tf\_is\_merchant flag.
troop\_ensure\_inventory\_space = 1510

(troop\_ensure\_inventory\_space, <troop\_id>, <value>),
Removes items from troop inventory until troop has specified number of free inventory slots. Will free inventory slots starting from the end (items at the bottom of inventory will be removed first if there's not enough free space).
troop\_sort\_inventory = 1511

(troop\_sort\_inventory, <troop\_id>),
Sorts items in troop inventory by their price (expensive first).
troop\_add\_item = 1530

(troop\_add\_item, <troop\_id>, <item\_id>, [modifier]),
Adds an item to the troop, optionally with a modifier (see imod\_\* constants in header\_item\_modifiers.py).
troop\_remove\_item = 1531

(troop\_remove\_item, <troop\_id>, <item\_id>),
Removes an item from the troop equipment or inventory. Operation will remove first matching item it finds.
troop\_clear\_inventory = 1532

(troop\_clear\_inventory, <troop\_id>),
Clears entire troop inventory. Does not affect equipped items.
troop\_equip\_items = 1533

(troop\_equip\_items, <troop\_id>),
Makes the troop reconsider it's equipment. If troop has better stuff in it's inventory, he will equip it. Note this operation sucks with weapons and may force the troop to equip himself with 4 two-handed swords.
troop\_inventory\_slot\_set\_item\_amount = 1534

(troop\_inventory\_slot\_set\_item\_amount, <troop\_id>, <inventory\_slot\_no>, <value>),
Sets the stack size for a specified equipment or inventory slot. Only makes sense for items like ammo or food (which show stuff like "23/50" in inventory). Equipment slots are in range 0..9, see ek\_\* constants in header\_items.py for reference.
troop\_inventory\_slot\_get\_item\_amount = 1537

(troop\_inventory\_slot\_get\_item\_amount, <destination>, <troop\_id>, <inventory\_slot\_no>),
Retrieves the stack size for a specified equipment or inventory slot (if some Bread is 23/50, this operation will return 23).
troop\_inventory\_slot\_get\_item\_max\_amount = 1538

(troop\_inventory\_slot\_get\_item\_max\_amount, <destination>, <troop\_id>, <inventory\_slot\_no>),
Retrieves the maximum possible stack size for a specified equipment or inventory slot (if some Bread is 23/50, this operation will return 50).
troop\_add\_items = 1535

(troop\_add\_items, <troop\_id>, <item\_id>, <number>),
Adds multiple items of specified type to the troop.
troop\_remove\_items = 1536

(troop\_remove\_items, <troop\_id>, <item\_id>, <number>),
Removes multiple items of specified type from the troop. Total price of actually removed items will be stored in reg0. Doesn't take item modifiers. Will not fail if <troop\_id> does not have the required items.
troop\_loot\_troop = 1539

(troop\_loot\_troop, <target\_troop>, <source\_troop\_id>, <probability>),
Adds to target\_troop's inventory some items from source\_troop's equipment and inventory with some probability. Does not actually remove items from source\_troop. Commonly used in Native to generate random loot after the battle.
troop\_get\_inventory\_capacity = 1540

(troop\_get\_inventory\_capacity, <destination>, <troop\_id>),
Returns the total inventory capacity (number of inventory slots) for the specified troop. Note that this number will include equipment slots as well. Substract num\_equipment\_kinds (see header\_items.py) to get the number of actual \*inventory\* slots.
troop\_get\_inventory\_slot = 1541

(troop\_get\_inventory\_slot, <destination>, <troop\_id>, <inventory\_slot\_no>),
Retrieves the item\_id of a specified equipment or inventory slot. Returns -1 when there's nothing there.
troop\_get\_inventory\_slot\_modifier = 1542

(troop\_get\_inventory\_slot\_modifier, <destination>, <troop\_id>, <inventory\_slot\_no>),
Retrieves the modifier value (see imod\_\* constants in header\_items.py) for an item in the specified equipment or inventory slot. Returns 0 when there's nothing there, or if item does not have any modifiers.
troop\_set\_inventory\_slot = 1543

(troop\_set\_inventory\_slot, <troop\_id>, <inventory\_slot\_no>, <item\_id>),
Puts the specified item into troop's equipment or inventory slot. Be careful with setting equipment slots this way.
troop\_set\_inventory\_slot\_modifier = 1544

(troop\_set\_inventory\_slot\_modifier, <troop\_id>, <inventory\_slot\_no>, <imod\_value>),
Sets the modifier for the item in the troop's equipment or inventory slot. See imod\_\* constants in header\_items.py for reference.
store\_item\_kind\_count = 2165

(store\_item\_kind\_count, <destination>, <item\_id>, [troop\_id]),
Calculates total number of items of specified type that the troop has. Default troop is player.
store\_free\_inventory\_capacity = 2167

(store\_free\_inventory\_capacity, <destination>, [troop\_id]),
Calculates total number of free inventory slots that the troop has. Default troop is player.
### Merchandise handling

reset\_price\_rates = 1170

(reset\_price\_rates),
Resets customized price rates for merchants.
set\_price\_rate\_for\_item = 1171

(set\_price\_rate\_for\_item, <item\_id>, <value\_percentage>),
Sets individual price rate for a single item type. Normal price rate is 100. Deprecated, as Warband uses (game\_get\_item\_[buy/sell]\_price\_factor) scripts instead.
set\_price\_rate\_for\_item\_type = 1172

(set\_price\_rate\_for\_item\_type, <item\_type\_id>, <value\_percentage>),
Sets individual price rate for entire item class (see header\_items.py for itp\_type\_\* constants). Normal price rate is 100. Deprecated, as Warband uses (game\_get\_item\_[buy/sell]\_price\_factor) scripts instead.
set\_merchandise\_modifier\_quality = 1490

(set\_merchandise\_modifier\_quality, <value>),
Affects the probability of items with quality modifiers appearing in merchandise. Value is percentage, standard value is 100.
set\_merchandise\_max\_value = 1491

(set\_merchandise\_max\_value, <value>),
Not used in Native. Apparently prevents items with price higher than listed from being generated as merchandise.
reset\_item\_probabilities = 1492

(reset\_item\_probabilities, <value>),
Sets all items probability of being generated as merchandise to the provided value. Use zero with subsequent calls to (set\_item\_probability\_in\_merchandise) to only allow generation of certain items.
set\_item\_probability\_in\_merchandise = 1493

(set\_item\_probability\_in\_merchandise, <item\_id>, <value>),
Sets item probability of being generated as merchandise to the provided value.
troop\_add\_merchandise = 1512

(troop\_add\_merchandise, <troop\_id>, <item\_type\_id>, <value>),
Adds a specified number of random items of certain type (see itp\_type\_\* constants in header\_items.py) to troop inventory. Only adds items with itp\_merchandise flags.
troop\_add\_merchandise\_with\_faction = 1513

(troop\_add\_merchandise\_with\_faction, <troop\_id>, <faction\_id>, <item\_type\_id>, <value>),:faction\_id is given to check if troop is eligible to produce that item
Same as (troop\_add\_merchandise), but with additional filter: only adds items which belong to specified faction, or without any factions at all.
### Miscellaneous troop information

troop\_set\_name = 1501

(troop\_set\_name, <troop\_id>, <string\_no>),
Renames the troop, setting a new singular name for it.
troop\_set\_plural\_name = 1502

(troop\_set\_plural\_name, <troop\_id>, <string\_no>),
Renames the troop, setting a new plural name for it.
troop\_set\_face\_key\_from\_current\_profile = 1503

(troop\_set\_face\_key\_from\_current\_profile, <troop\_id>),
Forces the troop to adopt the face from player's currently selected multiplayer profile.
troop\_add\_gold = 1528

(troop\_add\_gold, <troop\_id>, <value>),
Adds gold to troop. Generally used with player or hero troops.
troop\_remove\_gold = 1529

(troop\_remove\_gold, <troop\_id>, <value>),
Removes gold from troop. Generally used with player or hero troops.
store\_troop\_gold = 2149

(store\_troop\_gold, <destination>, <troop\_id>),
Retrieves total number of gold that the troop has.
troop\_set\_faction = 1550

(troop\_set\_faction, <troop\_id>, <faction\_id>),
Sets a new faction for the troop (mostly used to switch lords allegiances in Native).
store\_troop\_faction = 2173

(store\_troop\_faction, <destination>, <troop\_id>),
Retrieves current troop faction allegiance.
store\_faction\_of\_troop = 2173

(store\_faction\_of\_troop, <destination>, <troop\_id>),
Alternative spelling of the above operation.
troop\_set\_age = 1555

(troop\_set\_age, <troop\_id>, <age\_slider\_pos>),
Defines a new age for the troop (will be used by the game engine to generate appropriately aged face). Age is in range 0.100. {slot\_troop\_age} and {slot\_troop\_age\_appearance} will not be set.
store\_troop\_value = 2231

(store\_troop\_value, <destination>, <troop\_id>),
Stores some value which is apparently related to troop's overall fighting value. Swadian infantry line troops from Native produced values 24, 47, 80, 133, 188. Calling on player produced 0.
### Troop face code handling

str\_store\_player\_face\_keys = 2747

(str\_store\_player\_face\_keys, <string\_no>, <player\_id>),
Version 1.161+. Stores player's face keys into string register.
player\_set\_face\_keys = 2748

(player\_set\_face\_keys, <player\_id>, <string\_no>),
Version 1.161+. Sets player's face keys from string.
str\_store\_troop\_face\_keys = 2750

(str\_store\_troop\_face\_keys, <string\_no>, <troop\_no>, [<alt>]),
Version 1.161+. Stores specified troop's face keys into string register. Use optional <alt> parameter to determine what facekey set to retrieve: 0 for first and 1 for second.
troop\_set\_face\_keys = 2751

(troop\_set\_face\_keys, <troop\_no>, <string\_no>, [<alt>]),
Version 1.161+. Sets troop face keys from string. Use optional <alt> parameter to determine what face keys to update: 0 for first and 1 for second.
face\_keys\_get\_hair = 2752

(face\_keys\_get\_hair, <destination>, <string\_no>),
Version 1.161+. Unpacks selected hair mesh from string containing troop/player face keys to <destination>.
face\_keys\_set\_hair = 2753

(face\_keys\_set\_hair, <string\_no>, <value>),
Version 1.161+. Updates face keys string with a new hair value. Hair meshes associated with skin (as defined in module\_skins) are numbered from 1. Use 0 for no hair.
face\_keys\_get\_beard = 2754

(face\_keys\_get\_beard, <destination>, <string\_no>),
Version 1.161+. Unpacks selected beard mesh from string containing troop/player face keys to <destination>.
face\_keys\_set\_beard = 2755

(face\_keys\_set\_beard, <string\_no>, <value>),
Version 1.161+. Updates face keys string with a new beard value. Beard meshes associated with skin (as defined in module\_skins) are numbered from 1. Use 0 for no beard.
face\_keys\_get\_face\_texture = 2756

(face\_keys\_get\_face\_texture, <destination>, <string\_no>),
Version 1.161+. Unpacks selected face texture from string containing troop/player face keys to <destination>.
face\_keys\_set\_face\_texture = 2757

(face\_keys\_set\_face\_texture, <string\_no>, <value>),
Version 1.161+. Updates face keys string with a new face texture value. Face textures associated with skin (as defined in module\_skins) are numbered from 0.
face\_keys\_get\_hair\_texture = 2758

(face\_keys\_get\_hair\_texture, <destination>, <string\_no>),
Version 1.161+. Unpacks selected hair texture from string containing troop/player face keys to <destination>. Apparently hair textures have no effect. 4 research.
face\_keys\_set\_hair\_texture = 2759

(face\_keys\_set\_hair\_texture, <string\_no>, <value>),
Version 1.161+. Updates face keys string with a new hair texture value. Doesn't seem to have an effect. 4research.
face\_keys\_get\_hair\_color = 2760

(face\_keys\_get\_hair\_color, <destination>, <string\_no>),
Version 1.161+. Unpacks hair color slider value from face keys string. Values are in the range of 0..63. Mapping to specific colors depends on the hair color range defined for currently selected skin / face\_texture combination.
face\_keys\_set\_hair\_color = 2761

(face\_keys\_set\_hair\_color, <string\_no>, <value>),
Version 1.161+. Updates face keys string with a new hair color slider value. Value should be in the 0..63 range.
face\_keys\_get\_age = 2762

(face\_keys\_get\_age, <destination>, <string\_no>),
Version 1.161+. Unpacks age slider value from face keys string. Values are in the range of 0..63.
face\_keys\_set\_age = 2763

(face\_keys\_set\_age, <string\_no>, <value>),
Version 1.161+. Updates face keys string with a new age slider value. Value should be in the 0..63 range.
face\_keys\_get\_skin\_color = 2764

(face\_keys\_get\_skin\_color, <destination>, <string\_no>),
Version 1.161+. Apparently doesn't work. Should retrieve skin color value from face keys string into <destination>.
face\_keys\_set\_skin\_color = 2765

(face\_keys\_set\_skin\_color, <string\_no>, <value>),
Version 1.161+. Apparently doesn't work. Should update face keys string with a new skin color value.
face\_keys\_get\_morph\_key = 2766

(face\_keys\_get\_morph\_key, <destination>, <string\_no>, <key\_no>),
Version 1.161+. Unpacks morph key value from face keys string. See morph key indices in module\_skins.py file. Note that only 8 out of 27 morph keys are actually accessible (from 'chin\_size' to 'cheeks'). Morph key values are in the 0..7 range.
face\_keys\_set\_morph\_key = 2767

(face\_keys\_set\_morph\_key, <string\_no>, <key\_no>, <value>),
Version 1.161+. Updates face keys string with a new morph key value. See morph key indices in module\_skins.py file. Note that only 8 out of 27 morph keys are actually accessible (from 'chin\_size' to 'cheeks'). Morph key values should be in the 0..7 range.
## Quests

Quests are just that: some tasks that characters in the game world want the player to do. It's interesting to note that in Warband quests can have three possible outcomes: success, failure and conclusion. Generally the last option is used to indicate some "intermediate" quest result, which is neither a full success, nor a total failure.

### Conditional operations

check\_quest\_active = 200

(check\_quest\_active, <quest\_id>),
Checks that the quest has been started but not yet cancelled or completed. Will not fail for concluded, failed or succeeded quests for as long as they have not yet been completed.
check\_quest\_finished = 201

(check\_quest\_finished, <quest\_id>),
Checks that the quest has been completed (result does not matter) and not taken again yet.
check\_quest\_succeeded = 202

(check\_quest\_succeeded, <quest\_id>),
Checks that the quest has succeeded and not taken again yet (check will be successful even after the quest is completed).
check\_quest\_failed = 203

(check\_quest\_failed, <quest\_id>),
Checks that the quest has failed and not taken again yet (check will be successful even after the quest is completed).
check\_quest\_concluded = 204

(check\_quest\_concluded, <quest\_id>),
Checks that the quest was concluded with any result and not taken again yet.
### Slot operations for quests

quest\_set\_slot = 506

(quest\_set\_slot, <quest\_id>, <slot\_no>, <value>),
quest\_get\_slot = 526

(quest\_get\_slot, <destination>, <quest\_id>, <slot\_no>),
quest\_slot\_eq = 546

(quest\_slot\_eq, <quest\_id>, <slot\_no>, <value>),
quest\_slot\_ge = 566

(quest\_slot\_ge, <quest\_id>, <slot\_no>, <value>),
### Quest management

start\_quest = 1280

(start\_quest, <quest\_id>, <giver\_troop\_id>),
Starts the quest and marks giver\_troop as the troop who gave it.
conclude\_quest = 1286

(conclude\_quest, <quest\_id>),
Sets quest status as concluded but keeps it in the list. Frequently used to indicate "uncertain" quest status, when it's neither fully successful nor a total failure.
succeed\_quest = 1282

(succeed\_quest, <quest\_id>),:also concludes the quest
Sets quest status as successful but keeps it in the list (player must visit quest giver to complete it before he can get another quest of the same type).
fail\_quest = 1283

(fail\_quest, <quest\_id>),:also concludes the quest
Sets quest status as failed but keeps it in the list (player must visit quest giver to complete it before he can get another quest of the same type).
complete\_quest = 1281

(complete\_quest, <quest\_id>),
Successfully completes specified quest, removing it from the list of active quests.
cancel\_quest = 1284

(cancel\_quest, <quest\_id>),
Cancels specified quest without completing it, removing it from the list of active quests.
setup\_quest\_text = 1290

(setup\_quest\_text, <quest\_id>),
Operation will refresh default quest description (as defined in module\_quests.py). This is important when quest description contains references to variables and registers which need to be initialized with their current values.
store\_partner\_quest = 2240

(store\_partner\_quest, <destination>),
During conversation, if there's a quest given by conversation partner, the operation will return it's id.
setup\_quest\_giver = 1291

(setup\_quest\_giver, <quest\_id>, <string\_id>),
Apparently deprecated, as quest giver troop is now defined as a parameter of (start\_quest).
store\_random\_quest\_in\_range = 2250

(store\_random\_quest\_in\_range, <destination>, <lower\_bound>, <upper\_bound>),
Apparently deprecated as the logic for picking a new quest has been moved to module\_scripts.
set\_quest\_progression = 1285

(set\_quest\_progression, <quest\_id>, <value>),
Deprecated and useless, operation has no game effects and it's impossible to retrieve quest progression status anyway.
store\_random\_troop\_to\_raise = 2251

(store\_random\_troop\_to\_raise, <destination>, <lower\_bound>, <upper\_bound>),
Apparently deprecated.
store\_random\_troop\_to\_capture = 2252

(store\_random\_troop\_to\_capture, <destination>, <lower\_bound>, <upper\_bound>),
Apparently deprecated.
store\_quest\_number = 2261

(store\_quest\_number, <destination>, <quest\_id>),
Apparently deprecated.
store\_quest\_item = 2262

(store\_quest\_item, <destination>, <item\_id>),
Apparently deprecated. Native now uses quest slots to keep track of this information.
store\_quest\_troop = 2263

(store\_quest\_troop, <destination>, <troop\_id>),
Apparently deprecated. Native now uses quest slots to keep track of this information.
## Items

The title is a bit deceitful here. Items, despite the name, are not actual game items. Rather these are the \*definitions\* for real game items, and you can frequently see them referenced as "item types". However you should not confuse this with so called itp\_type\_\* constants which define the major item classes existing in the game.

Consider this: a Smoked Fish (50/50) in your character's inventory is an item in the game world. It's item type is "itm\_smoked\_fish" and it's basic class is itp\_type\_food. So take care: operations in this section are dealing with "itm\_smoked\_fish", not with actual fish in your inventory. The latter is actually just an inventory slot from the Module System's point of view, and operations to work with it are in the troops section of the file.

### Conditional operations

item\_has\_property = 2723

(item\_has\_property, <item\_kind\_no>, <property>),
Version 1.161+. Check that the item has specified property flag set. See the list of itp\_\* flags in header\_items.py.
item\_has\_capability = 2724

(item\_has\_capability, <item\_kind\_no>, <capability>),
Version 1.161+. Checks that the item has specified capability flag set. See the list of itcf\_\* flags in header\_items.py
item\_has\_modifier = 2725

(item\_has\_modifier, <item\_kind\_no>, <item\_modifier\_no>),
Version 1.161+. Checks that the specified modifiers is valid for the item. See the list of imod\_\* values in header\_item\_modifiers.py.
item\_has\_faction = 2726

(item\_has\_faction, <item\_kind\_no>, <faction\_no>),
Version 1.161+. Checks that the item is available for specified faction. Note that an item with no factions set is available to all factions.
### Item slot operations

item\_set\_slot = 507

(item\_set\_slot, <item\_id>, <slot\_no>, <value>),
item\_get\_slot = 527

(item\_get\_slot, <destination>, <item\_id>, <slot\_no>),
item\_slot\_eq = 547

(item\_slot\_eq, <item\_id>, <slot\_no>, <value>),
item\_slot\_ge = 567

(item\_slot\_ge, <item\_id>, <slot\_no>, <value>),
### Generic item operations

item\_get\_type = 1570

(item\_get\_type, <destination>, <item\_id>),
Returns item class (see header\_items.py for itp\_type\_\* constants).
store\_item\_value = 2230

(store\_item\_value, <destination>, <item\_id>),
Stores item nominal price as listed in module\_items.py. Does not take item modifier or quantity (for food items) into account.
store\_random\_horse = 2257

(store\_random\_horse, <destination>),
Deprecated since early M&B days.
store\_random\_equipment = 2258

(store\_random\_equipment, <destination>),
Deprecated since early M&B days.
store\_random\_armor = 2259

(store\_random\_armor, <destination>),
Deprecated since early M&B days.
cur\_item\_add\_mesh = 1964

(cur\_item\_add\_mesh, <mesh\_name\_string>, [<lod\_begin>], [<lod\_end>], [<color>]),
Version 1.161+. Only call inside ti\_on\_init\_item trigger. Adds another mesh to item, allowing the creation of combined items. Parameter <mesh\_name\_string> should contain mesh name itself, NOT a mesh reference. LOD values are optional. If <lod\_end> is used, it will not be loaded.
cur\_item\_set\_material = 1978

(cur\_item\_set\_material, <string\_no>, <sub\_mesh\_no>, [<lod\_begin>], [<lod\_end>]),
Version 1.161+. Only call inside ti\_on\_init\_item trigger. Replaces material that will be used to render the item mesh. Works only for main meta-mesh, so not for scabbards, etc., and does not work for horses, gloves and boots. Use 0 for <sub\_mesh\_no> to replace material for base mesh. LOD values are optional. If <lod\_end> is used, it will not be loaded.
item\_get\_weight = 2700

(item\_get\_weight, <destination\_fixed\_point>, <item\_kind\_no>),
Version 1.161+. Retrieves item weight as a fixed point value.
item\_get\_value = 2701

(item\_get\_value, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieves item base price. Essentially a duplicate of (store\_item\_value).
item\_get\_difficulty = 2702

(item\_get\_difficulty, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieves item difficulty value.
item\_get\_head\_armor = 2703

(item\_get\_head\_armor, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieves item head armor value.
item\_get\_body\_armor = 2704

(item\_get\_body\_armor, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieves item body armor value.
item\_get\_leg\_armor = 2705

(item\_get\_leg\_armor, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieves item leg armor value.
item\_get\_hit\_points = 2706

(item\_get\_hit\_points, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieves item hit points amount.
item\_get\_weapon\_length = 2707

(item\_get\_weapon\_length, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieves item length (for weapons) or shield half-width (for shields). To get actual shield width, multiply this value by 2. Essentially, it is a distance from shield's "center" point to it's left, right and top edges (and bottom edge as well if shield height is not defined).
item\_get\_speed\_rating = 2708

(item\_get\_speed\_rating, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieves item speed rating.
item\_get\_missile\_speed = 2709

(item\_get\_missile\_speed, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieves item missile speed rating.
item\_get\_max\_ammo = 2710

(item\_get\_max\_ammo, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieves item max ammo amount. Ignores large bag modifier.
item\_get\_accuracy = 2711

(item\_get\_accuracy, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieves item accuracy value. Note that this operation will return 0 for an item with undefined accuracy, even though the item accuracy will actually default to 100.
item\_get\_shield\_height = 2712

(item\_get\_shield\_height, <destination\_fixed\_point>, <item\_kind\_no>),
Version 1.161+. Retrieves distance from shield "center" to it's bottom edge as a fixed point number. Use (set\_fixed\_point\_multiplier, 100), to retrieve the correct value with this operation. To get actual shield height, use shield\_height + weapon\_length if this operation returns a non-zero value, otherwise use 2 \* weapon\_length.
item\_get\_horse\_scale = 2713

(item\_get\_horse\_scale, <destination\_fixed\_point>, <item\_kind\_no>),
Version 1.161+. Retrieves horse scale value as fixed point number.
item\_get\_horse\_speed = 2714

(item\_get\_horse\_speed, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieves horse speed value.
item\_get\_horse\_maneuver = 2715

(item\_get\_horse\_maneuver, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieves horse maneuverability value.
item\_get\_food\_quality = 2716

(item\_get\_food\_quality, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieves food quality coefficient (as of Warband 1.165, this coefficient is actually set for many food items, but never used in the code as there was no way to retrieve this coeff before 1.161 patch).
item\_get\_abundance = 2717

(item\_get\_abundance, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieve item abundance value. Note that this operation will return 0 for an item with undefined abundance, even though the item abundance will actually default to 100.
item\_get\_thrust\_damage = 2718

(item\_get\_thrust\_damage, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieves thrust base damage value for item.
item\_get\_thrust\_damage\_type = 2719

(item\_get\_thrust\_damage\_type, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieves thrust damage type for item (see definitions for "cut", "pierce" and "blunt" in header\_items.py).
item\_get\_swing\_damage = 2720

(item\_get\_swing\_damage, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieves swing base damage value for item.
item\_get\_swing\_damage\_type = 2721

(item\_get\_swing\_damage\_type, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieves swing damage type for item (see definitions for "cut", "pierce" and "blunt" in header\_items.py).
item\_get\_horse\_charge\_damage = 2722

(item\_get\_horse\_charge\_damage, <destination>, <item\_kind\_no>),
Version 1.161+. Retrieves horse charge base damage.
## Sounds and music tracks

There are two types of sound in the game: sounds and tracks. Sounds are just short sound effects. They can be positional (i.e. emitted by some object on the scene or by player's opponent during the dialog). They can be generic sound effects, like playing some drums when player meets mountain bandits.

Tracks are the background music. The game works as a kind of a musuc box, cycling the available melodies according to the situation. It is up to the Module System developer, however, to tell the game what the situation is. There are two factors which you can tell the game: situation and culture. So you can tell the game that the situation is "ambush" and the culture is "khergits", and the game will select the musuc tracks which fit this combination of situation and culture and will rotate them randomly. And of course, you can also tell the game to play one specific track if you want.

play\_sound\_at\_position = 599

(play\_sound\_at\_position, <sound\_id>, <position>, [options]),
Plays a sound in specified scene position. See sf\_\* flags in header\_sounds.py for reference on possible options.
play\_sound = 600

(play\_sound, <sound\_id>, [options]),
Plays a sound. If the operation is called from agent, scene\_prop or item trigger, then the sound will be positional and 3D. See sf\_\* flags in header\_sounds.py for reference on possible options.
play\_track = 601

(play\_track, <track\_id>, [options]),
Plays specified music track. Possible options: 0 = finish current then play this, 1 = fade out current and start this, 2 = stop current abruptly and start this
play\_cue\_track = 602

(play\_cue\_track, <track\_id>),
Plays specified music track OVER any currently played music track (so you can get two music tracks playing simultaneously). Hardly useful.
music\_set\_situation = 603

(music\_set\_situation, <situation\_type>),
Sets current situation(s) in the game (see mtf\_\* flags in header\_music.py for reference) so the game engine can pick matching tracks from module\_music.py. Use 0 to stop any currently playing music (it will resume when situation is later set to something).
music\_set\_culture = 604

(music\_set\_culture, <culture\_type>),
Sets current culture(s) in the game (see mtf\_\* flags in header\_music.py for reference) so the game engine can pick matching tracks from module\_music.py. Use 0 to stop any currently playing music (it will resume when cultures are later set to something).
stop\_all\_sounds = 609

(stop\_all\_sounds, [options]),
Stops all playing sounds. Version 1.153 options: 0 = stop only looping sounds, 1 = stop all sounds. Version 1.143 options: 0 = let current track finish, 1 = fade it out, 2 = stop it abruptly.
store\_last\_sound\_channel = 615

(store\_last\_sound\_channel, <destination>),
Version 1.153+. UNTESTED. Stores the sound channel used for the last sound operation.
Can fail. Return -1 as value. For agent\_play\_sound; play\_sound - if called from item, scene\_prop trigger. (For research)
Sounds with <sf\_stream\_from\_hd> flag will not occupy channel, i.e. operand return -1.
stop\_sound\_channel = 616

(stop\_sound\_channel, <sound\_channel\_no>),
Version 1.153+. Stops sound playing on specified sound channel. Used to fix bug with looping sounds in Viking Conquest.
There are 256 sound channels. The closest agent has 0 channel. The farthest agents will rewrite last 10 channels.
## Positions

Positions are the 3D math of the game. If you want to handle objects in space, you will inevitably have to deal with positions. Note that while most position-handling operations work both on global map and on the scenes, there are operations which will only work in one or another mode.

Each position consists of three parts: coordinates, rotation and scale.

Coordinates are three numbers - (X,Y,Z) - which define a certain point in space relative to the base of coordinates. Most of the time, the base of coordinates is either the center of the global map, or the center of the scene, but there may be exceptions. Note that all operations with coordinates nearly always use fixed point numbers.

Position rotation determines just that - rotation around corresponding world axis. So rotation around Z axis means rotation around vertical axis, in other words - turning right and left. Rotation around X and Y axis will tilt the position forward/backwards and right/left respectively.

It is common game convention that X world axis points to the East, Y world axis points to the North and Z world axis points straight up. However this is so-called global coordinates system, and more often than not you'll be dealing with local coordinates. Local coordinates are the coordinate system defined by the object's current position. For the object, his X axis is to the right, Y axis is forward, and Z axis is up. This is simple enough, but consider what happens if that object is turned upside down in world space? Object's Z axis will point upwards \*from the object's point of view\*, in other words, in global space it will be pointing \*downwards\*. And if the object is moving, then it's local coordinates system is moving with it... you get the idea.

Imagine the position as a small point with an arrow somewhere in space. Position's coordinates are the point's position. Arrow points horizontally to the North by default, and position's rotation determines how much was it turned in the each of three directions.

Final element of position is scale. It is of no direct relevance to the position itself, and it does not participate in any calculations. However it is important when you retrieve or set positions of objects. In this case, position's scale is object's scale - so you can shrink that wall or quite the opposite, make it grow to the sky, depending on your whim.

Designate axis like this: Pitch (Y), Yaw (Z), Roll (X).

Position (0, 0) - is left bottom corner of screen or map. X-axis points to the right, and Y-axis points to the top.

Generally angles are counted clockwise.

### Generic position operations

init\_position = 701

(init\_position, <position>),
Sets position coordinates to [0,0,0], without any rotation and default scale.
Not initialized position has this values: (-1000,-1000,0, 0,0,0) fpm=1 (x,y,z, x-rot,y-rot,z-rot)
copy\_position = 700

(copy\_position, <position\_target>, <position\_source>),
Makes a duplicate of position\_source.
position\_copy\_origin = 719

(position\_copy\_origin, <position\_target>, <position\_source>),
Copies coordinates from source position to target position, without changing rotation or scale.
position\_copy\_rotation = 718

(position\_copy\_rotation, <position\_target>, <position\_source>),
Copies rotation from source position to target position, without changing coordinates or scale.
position\_transform\_position\_to\_parent = 716

(position\_transform\_position\_to\_parent, <position\_dest>, <position\_anchor>, <position\_relative\_to\_anchor>),
Converts position from local coordinate space to parent coordinate space. In other words, if you have some position on the scene (anchor) and a position describing some place \*relative\* to anchor (for example [10,20,0] means "20 meters forward and 10 meters to the right"), after calling this operation you will get that position coordinates on the scene in <position\_dest>. Rotation and scale is also taken care of, so you can use relative angles.
position\_transform\_position\_to\_local = 717

(position\_transform\_position\_to\_local, <position\_dest>, <position\_anchor>, <position\_source>),
The opposite to (position\_transform\_position\_to\_parent), this operation allows you to get source's \*relative\* position to your anchor. Suppose you want to run some decision making for your bot agent depending on player's position. In order to know where player is located relative to your bot you call (position\_transform\_position\_to\_local, <position\_dest>, <bot\_position>, <player\_position>). Then we check position\_dest's Y coordinate - if it's negative, then the player is behind our bot's back.
### Position (X,Y,Z) coordinates

position\_get\_x = 726

`(position_get_x, <destination_fixed_point>, <position>),`
Return position X coordinate (to the east, or to the right). Base unit is meters. Use (set\_fixed\_point\_multiplier) to set another measurement unit (100 will get you centimeters, 1000 will get you millimeters, etc).
position\_get\_y = 727

`(position_get_y, <destination_fixed_point>, <position>),`
Return position Y coordinate (to the north, or forward). Base unit is meters. Use (set\_fixed\_point\_multiplier) to set another measurement unit (100 will get you centimeters, 1000 will get you millimeters, etc).
position\_get\_z = 728

`(position_get_z, <destination_fixed_point>, <position>),`
Return position Z coordinate (to the top). Base unit is meters. Use (set\_fixed\_point\_multiplier) to set another measurement unit (100 will get you centimeters, 1000 will get you millimeters, etc).
position\_set\_x = 729

`(position_set_x, <position>, <value_fixed_point>),`
Set position X coordinate.
position\_set\_y = 730

`(position_set_y, <position>, <value_fixed_point>),`
Set position Y coordinate.
position\_set\_z = 731

`(position_set_z, <position>, <value_fixed_point>),`
Set position Z coordinate.
position\_move\_x = 720

`(position_move_x, <position>, <movement>, [value]),`
Moves position along X axis. Movement distance is in cms. Optional parameter determines whether the position is moved along the local (value=0) or global (value=1) X axis (i.e. whether the position will be moved to it's right/left, or to the global east/west).
position\_move\_y = 721

`(position_move_y, <position>, <movement>,[value]),`
Moves position along Y axis. Movement distance is in cms. Optional parameter determines whether the position is moved along the local (value=0) or global (value=1) Y axis (i.e. whether the position will be moved forward/backwards, or to the global north/south).
position\_move\_z = 722

`(position_move_z, <position>, <movement>,[value]),`
Moves position along Z axis. Movement distance is in cms. Optional parameter determines whether the position is moved along the local (value=0) or global (value=1) Z axis (i.e. whether the position will be moved to it's above/below, or to the global above/below - these directions will be different if the position is tilted).
position\_set\_z\_to\_ground\_level = 791

`(position_set_z_to_ground_level, <position>),`
This will bring the position Z coordinate so it rests on the nearest ground level (i.e. an agent could stand on that position). This takes scene props with their collision meshes into account. Only works during a mission, so you can't measure global map height using this.
position\_get\_distance\_to\_terrain = 792

`(position_get_distance_to_terrain, <distance_fixed_point>, <position>),`
This will measure the distance between position and terrain below, ignoring all scene props and their collision meshes. Retrieves a negative value if underground. Operation only works on the scenes and cannot be used on the global map.
position\_get\_distance\_to\_ground\_level = 793

`(position_get_distance_to_ground_level, <distance_fixed_point>, <position>),`
This will measure the distance between position and the ground level, taking scene props and their collision meshes into account. Operation only works on the scenes and cannot be used on the global map.
Values can be negative if ground level is up to 1 meter aproximately.
### Position rotation

position\_get\_rotation\_around\_x = 742

(position\_get\_rotation\_around\_x, <destination>, <position>),
Returns angle (in degrees) that the position is rotated around X axis (tilt forward/backwards).
position\_get\_rotation\_around\_y = 743

(position\_get\_rotation\_around\_y, <destination>, <position>),
Returns angle (in degrees) that the position is rotated around Y axis (tilt right/left).
position\_get\_rotation\_around\_z = 740

(position\_get\_rotation\_around\_z, <destination>, <position>),
Returns angle (in degrees) that the position is rotated around Z axis (turning right/left).
position\_rotate\_x = 723

(position\_rotate\_x, <position>, <angle>),
Rotates position around it's X axis (tilt forward/backwards).
position\_rotate\_y = 724

(position\_rotate\_y, <position>, <angle>),
Rotates position around Y axis (tilt right/left).
position\_rotate\_z = 725

(position\_rotate\_z, <position>, <angle>, [use\_global\_z\_axis]),
Rotates position around Z axis (rotate right/left). Pass 1 for use\_global\_z\_axis to rotate the position around global axis instead.
position\_rotate\_x\_floating = 738

(position\_rotate\_x\_floating, <position>, <angle\_fixed\_point>),
Same as (position\_rotate\_x), but takes fixed point value as parameter, allowing for more precise rotation.
position\_rotate\_y\_floating = 739

(position\_rotate\_y\_floating, <position>, <angle\_fixed\_point>),
Same as (position\_rotate\_y), but takes fixed point value as parameter, allowing for more precise rotation.
position\_rotate\_z\_floating = 734

(position\_rotate\_z\_floating, <position\_no>, <angle\_fixed\_point>, [use\_global\_z\_axis]),
Version 1.161+. Same as (position\_rotate\_z), but takes fixed point value as parameter, allowing for more precise rotation.
Pass 1 for use\_global\_z\_axis to rotate the position around global axis instead.
### Position scale

position\_get\_scale\_x = 735

(position\_get\_scale\_x, <destination\_fixed\_point>, <position>),
Retrieves position scaling along X axis.
position\_get\_scale\_y = 736

(position\_get\_scale\_y, <destination\_fixed\_point>, <position>),
Retrieves position scaling along Y axis.
position\_get\_scale\_z = 737

(position\_get\_scale\_z, <destination\_fixed\_point>, <position>),
Retrieves position scaling along Z axis.
position\_set\_scale\_x = 744

(position\_set\_scale\_x, <position>, <value\_fixed\_point>),
Sets position scaling along X axis.
position\_set\_scale\_y = 745

(position\_set\_scale\_y, <position>, <value\_fixed\_point>),
Sets position scaling along Y axis.
position\_set\_scale\_z = 746

(position\_set\_scale\_z, <position>, <value\_fixed\_point>),
Sets position scaling along Z axis.
### Measurement of distances and angles

get\_angle\_between\_positions = 705

(get\_angle\_between\_positions, <destination\_fixed\_point>, <position\_no\_1>, <position\_no\_2>),
Calculates angle between positions, using positions as vectors. Only rotation around Z axis is used. In other words, the function returns the difference between Z rotations of both positions.
position\_has\_line\_of\_sight\_to\_position = 707

(position\_has\_line\_of\_sight\_to\_position, <position\_no\_1>, <position\_no\_2>),
Checks that you can see one position from another. This obviously implies that both positions must be in global space. Note this is computationally expensive, so try to keep number of these to a minimum.
get\_distance\_between\_positions = 710

(get\_distance\_between\_positions, <destination>, <position\_no\_1>, <position\_no\_2>),
Returns distance between positions in centimeters.
get\_distance\_between\_positions\_in\_meters = 711

(get\_distance\_between\_positions\_in\_meters, <destination>, <position\_no\_1>, <position\_no\_2>),
Returns distance between positions in meters.
get\_sq\_distance\_between\_positions = 712

(get\_sq\_distance\_between\_positions, <destination>, <position\_no\_1>, <position\_no\_2>),
Returns squared distance between two positions in centimeters.
get\_sq\_distance\_between\_positions\_in\_meters = 713

(get\_sq\_distance\_between\_positions\_in\_meters, <destination>, <position\_no\_1>, <position\_no\_2>),
Returns squared distance between two positions in meters.
position\_is\_behind\_position = 714

(position\_is\_behind\_position, <position\_base>, <position\_to\_check>),
Checks if the second position is behind the first.
get\_sq\_distance\_between\_position\_heights = 715

(get\_sq\_distance\_between\_position\_heights, <destination>, <position\_no\_1>, <position\_no\_2>),
Returns squared distance between position \*heights\* in centimeters.
position\_normalize\_origin = 741

(position\_normalize\_origin, <destination\_fixed\_point>, <position>),
What this operation seems to do is calculate the distance between the zero point [0,0,0] and the point with position's coordinates. <position> coordinates transforms so distance become 1 meter. Then x,y coordinates can be multiplied, for example, by 10 and new position will be 10 meters in that direction.
position\_get\_screen\_projection = 750

(position\_get\_screen\_projection, <position\_screen>, <position\_world>),
Calculates the screen coordinates of the position and stores it as position\_screen's X and Y coordinates. Works in missions. Not shure if it works on global map.
### Global map positions

map\_get\_random\_position\_around\_position = 1627

(map\_get\_random\_position\_around\_position, <dest\_position\_no>, <source\_position\_no>, <radius>),
Returns a random position on the global map in the vicinity of the source\_position.
map\_get\_land\_position\_around\_position = 1628

(map\_get\_land\_position\_around\_position, <dest\_position\_no>, <source\_position\_no>, <radius>),
Returns a random position on the global map in the vicinity of the source\_position. Will always return a land position (i.e. some place you can walk to).
map\_get\_water\_position\_around\_position = 1629

(map\_get\_water\_position\_around\_position, <dest\_position\_no>, <source\_position\_no>, <radius>),
Returns a random position on the global map in the vicinity of the source\_position. Will always return a water position (i.e. sea, lake or river).
## Game notes

The game provides the player with the Notes screen, where there are several sections: Troops, Factions, Parties, Quests and Information. This is the player's "diary", where all information player knows is supposed to be stored. With the operations from this section, modder can control what objects the player will be able to see in their corresponding sections of the Notes screen, and what information will be displayed on each object.

Note that there's a number of engine-called scripts which take priority to text notes created by these operations. Any information in these notes will only be visible to the player if those scripts "refuse" to generate the note page dynamically. The following scripts can override these notes:

```
script_game_get_troop_note
script_game_get_center_note
script_game_get_faction_note
script_game_get_quest_note
script_game_get_info_page_note

```

troop\_set\_note\_available = 1095

(troop\_set\_note\_available, <troop\_id>, <value>),
Enables (value = 1) or disables (value = 0) troop's page in the Notes / Characters section.
add\_troop\_note\_tableau\_mesh = 1108

(add\_troop\_note\_tableau\_mesh, <troop\_id>, <tableau\_material\_id>),
Adds graphical elements to the troop's information page (usually banner and portrait).
add\_troop\_note\_from\_dialog = 1114

(add\_troop\_note\_from\_dialog, <troop\_id>, <note\_slot\_no>, <expires\_with\_time>),
Adds current dialog text to troop notes. Each troop has 16 note slots. Last parameter is used to mark the note as time-dependent, if it's value is 1, then the note will be marked ("Report is current") and will be updated appropriately as the game progresses ("Report is X days old").
Official: (add\_troop\_note\_from\_dialog,<troop\_id>,<note\_slot\_no>, <value>),:There are maximum of 8 slots. value = 1 -> shows when the note is added
add\_troop\_note\_from\_sreg = 1117

(add\_troop\_note\_from\_sreg, <troop\_id>, <note\_slot\_no>, <string\_id>, <expires\_with\_time>),
Adds any text stored in string register to troop notes. Each troop has 16 note slots. Last parameter is used to mark the note as time-dependent, if it's value is 1, then the note will be marked ("Report is current") and will be updated appropriately as the game progresses ("Report is X days old").
Official: (add\_troop\_note\_from\_sreg,<troop\_id>,<note\_slot\_no>,<string\_id>, <value>),:There are maximum of 8 slots value = 1 -> shows when the note is added
faction\_set\_note\_available = 1096

(faction\_set\_note\_available, <faction\_id>, <value>),:1 = available, 0 = not available
Enables (value = 1) or disables (value = 0) faction's page in the Notes / Characters section.
add\_faction\_note\_tableau\_mesh = 1109

(add\_faction\_note\_tableau\_mesh, <faction\_id>, <tableau\_material\_id>),
Adds graphical elements to the faction's information page (usually graphical collage).
add\_faction\_note\_from\_dialog = 1115

(add\_faction\_note\_from\_dialog, <faction\_id>, <note\_slot\_no>, <expires\_with\_time>),
Adds current dialog text to faction notes. Each faction has 16 note slots. Last parameter is used to mark the note as time-dependent, if it's value is 1, then the note will be marked ("Report is current") and will be updated appropriately as the game progresses ("Report is X days old").
Official: (add\_faction\_note\_from\_dialog,<faction\_id>,<note\_slot\_no>, <value>),:There are maximum of 8 slots value = 1 -> shows when the note is added
add\_faction\_note\_from\_sreg = 1118

(add\_faction\_note\_from\_sreg, <faction\_id>, <note\_slot\_no>, <string\_id>, <expires\_with\_time>),
Adds any text stored in string register to faction notes. Each faction has 16 note slots. Last parameter is used to mark the note as time-dependent, if it's value is 1, then the note will be marked ("Report is current") and will be updated appropriately as the game progresses ("Report is X days old").
Official: (add\_faction\_note\_from\_sreg,<faction\_id>,<note\_slot\_no>,<string\_id>, <value>),:There are maximum of 8 slots value = 1 -> shows when the note is added
party\_set\_note\_available = 1097

(party\_set\_note\_available, <party\_id>, <value>),:1 = available, 0 = not available
Enables (value = 1) or disables (value = 0) party's page in the Notes / Characters section.
add\_party\_note\_tableau\_mesh = 1110

(add\_party\_note\_tableau\_mesh, <party\_id>, <tableau\_material\_id>),
Adds graphical elements to the party's information page (usually map icon).
add\_party\_note\_from\_dialog = 1116

(add\_party\_note\_from\_dialog, <party\_id>, <note\_slot\_no>, <expires\_with\_time>),
Adds current dialog text to party notes. Each party has 16 note slots. Last parameter is used to mark the note as time-dependent, if it's value is 1, then the note will be marked ("Report is current") and will be updated appropriately as the game progresses ("Report is X days old").
Official: (add\_party\_note\_from\_dialog,<party\_id>,<note\_slot\_no>, <value>),:There are maximum of 8 slots value = 1 -> shows when the note is added
add\_party\_note\_from\_sreg = 1119

(add\_party\_note\_from\_sreg, <party\_id>, <note\_slot\_no>, <string\_id>, <expires\_with\_time>),
Adds any text stored in string register to party notes. Each party has 16 note slots. Last parameter is used to mark the note as time-dependent, if it's value is 1, then the note will be marked ("Report is current") and will be updated appropriately as the game progresses ("Report is X days old").
Official: (add\_party\_note\_from\_sreg,<party\_id>,<note\_slot\_no>,<string\_id>, <value>),:There are maximum of 8 slots value = 1 -> shows when the note is added
quest\_set\_note\_available = 1098

(quest\_set\_note\_available, <quest\_id>, <value>),:1 = available, 0 = not available
Enables (value = 1) or disables (value = 0) quest's page in the Notes / Characters section.
add\_quest\_note\_tableau\_mesh = 1111

(add\_quest\_note\_tableau\_mesh, <quest\_id>, <tableau\_material\_id>),
Adds graphical elements to the quest's information page (not used in Native).
add\_quest\_note\_from\_dialog = 1112

(add\_quest\_note\_from\_dialog, <quest\_id>, <note\_slot\_no>, <expires\_with\_time>),
Adds current dialog text to quest notes. Each quest has 16 note slots. Last parameter is used to mark the note as time-dependent, if it's value is 1, then the note will be marked ("Report is current") and will be updated appropriately as the game progresses ("Report is X days old").
Official: (add\_quest\_note\_from\_dialog,<quest\_id>,<note\_slot\_no>, <value>),:There are maximum of 8 slots value = 1 -> shows when the note is added
add\_quest\_note\_from\_sreg = 1113

(add\_quest\_note\_from\_sreg, <quest\_id>, <note\_slot\_no>, <string\_id>, <expires\_with\_time>),
Adds any text stored in string register to quest notes. Each quest has 16 note slots. Last parameter is used to mark the note as time-dependent, if it's value is 1, then the note will be marked ("Report is current") and will be updated appropriately as the game progresses ("Report is X days old").
Official: (add\_quest\_note\_from\_sreg,<quest\_id>,<note\_slot\_no>,<string\_id>, <value>),:There are maximum of 8 slots value = 1 -> shows when the note is added
add\_info\_page\_note\_tableau\_mesh = 1090

(add\_info\_page\_note\_tableau\_mesh, <info\_page\_id>, <tableau\_material\_id>),
Adds graphical elements to the info page (not used in Native).
add\_info\_page\_note\_from\_dialog = 1091

(add\_info\_page\_note\_from\_dialog, <info\_page\_id>, <note\_slot\_no>, <expires\_with\_time>),
Adds current dialog text to info page notes. Each info page has 16 note slots. Last parameter is used to mark the note as time-dependent, if it's value is 1, then the note will be marked ("Report is current") and will be updated appropriately as the game progresses ("Report is X days old").
Official: (add\_info\_page\_note\_from\_dialog,<info\_page\_id>,<note\_slot\_no>, <value>),:There are maximum of 8 slots value = 1 -> shows when the note is added
add\_info\_page\_note\_from\_sreg = 1092

(add\_info\_page\_note\_from\_sreg, <info\_page\_id>, <note\_slot\_no>, <string\_id>, <expires\_with\_time>),
Adds any text stored in string register to info page notes. Each info page has 16 note slots. Last parameter is used to mark the note as time-dependent, if it's value is 1, then the note will be marked ("Report is current") and will be updated appropriately as the game progresses ("Report is X days old").
Official: (add\_info\_page\_note\_from\_sreg,<info\_page\_id>,<note\_slot\_no>,<string\_id>, <value>),:There are maximum of 8 slots value = 1 -> shows when the note is added
## Tableaus and heraldics

Tableaus are the tool that gives you limited access to the game graphical renderer. If you know 3D graphics, you know that all 3D objects consist of a mesh (which defines it's form) and the material (which defines how this mesh is "painted"). With tableau functions you can do two things. First, you can replace or alter the materials used to render the game objects (with many restrictions). If this sounds esoteric to you, have a look at the game heraldry - it is implemented using tableaus. Second, you can render images of various game objects and place them on the game menus, presentations and so on. For example, if you open the game Inventory window, you can see your character in his current equipment. This character is rendered using tableau operations. Similarly, if you open the Notes screen and select some kingdom lord on the Troops section, you will see that lord's face and banner. Both face and banner are drawn using tableaus.

cur\_item\_set\_tableau\_material = 1981

(cur\_item\_set\_tableu\_material, <tableau\_material\_id>, <instance\_code>),
Can only be used inside ti\_on\_init\_item trigger in module\_items.py. Assigns tableau to the item instance. Value of <instance\_code> will be passed to tableau code. Commonly used for heraldic armors and shields.
cur\_scene\_prop\_set\_tableau\_material = 1982

(cur\_scene\_prop\_set\_tableau\_material, <tableau\_material\_id>, <instance\_code>),
Can only be used inside ti\_on\_init\_scene\_prop trigger in module\_scene\_props.py. Assigns tableau to the scene prop instance. Value of <instance\_code> will be passed to tableau code. Commonly used for static banners.
cur\_map\_icon\_set\_tableau\_material = 1983

(cur\_map\_icon\_set\_tableau\_material, <tableau\_material\_id>, <instance\_code>),
Can only be used inside ti\_on\_init\_map\_icon trigger in module\_map\_icons.py. Assigns tableau to the icon prop instance. Value of <instance\_code> will be passed to tableau code. Commonly used for player/lord party banners.
cur\_agent\_set\_banner\_tableau\_material = 1986

(cur\_agent\_set\_banner\_tableau\_material, <tableau\_material\_id>),
Can only be used inside ti\_on\_agent\_spawn trigger in module\_mission\_templates. Assigns heraldry .
### Operations used in module\_tableau\_materials.py module

cur\_tableau\_add\_tableau\_mesh = 1980

(cur\_tableau\_add\_tableau\_mesh, <tableau\_material\_id>, <value>, <position\_register\_no>),
Used in module\_tableau\_materials.py to add one tableau to another. Value parameter is passed to tableau\_material as is.
cur\_tableau\_render\_as\_alpha\_mask = 1984

(cur\_tableau\_render\_as\_alpha\_mask)
Tells the engine to treat the tableau as an alpha (transparency) mask.
cur\_tableau\_set\_background\_color = 1985

(cur\_tableau\_set\_background\_color, <value>),
Defines solid background color for the current tableau.
cur\_tableau\_set\_ambient\_light = 1987

(cur\_tableau\_set\_ambient\_light, <red\_fixed\_point>, <green\_fixed\_point>, <blue\_fixed\_point>),
Not documented. Used for tableaus rendered from 3D objects to provide uniform tinted lighting.
cur\_tableau\_set\_camera\_position = 1988

(cur\_tableau\_set\_camera\_position, <position>),
Not documented. Used for tableaus rendered from 3D objects to position camera as necessary (usually with a perspective camera).
cur\_tableau\_set\_camera\_parameters = 1989

(cur\_tableau\_set\_camera\_parameters, <is\_perspective>, <camera\_width\_times\_1000>, <camera\_height\_times\_1000>, <camera\_near\_times\_1000>, <camera\_far\_times\_1000>),
Not documented. Used to define camera parameters for tableau rendering. Perspective camera is generally used to render 3D objects for tableaus, while non-perspective camera is used to modify tableau texture meshes.
cur\_tableau\_add\_point\_light = 1990

(cur\_tableau\_add\_point\_light, <position>, <red\_fixed\_point>, <green\_fixed\_point>, <blue\_fixed\_point>),
Not documented. Typically used for tableaus rendered from 3D objects to add a point light source.
cur\_tableau\_add\_sun\_light = 1991

(cur\_tableau\_add\_sun\_light, <position>, <red\_fixed\_point>, <green\_fixed\_point>, <blue\_fixed\_point>),
Not documented. Typically used for tableaus rendered from 3D objects to add a directional light source. Note that position coordinates do not matter, only rotation (i.e. light rays direction) does.
cur\_tableau\_add\_mesh = 1992

(cur\_tableau\_add\_mesh, <mesh\_id>, <position>, <value\_fixed\_point>, <value\_fixed\_point>),
Adds a static mesh to the tableau with specified offset, scale and alpha. First value fixed point is the scale factor, second value fixed point is alpha. use 0 for default values.
cur\_tableau\_add\_mesh\_with\_vertex\_color = 1993

(cur\_tableau\_add\_mesh\_with\_vertex\_color, <mesh\_id>, <position>, <value\_fixed\_point>, <value\_fixed\_point>, <value>),
Adds a static mesh to the tableau with specified offset, scale, alpha and vertex color. First value fixed point is the scale factor, second value fixed point is alpha. Value is vertex color.
cur\_tableau\_add\_mesh\_with\_scale\_and\_vertex\_color = 2000

(cur\_tableau\_add\_mesh\_with\_scale\_and\_vertex\_color, <mesh\_id>, <position>, <scale\_position>, <value\_fixed\_point>, <value>),
Similar to (cur\_tableau\_add\_mesh\_with\_vertex\_color), but allows non-uniform scaling. Scale factors are stored as (x,y,z) position properties with fixed point values.
cur\_tableau\_add\_map\_icon = 1994

(cur\_tableau\_add\_map\_icon, <map\_icon\_id>, <position>, <value\_fixed\_point>),
Adds a rendered image of a map icon to current tableau. Last parameter is the scale factor for the model.
cur\_tableau\_add\_troop = 1995

(cur\_tableau\_add\_troop, <troop\_id>, <position>, <animation\_id>, <instance\_no>),
Adds a rendered image of the troop in a specified animation to current tableau. If instance\_no is 0 or less, then the face is not generated randomly (important for heroes).
cur\_tableau\_add\_horse = 1996

(cur\_tableau\_add\_horse, <item\_id>, <position>, <animation\_id>),
Adds a rendered image of a horse in a specified animation to current tableau.
cur\_tableau\_set\_override\_flags = 1997

(cur\_tableau\_set\_override\_flags, <value>),
When creating a troop image for current tableau, this operation allows to override troop's inventory partially or completely. See af\_\* flags in header\_mission\_templates.py for reference.
cur\_tableau\_clear\_override\_items = 1998

(cur\_tableau\_clear\_override\_items),
Removes and previously defined equipment overrides for the troop, allowing to start from scratch.
cur\_tableau\_add\_override\_item = 1999

(cur\_tableau\_add\_override\_item, <item\_kind\_id>),
When creating a troop image for current tableau, the operation will add a new item to troop's equipment.
## String operations

The game provides you only limited control over string information. Most operations will either retrieve some string (usually the name) from the game object, or set that object's name to a string.

Two important functions are str\_store\_string and str\_store\_string\_reg. They are different from all others because they not only assign the string to a string register, they \*process\* it. For example, if source string contains "{reg3}", then the resulting string will have the register name and it's surrounding brackets replaced with the value currently stored in that register. Other strings can be substituted as well, and even some limited logic can be implemented using this mechanism. You can try to read through the module\_strings.py file and try to deduce what each particular substitution does.

### Conditional operations

str\_is\_empty = 2318

(str\_is\_empty, <string\_register>),
Checks that referenced string register is empty.
### Other string operations

str\_clear = 2319

(str\_clear, <string\_register>),
Clears the contents of the referenced string register.
str\_store\_string = 2320

(str\_store\_string, <string\_register>, <string\_id>),
Stores a string value in the referenced string register. Only string constants and quick strings can be stored this way.
str\_store\_string\_reg = 2321

(str\_store\_string\_reg, <string\_register>, <string\_no>),
Copies the contents of one string register from another.
str\_store\_troop\_name = 2322

(str\_store\_troop\_name, <string\_register>, <troop\_id>),
Stores singular troop name in referenced string register.
str\_store\_troop\_name\_plural = 2323

(str\_store\_troop\_name\_plural, <string\_register>, <troop\_id>),
Stores plural troop name in referenced string register.
str\_store\_troop\_name\_by\_count = 2324

(str\_store\_troop\_name\_by\_count, <string\_register>, <troop\_id>, <number>),
Stores singular or plural troop name with number of troops ("29 Archers", "1 Bandit").
str\_store\_item\_name = 2325

(str\_store\_item\_name, <string\_register>, <item\_id>),
Stores singular item name in referenced string register.
str\_store\_item\_name\_plural = 2326

(str\_store\_item\_name\_plural, <string\_register>, <item\_id>),
Stores plural item name in referenced string register.
str\_store\_item\_name\_by\_count = 2327

(str\_store\_item\_name\_by\_count, <string\_register>, <item\_id>),
Stores singular or plural item name with number of items ("11 Swords", "1 Bottle of Wine").
str\_store\_party\_name = 2330

(str\_store\_party\_name, <string\_register>, <party\_id>),
Stores party name in referenced string register.
str\_store\_agent\_name = 2332

(str\_store\_agent\_name, <string\_register>, <agent\_id>),
Stores agent name in referenced string register.
str\_store\_faction\_name = 2335

(str\_store\_faction\_name, <string\_register>, <faction\_id>),
Stores faction name in referenced string register.
str\_store\_quest\_name = 2336

(str\_store\_quest\_name, <string\_register>, <quest\_id>),
Stores quest name (as defined in module\_quests.py) in referenced string register.
str\_store\_info\_page\_name = 2337

(str\_store\_info\_page\_name, <string\_register>, <info\_page\_id>),
Stores info page title (as defined in module\_info\_pages.py) in referenced string register.
str\_store\_date = 2340

(str\_store\_date, <string\_register>, <number\_of\_hours\_to\_add\_to\_the\_current\_date>),
Stores formatted date string, using the number of hours since start of the game (can be retrieved by a call to store\_current\_hours).
str\_store\_troop\_name\_link = 2341

(str\_store\_troop\_name\_link, <string\_register>, <troop\_id>),
Stores troop name as an internal game link. Resulting string can be used in game notes, will be highlighted, and clicking on it will redirect the player to the details page of the referenced troop.
str\_store\_party\_name\_link = 2342

(str\_store\_party\_name\_link, <string\_register>, <party\_id>),
Stores party name as an internal game link. Resulting string can be used in game notes, will be highlighted, and clicking on it will redirect the player to the details page of the referenced party.
str\_store\_faction\_name\_link = 2343

(str\_store\_faction\_name\_link, <string\_register>, <faction\_id>),
Stores faction name as an internal game link. Resulting string can be used in game notes, will be highlighted, and clicking on it will redirect the player to the details page of the referenced faction.
str\_store\_quest\_name\_link = 2344

(str\_store\_quest\_name\_link, <string\_register>, <quest\_id>),
Stores quest name as an internal game link. Resulting string can be used in game notes, will be highlighted, and clicking on it will redirect the player to the details page of the referenced quest.
str\_store\_info\_page\_name\_link = 2345

(str\_store\_info\_page\_name\_link, <string\_register>, <info\_page\_id>),
Stores info page title as an internal game link. Resulting string can be used in game notes, will be highlighted, and clicking on it will redirect the player to the details page of the referenced info page.
str\_store\_class\_name = 2346

(str\_store\_class\_name, <stribg\_register>, <class\_id>),
Stores name of the selected troop class (Infantry, Archers, Cavalry or any of the custom class names) in referenced string register.
game\_key\_get\_mapped\_key\_name = 65

(game\_key\_get\_mapped\_key\_name, <string\_register>, <game\_key>),
Version 1.161+. Stores human-readable key name that's currently assigned to the provided game key. May store "unknown" and "No key assigned" strings (the latter is defined in languages/en/ui.csv, the former seems to be hardcoded).
### Network/multiplayer-related string operations

str\_store\_player\_username = 2350

(str\_store\_player\_username, <string\_register>, <player\_id>),
Stores player's multiplayer username in referenced string register. Can be used in multiplayer mode only.
str\_store\_server\_password = 2351

(str\_store\_server\_password, <string\_register>),
Stores server's password in referenced string register.
str\_store\_server\_name = 2352

(str\_store\_server\_name, <string\_register>),
Stores server's name (as displayed to clients in server's list window) in referenced string register.
str\_store\_welcome\_message = 2353

(str\_store\_welcome\_message, <string\_register>),
Stores server's welcome message in referenced string register.
str\_encode\_url = 2355

(str\_encode\_url, <string\_register>),
This operation will "sanitize" a string to be used as part of network URL, replacing any non-standard characters with their '%'-codes.
## Output and messages

These operations will provide some textual information to the player during the game. There are three operations which will generate a game message (displayed as a chat-like series of text strings in the bottom-left part of the screen), while most others will be displaying various types of dialog boxes. You can also ask a question to player using these operations.

You can clear message list in right bottom corner by dislpaing an empty string. Also when spaming messages shut down display log it will be visible again.

`(display_message, "@{!}"),`

This will create a quick string. Another approach is to display an empty string register

`(str_clear, s0),
(display_message),`

(display\_message), without parameters displays the s0 string register. It should be initialisized, i.e. it is necessary to (str\_clear, s0), even at the begining of the game.

@ - creates quick string. The file quick\_strings.txt should be deleted before release. As variables.txt. When you add new quick\_string/variable it will be attached to the end of the txt file for save compatibility. And deleted quick\_string/variable will still be there.
{!} - don't create text for translation
{reg0?One of your prisoners, :} - If reg0=1 then add text "One of your prisoners, :"

display\_debug\_message = 1104

(display\_debug\_message, <string\_id>, [hex\_colour\_code]),
Displays a string message, but only in debug mode, using provided color (hex-coded 0xRRGGBB). The message is additionally written to rgl\_log.txt file in both release and debug modes when edit mode is enabled.
display\_log\_message = 1105

(display\_log\_message, <string\_id>, [hex\_colour\_code]),
Display a string message using provided color (hex-coded 0xRRGGBB). The message will also be written to game log (accessible through Notes / Game Log), and will persist between sessions (i.e. it will be stored as part of the savegame).
display\_message = 1106

(display\_message, <string\_id>,[hex\_colour\_code]),
Display a string message using provided color (hex-coded 0xRRGGBB).
When edit mode is enabled also write to rgl\_log.
set\_show\_messages = 1107

(set\_show\_messages, <value>),
Suppresses (value = 0) or enables (value = 1) game messages, including those generated by the game engine.
tutorial\_box = 1120

(tutorial\_box, <string\_id>, <string\_id>),
This operation is deprecated but is still used in Native.
dialog\_box = 1120

(dialog\_box, <text\_string\_id>, [title\_string\_id]),
Displays a popup window with the text message and an optional caption.
question\_box = 1121

(question\_box, <string\_id>, [<yes\_string\_id>], [<no\_string\_id>]),
Displays a popup window with the text of the question and two buttons (Yes and No by default, but can be overridden). When the player selects one of possible responses, a ti\_question\_answered trigger will be executed. Works inside a mission template and in the map window.
tutorial\_message = 1122

(tutorial\_message, <string\_id>, [color], [auto\_close\_time]),
Displays a popup window with tutorial text stored in referenced string or string register. Use -1 to close any currently open tutorial box. Optional parameters allow you to define text color and time period after which the tutorial box will close automatically. Works also at the world map.
tutorial\_message\_set\_position = 1123

(tutorial\_message\_set\_position, <position\_x>, <position\_y>),
Defines screen position for the tutorial box. Assumes screen size is 1000\*750.
tutorial\_message\_set\_size = 1124

(tutorial\_message\_set\_size, <size\_x>, <size\_y>),
Defines size of the tutorial box. Assumes screen size is 1000\*750.
tutorial\_message\_set\_center\_justify = 1125

(tutorial\_message\_set\_center\_justify, <val>),
Sets tutorial box to be center justified (value = 1), or use positioning dictated by tutorial\_message\_set\_position (value = 0).
tutorial\_message\_set\_background = 1126

(tutorial\_message\_set\_background, <value>),
Defines whether the tutorial box will have a background or not (1 or 0). Default is off.
## Game control: screens, menus, dialogs and encounters

An encounter is what happens when player's party meets another party on the world map. While most operations in the game can be performed outside of encounter, there's one thing you can only do when in encounter context - standard game battle. When you are initiating the battle from an encounter, the game engine will do most of the grunt work for you. You can order the engine to add some parties to the battle on this or that side, and the soldiers from those parties will spawn on the battlefield, in the numbers proportional to the party sizes, and the agents will maintain links with their parties. If agents earn experience, this will be reflected on the world map, and if some agents die, party sizes will be decreased. All this stuff can potentially be emulated by the Module System code, but it's tons of work and is still much less efficient than the tool the game engine already provides to you.

An important notice: when player encounters an AI party on the map, the game calls "game\_event\_party\_encounter" script in the module\_scripts.py. So if you want to implement some non-standard processing of game encounters, this is the place you should start from. Also note that the game implements the Camp menu as an encounter with a hardcoded party "p\_camp\_bandits".

Also you can find many operations in this section dealing with game screens, game menus and game dialogs. Keep in mind that some screens only make sense in certain contexts, and game menus are only available on the world map, you cannot use game menus during the mission.

### Conditional operations

entering\_town = 36

(entering\_town, <town\_id>),
Apparently deprecated.
encountered\_party\_is\_attacker = 39

(encountered\_party\_is\_attacker),
Checks that the party encountered on the world map was following player (i.e. either player was trying to run away or at the very least this is a head-on clash).
conversation\_screen\_is\_active = 42

(conversation\_screen\_is\_active),
Checks that the player is currently in dialogue with some agent. Can only be used in triggers of module\_mission\_templates.py file.
in\_meta\_mission = 44

(in\_meta\_mission),
Deprecated, do not use.
### Game hardcoded windows and related operations

change\_screen\_return = 2040

(change\_screen\_return),
Closes any current screen and returns the player to world map. In missions nothing happens.
change\_screen\_loot = 2041

(change\_screen\_loot, <troop\_id>),
Opens the Looting interface, using the provided troop as loot storage. Player has full access to troop inventory.
change\_screen\_trade = 2042

(change\_screen\_trade, [troop\_id]),
Opens the Trade screen, using the provided troop as the trading partner. When called from module\_dialogs, troop\_id is optional and defaults to current dialogue partner.
change\_screen\_exchange\_members = 2043

(change\_screen\_exchange\_members, [exchange\_leader], [party\_id]),
Opens the Exchange Members With Party interface, using the specified party\_id. If called during an encounter, party\_id is optional and defaults to the encountered party. Second parameter [0, 1] determines whether the party leader is exchangeable (useful when managing the castle garrison).
change\_screen\_trade\_prisoners = 2044

(change\_screen\_trade\_prisoners),
Opens the Sell Prisoners interface. Script "script\_game\_get\_prisoner\_price" will be used to determine prisoner price.
change\_screen\_buy\_mercenaries = 2045

(change\_screen\_buy\_mercenaries),
Opens the Buy Mercenaries interface, where player can hire troops from the party specified with (set\_mercenary\_source\_party) operation. Only works from the dialog.
change\_screen\_view\_character = 2046

(change\_screen\_view\_character),
Opens the character screen of another troop. Can only be used in dialogs.
change\_screen\_training = 2047

(change\_screen\_training),
Opens the character screen for the troop that player is currently talking to. Only works in dialogs. Deprecated, use (change\_screen\_view\_character) instead.
change\_screen\_mission = 2048

(change\_screen\_mission),
Starts the mission, using previously defined scene and mission template.
change\_screen\_map\_conversation = 2049

(change\_screen\_map\_conversation, <troop\_id>),
Starts the mission, same as (change\_screen\_mission). However once the mission starts, player will get into dialog with the specified troop, and once the dialog ends, the mission will automatically end.
change\_screen\_exchange\_with\_party = 2050

(change\_screen\_exchange\_with\_party, <party\_id>),
Effectively duplicates (change\_screen\_exchange\_members), but party\_id parameter is obligatory and the operation doesn't have an option to prevent party leader from being exchanged.
change\_screen\_equip\_other = 2051

(change\_screen\_equip\_other, [troop\_id]),
Opens the Equip Companion interface. When calling from a dialog, it is not necessary to specify troop\_id.
change\_screen\_map = 2052

(change\_screen\_map),
Changes the screen to global map, closing any currently running game menu, dialog or mission.
change\_screen\_notes = 2053

(change\_screen\_notes, <note\_type>, <object\_id>),
Opens the Notes screen, in the selected category (note\_type: 1=troops, 2=factions, 3=parties, 4=quests, 5=info\_pages) and for the specified object in that category.
change\_screen\_quit = 2055

(change\_screen\_quit),
Quits the game to the main menu.
change\_screen\_give\_members = 2056

(change\_screen\_give\_members, [party\_id]),
Opens the Give Troops to Another Party interface. Party\_id parameter is optional during an encounter and will use encountered party as default value.
change\_screen\_controls = 2057

(change\_screen\_controls),
Opens the standard Configure Controls screen, pausing the game.
change\_screen\_options = 2058

(change\_screen\_options),
Opens the standard Game Options screen, pausing the game.
set\_mercenary\_source\_party = 1320

(set\_mercenary\_source\_party, <party\_id>),
Defines the party from which the player will buy mercenaries with (change\_screen\_buy\_mercenaries).
start\_map\_conversation = 1025

(start\_map\_conversation,<troop\_id>),
Old syntax: (start\_map\_conversation, <troop\_id>, [troop\_dna]),
Starts a conversation with the selected troop. Can be called directly from global map or game menus. Troop DNA parameter allows you to randomize non-hero troop appearances.
### Game menus

set\_background\_mesh = 2031

(set\_background\_mesh, <mesh\_id>),
Sets the specified mesh as the background for the current menu. Possibly can be used for dialogs or presentations, but was not tested.
set\_game\_menu\_tableau\_mesh = 2032

(set\_game\_menu\_tableau\_mesh, <tableau\_material\_id>, <value>, <position\_register\_no>),
Adds a tableau to the current game menu screen. Position (X,Y) coordinates define mesh position, Z coordinate defines scaling. Parameter <value> will be passed as tableau\_material script parameter.
jump\_to\_menu = 2060

(jump\_to\_menu, <menu\_id>),
Opens the specified game menu. Note this only happens after the current block of code completes execution.
disable\_menu\_option = 2061

(disable\_menu\_option),
Never used in native. Apparently deprecated as menu options have prerequisite code blocks now.
### Game encounter handling operations

set\_party\_battle\_mode = 1020

(set\_party\_battle\_mode),
Used before or during the mission to start battle mode (and apparently make agents use appropriate AI).
finish\_party\_battle\_mode = 1019

(finish\_party\_battle\_mode),
Used during the mission to stop battle mode.
start\_encounter = 1300

(start\_encounter, <party\_id>),
Forces the player party to initiate encounter with the specified party. Distance does not matter in this situation.
leave\_encounter = 1301

(leave\_encounter),
Leaves encounter mode.
encounter\_attack = 1302

(encounter\_attack),
Apparently starts the standard battle with the encountered party. 4research.
select\_enemy = 1303

(select\_enemy, <value>),
When joining a battle, this determines what side player will be helping. Defending party is always 0, and attacking party is always 1. Player can support either attackers (value = 0, i.e. defenders are the enemy) or defenders (value = 1).
set\_passage\_menu = 1304

(set\_passage\_menu, <value>),
When setting up a mission, this allows you to determine what game menu will be used for that mission passages instead of "mnu\_town". Passage menu item number will determine what menu option (in sequential order, starting from 0) will be executed when the player activates that passage on the scene. Note that menu option condition code block will be ignored.
start\_mission\_conversation = 1920

(start\_mission\_conversation, <troop\_id>),
During the mission, initiates the dialog with specified troop.
set\_conversation\_speaker\_troop = 2197

(set\_conversation\_speaker\_troop, <troop\_id>),
Allows to dynamically switch speaking troops during the dialog when developer doesn't know in advance who will be doing the speaking. Should be placed in post-talk code section of dialog entry.
set\_conversation\_speaker\_agent = 2198

(set\_conversation\_speaker\_agent, <agent\_id>),
Allows to dynamically switch speaking agents during the dialog when developer doesn't know in advance who will be doing the speaking. Should be placed in post-talk code section of dialog entry.
store\_conversation\_agent = 2199

(store\_conversation\_agent, <destination>),
Stores identifier of agent who is currently speaking.
store\_conversation\_troop = 2200

(store\_conversation\_troop, <destination>),
Stores identifier of troop who is currently speaking.
store\_partner\_faction = 2201

(store\_partner\_faction, <destination>),
Stores faction of the troop player is speaking to.
store\_encountered\_party = 2202

(store\_encountered\_party, <destination>),
Stores identifier of the encountered party.
store\_encountered\_party2 = 2203

(store\_encountered\_party2, <destination>),
Stores the identifier of the second encountered party (when first party is in battle, this one will return it's battle opponent).
set\_encountered\_party = 2205

(set\_encountered\_party, <party\_no>),
Sets the specified party as encountered by player, but does not run the entire encounter routine. Used in Native during chargen to set up the starting town and then immediately throw the player into street fight without showing him the town menu.
end\_current\_battle = 1307

(end\_current\_battle),
Apparently ends the battle between player's party and it's opponent. Exact effects not clear. 4research.
Operations specific to dialogs
store\_repeat\_object = 50

(store\_repeat\_object, <destination>),
Used in the dialogs code in combination with repeat\_for\_\* dialog parameters, when creating dynamical player responses. Stores the value for the current iteration (i.e. a faction ID when repeat\_for\_factions is used, etc).
talk\_info\_show = 2020

(talk\_info\_show, <hide\_or\_show>),
Used in the dialogs code to display relations bar on opponent's portrait when mouse is hovering over it (value = 1) or disable this functionality (value = 0)
talk\_info\_set\_relation\_bar = 2021

(talk\_info\_set\_relation\_bar, <value>),
Sets the relations value for relationship bar in the dialog. Value should be in range -100..100. Enter an invalid value to hide the bar.
talk\_info\_set\_line = 2022

(talk\_info\_set\_line, <line\_no>, <string\_no>)
Sets the additional text information (usually troop name) to be displayed together with the relations bar.
## Scenes and missions

To put the player into a 3D scene, you need two things. First is the scene itself. All scenes are defined in module\_scenes.py file. The second element is no less important, and it's called mission template. Mission template will determine the context of the events on the scene - who will spawn where, who will be hostile or friendly to player or to each other, etc. Because of all this, when player is put on the 3D scene in the game, it is commonly said that player is "in a mission".

### Conditional operations

all\_enemies\_defeated = 1003

(all\_enemies\_defeated, [time-value]),
Checks if all agents from the enemy are defeated. When a time value x (in seconds) is given the operation only succeeds if the last status change (dead, alive, wounded...) happened more than (or exactly) x seconds ago.
race\_completed\_by\_player = 1004

(race\_completed\_by\_player),
Not documented. Not used in Native. Apparently deprecated.
num\_active\_teams\_le = 1005

(num\_active\_teams\_le, <value>),
Checks that the number of active teams (i.e. teams with at least one active agent) is less than or equal to given value.
main\_hero\_fallen = 1006

(main\_hero\_fallen),
Checks that the player has been knocked out.
scene\_allows\_mounted\_units = 1834

(scene\_allows\_mounted\_units),
Not documented. Used in multiplayer, but it's not clear where horses could be disallowed in the first place. 4research.
is\_zoom\_disabled = 2222

(is\_zoom\_disabled),
Version 1.153+. Checks that the zoom is currently disabled in the module.ini by setting the parameter disable\_zoom = 1.
mission\_tpl\_are\_all\_agents\_spawned = 1943

(mission\_tpl\_are\_all\_agents\_spawned),
Agents >300 may keep spawning after ti\_after\_mission\_start (fires .1 second too early). If there is no enough space to spawn for agent.
### Scene slot operations

scene\_set\_slot = 503

(scene\_set\_slot, <scene\_id>, <slot\_no>, <value>),
scene\_get\_slot = 523

(scene\_get\_slot, <destination>, <scene\_id>, <slot\_no>),
scene\_slot\_eq = 543

(scene\_slot\_eq, <scene\_id>, <slot\_no>, <value>),
scene\_slot\_ge = 563

(scene\_slot\_ge, <scene\_id>, <slot\_no>, <value>),
### Scene visitors handling operations

add\_troop\_to\_site = 1250

`(add_troop_to_site, <troop_id>, <scene_id>, <entry_no>),`
Set troop's position in the world to the specified scene and entry point. Entry point must have mtef\_scene\_source type. Agent will always appear at that entry when entering that scene. No longer used in Native.
remove\_troop\_from\_site = 1251

`(remove_troop_from_site, <troop_id>, <scene_id>),`
Removes the troop from the specified scene. No longer used in Native.
modify\_visitors\_at\_site = 1261

`(modify_visitors_at_site, <scene_id>),`
Declares the scene which visitors will be modified from that moment on. Can be called inside mission or at global map.
reset\_visitors = 1262

`(reset_visitors),`
If the scene defined in previous operand is not loaded yet all visitors will be removed.
set\_visitor = 1263

`(set_visitor, <mission_template_spawn_record>, <troop_id>, [<dna>]),`
Adds the specified troop as the visitor to the entry point of the scene defined with (modify\_visitors\_at\_site). Entry point must have mtef\_visitor\_source type. Optional DNA parameter allows for randomization of non-hero agent looks.
Default team for entry is 7. It can be overridden by <entry\_no> flags. 7 team is hardcoded neutral for everyone and couldn't be changed.
set\_visitors = 1264

`(set_visitors, <mission_template_spawn_record>, <troop_id>, <number_of_troops>),`
Same as (set\_visitors), but spawns an entire group of some troop type.
add\_visitors\_to\_current\_scene = 1265

`(add_visitors_to_current_scene, <mission_template_spawn_record>, <troop_id>, <number_of_troops>[, <team_no>, <group_no>]),`
Adds a number of troops to the specified entry point when the scene is already loaded. Optional <team\_no> and <group\_no> parameters are used in multiplayer mode only, singleplayer mode uses selected entry point settings.
Default team is 7 wich can be overridden by <entry\_no> flags. 7 team is hardcoded neutral for everyone and this couldn't be changed.
mission\_tpl\_entry\_set\_override\_flags = 1940

`(mission_tpl_entry_set_override_flags, <mission_template_id>, <entry_no>, <value>),`
Allows modder to use a different set of equipment override flags (see af\_\* constants in header\_mission\_templates.py) for the selected entry point.
mission\_tpl\_entry\_clear\_override\_items = 1941

`(mission_tpl_entry_clear_override_items, <mission_template_id>, <entry_no>),`
Clears the list of override equipment provided by the entry point definition in module\_mission\_templates.py.
mission\_tpl\_entry\_add\_override\_item = 1942

`(mission_tpl_entry_add_override_item, <mission_template_id>, <entry_no>, <item_kind_id>),`
Specified item will be added to any agent spawning on specified entry point.
### Mission/scene general operations

set\_mission\_result = 1906

`(set_mission_result, <value>),`
Apparently deprecated. Sets the result of the current mission (1 for victory, -1 for defeat).
finish\_mission = 1907

`(finish_mission, <delay_in_seconds>),`
Exits the scene after the specified delay.
set\_jump\_mission = 1911

`(set_jump_mission, <mission_template_id>),`
Tells the game to use the specified mission template for the next mission. Apparently should precede the call to (jump\_to\_scene).
jump\_to\_scene = 1910

Official: (jump\_to\_scene,<scene\_id>,<entry\_no>),
`(jump_to_scene, <scene_id>, [entry_no]),`
Tells the game to use the specified scene for the next mission. Usually followed by (change\_screen\_mission) call. Parameter entry\_no does not seem to have any effect.
set\_jump\_entry = 1912

`(set_jump_entry, <entry_no>),`
Defines what entry point the player will appear at when the mission starts.
store\_current\_scene = 2211

`(store_current_scene, <destination>),`
Retrieves the identifier of the current scene. Note that the operation will return the scene id even after the mission is completed and the player is already on global map.
close\_order\_menu = 1789

`(close_order_menu),`
Version 1.161+. If orders menu is currently open, it will be closed.
entry\_point\_get\_position = 1780

`(entry_point_get_position, <position>, <entry_no>),`
Retrieves the position of the entry point on the scene.
entry\_point\_set\_position = 1781

`(entry_point_set_position, <entry_no>, <position>),`
Moves the entry point to the specified position on the scene.
entry\_point\_is\_auto\_generated = 1782

`(entry_point_is_auto_generated, <entry_no>),`
Checks that the entry point is auto-generated (in other words, there was no such entry point placed in the scene file).
### Scene parameters handling

scene\_set\_day\_time = 1266

(scene\_set\_day\_time, <value>),
Defines the time for the scene to force the engine to select a different skybox than the one dictated by current game time. Must be called within ti\_before\_mission\_start trigger in module\_mission\_templates.py. Value should be in range 0..23.
set\_rain = 1797

(set\_rain, <rain-type>, <strength>),
Sets a new weather for the mission. Rain\_type values: 0 = clear, 1 = rain, 2 = snow. Strength is typically used in range 0..100 but is actually unlimited. Affects number of particles and fog density.
set\_fog\_distance = 1798

(set\_fog\_distance, <distance\_in\_meters>, [fog\_color]),
Sets the density (and optionally color) of the fog for the mission.
set\_skybox = 2389

(set\_skybox, <non\_hdr\_skybox\_index>, <hdr\_skybox\_index>),
Version 1.153+. Forces the scene to be rendered with specified skybox. Index of -1 will disable.
set\_startup\_sun\_light = 2390

(set\_startup\_sun\_light, <r>, <g>, <b>),
Version 1.153+. Defines the sunlight color for the scene.
set\_startup\_ambient\_light = 2391

(set\_startup\_ambient\_light, <r>, <g>, <b>),
1. Version 1.153+. Defines the ambient light level and colour for the scene. Expects Fixed Point values between 0 and 1.

set\_startup\_ground\_ambient\_light = 2392

(set\_startup\_ground\_ambient\_light, <r>, <g>, <b>),
Version 1.153+. Defines the ambient light color for the ground.
get\_startup\_sun\_light = 2394

(get\_startup\_sun\_light, <position\_no>),
Version 1.165+. Returns startup sunlight color in (x, y, z) coordinates of position register.
get\_startup\_ambient\_light = 2395

(get\_startup\_ambient\_light, <position\_no>),
Version 1.165+. Returns startup ambient light color in (x, y, z) coordinates of position register.
get\_startup\_ground\_ambient\_light = 2396

(get\_startup\_ground\_ambient\_light, <position\_no>),
Version 1.165+. Returns startup ambient ground lighting color in (x, y, z) coordinates of position register.
get\_battle\_advantage = 1690

(get\_battle\_advantage, <destination>),
Retrieves the calculated battle advantage.
set\_battle\_advantage = 1691

(set\_battle\_advantage, <value>),
Sets a new value for battle advantage.
get\_scene\_boundaries = 1799

(get\_scene\_boundaries, <position\_min>, <position\_max>),
Retrieves the coordinates of the bottom-left and top-right corner of the scene to the provided position registers.
mission\_enable\_talk = 1935

(mission\_enable\_talk),
Allows dialogue with agents on the scene.
mission\_disable\_talk = 1936

(mission\_disable\_talk),
Disables dialogue with agents on the scene.
mission\_get\_time\_speed = 2002

(mission\_get\_time\_speed, <destination\_fixed\_point>),
Retrieves current time speed factor for the mission.
mission\_set\_time\_speed = 2003

(mission\_set\_time\_speed, <value\_fixed\_point>),
Instantly changes the speed of time during the mission. Speed of time cannot be set to zero or below. Operation only works when cheat mode is enabled.
mission\_time\_speed\_move\_to\_value = 2004

(mission\_time\_speed\_move\_to\_value, <value\_fixed\_point>, <duration-in-1/1000-seconds>),
Changes the speed of time during the mission gradually, within the specified duration period. Speed of time cannot be set to zero or below. Operation only works when cheat mode is enabled.
mission\_set\_duel\_mode = 2006

(mission\_set\_duel\_mode, <value>),
Sets duel mode for the multiplayer mission. Values: 0 = off, 1 = on.
store\_zoom\_amount = 2220

(store\_zoom\_amount, <destination\_fixed\_point>),
Version 1.153+. Stores current zoom rate.
Works only if native shift zoom is disabled in module.ini parameter disable\_zoom = 1.
set\_zoom\_amount = 2221

(set\_zoom\_amount, <value\_fixed\_point>),
Version 1.153+. Sets new zoom rate.
Works only if native shift zoom is disabled in module.ini parameter disable\_zoom = 1.
### Mission timers

reset\_mission\_timer\_a = 2375

(reset\_mission\_timer\_a),
Resets the value of first mission timer and starts it from zero.
reset\_mission\_timer\_b = 2376

(reset\_mission\_timer\_b),
Resets the value of second mission timer and starts it from zero.
reset\_mission\_timer\_c = 2377

(reset\_mission\_timer\_c),
Resets the value of third mission timer and starts it from zero.
store\_mission\_timer\_a = 2370

(store\_mission\_timer\_a, <destination>),
Retrieves current value of first mission timer, in seconds.
store\_mission\_timer\_b = 2371

(store\_mission\_timer\_b, <destination>),
Retrieves current value of second mission timer, in seconds.
store\_mission\_timer\_c = 2372

(store\_mission\_timer\_c, <destination>),
Retrieves current value of third mission timer, in seconds.
store\_mission\_timer\_a\_msec = 2365

(store\_mission\_timer\_a\_msec, <destination>),
Retrieves current value of first mission timer, in milliseconds.
store\_mission\_timer\_b\_msec = 2366

(store\_mission\_timer\_b\_msec, <destination>),
Retrieves current value of second mission timer, in milliseconds.
store\_mission\_timer\_c\_msec = 2367

(store\_mission\_timer\_c\_msec, <destination>),
Retrieves current value of third mission timer, in milliseconds.
### Camera and rendering operations

is\_camera\_in\_first\_person = 61

(is\_camera\_in\_first\_person),
set\_camera\_in\_first\_person = 62

(set\_camera\_in\_first\_person, <value>),: 1 = first, 0 = third person
mission\_cam\_set\_mode = 2001

(mission\_cam\_set\_mode, <mission\_cam\_mode>, <duration-in-1/1000-seconds>, <value>),
Not documented. Changes main camera mode. Camera mode is 0 for automatic and 1 for manual (controlled by code). Duration parameter is used when switching from manual to auto, to determine how long will camera move to it's new position.
if value = 0, then camera velocity will be linear. else it will be non-linear
mission\_cam\_set\_screen\_color = 2008

(mission\_cam\_set\_screen\_color, <value>),
Not documented. Paints the screen with solid color. Parameter <value> contains color code with alpha component. Can be used to block screen entirely, add tint etc.
mission\_cam\_animate\_to\_screen\_color = 2009

(mission\_cam\_animate\_to\_screen\_color, <value>, <duration-in-1/1000-seconds>),
Not documented. Same as above, but color change is gradual. Used in Native to fill the screen with white before the end of marriage scene.
mission\_cam\_get\_position = 2010

(mission\_cam\_get\_position, <position\_register\_no>),
Retrieves the current position of camera during the mission (i.e. the point from which the player is observing the game).
mission\_cam\_set\_position = 2011

(mission\_cam\_set\_position, <position\_register\_no>),
Moves the camera to the specified position during the mission.
mission\_cam\_animate\_to\_position = 2012

(mission\_cam\_animate\_to\_position, <position\_register\_no>, <duration-in-1/1000-seconds>, <value>),
Moves the camera to the specified position smoothly. Second parameter determines how long it will take camera to move to destination, third parameter determines whether camera velocity will be linear (value = 0) or non-linear (value = 1).
mission\_cam\_get\_aperture = 2013

(mission\_cam\_get\_aperture, <destination>),
If player is holding shift for zooming aperture = 37, normal aperture = 75. When player dies with shift holding mission cam aperture don't return to normal
mission\_cam\_set\_aperture = 2014

(mission\_cam\_set\_aperture, <value>),
Set aperture for cam.
mission\_cam\_animate\_to\_aperture = 2015

(mission\_cam\_animate\_to\_aperture, <value>, <duration-in-1/1000-seconds>, <value>)
Not documented. if value = 0, then camera velocity will be linear. else it will be non-linear
mission\_cam\_animate\_to\_position\_and\_aperture = 2016

(mission\_cam\_animate\_to\_position\_and\_aperture, <position\_register\_no>, <value>, <duration-in-1/1000-seconds>, <value>),
Not documented. if value = 0, then camera velocity will be linear. else it will be non-linear
mission\_cam\_set\_target\_agent = 2017

(mission\_cam\_set\_target\_agent, <agent\_id>, <value>),
Not documented. if value = 0 then do not use agent's rotation, else use agent's rotation
mission\_cam\_clear\_target\_agent = 2018

(mission\_cam\_clear\_target\_agent),
Not documented.
mission\_cam\_set\_animation = 2019

(mission\_cam\_set\_animation, <anim\_id>),
Plays any bone animation from animations.py, taking the coordinates from the first bone in the hierarchy. The name and number of bones does not matter.
mouse\_get\_world\_projection = 751

(mouse\_get\_world\_projection, <position\_no\_1>, <position\_no\_2>),
Version 1.161+. Returns current camera coordinates (first position) and mouse projection to the back of the world (second position). Rotation data of resulting positions seems unreliable.
cast\_ray = 1900

(cast\_ray, <destination>, <hit\_position\_register>, <ray\_position\_register>, [<ray\_length\_fixed\_point>]),
Version 1.161+. Casts a ray starting from <ray\_position\_register> and stores the closest hit position into <hit\_position\_register>.
Only checks collisions with collision bodies, scene props with collision, and terrain. Fails if no collision is made. Collision with terrain and trees returns -1 as result.
Collision face's normals are stored in <hit\_position\_register> rotation with Y+ being the outward facing.
If the body hit is a scene prop, its instance id will be stored into <destination>, otherwise it will store -1 and fail code below.
Doesn't collide with agents. Longer rays are computationally more expensive.
set\_postfx = 2386

(set\_postfx, <postfx\_params-ID>),
Sets the respective postfx effect for the current scene. Count through your post\_fx-settings beginning from 0 to get the ID for the effect or put the line 'ID\_postfx\_params import \*' at the top to use directly the ID-name. Not used in Native. Can get called with all mission triggers, even when already in the scene. However, in latter case a delay can be noticed when the postfx switches. Appearantly a manually set postfx disappears if HDR gets toggled on/off in the graphic options.
set\_river\_shader\_to\_mud = 2387

`(set_river_shader_to_mud),`
Changes river material for muddy shader variant affecting visibility and color (drastically darker). Cannot be undone.
rebuild\_shadow\_map = 2393

(rebuild\_shadow\_map),
Version 1.153+. Rebuilds shadow map for the current scene to match props' new positions. When you move the prop and don't use this operation, its shadow will still fall on its old position.
set\_shader\_param\_int = 2400

(set\_shader\_param\_int, <parameter\_name>, <value>),:Sets the int shader parameter <parameter\_name> to <value>
Version 1.153+. UNTESTED. Allows direct manupulation of shader parameters. Operation scope is unknown, possibly global. Parameter is an int value.
set\_shader\_param\_float = 2401

(set\_shader\_param\_float, <parameter\_name>, <value\_fixed\_point>),
Version 1.153+. Sets the float shader parameter <parameter\_name> to <value>
Allows direct manupulation of shader parameters. Operation scope is unknown, possibly global.
set\_shader\_param\_float4 = 2402

(set\_shader\_param\_float4, <parameter\_name>, <valuex>, <valuey>, <valuez>, <valuew>),
Version 1.153+. Allows direct manupulation of shader parameters. Operation scope is unknown, possibly global. Parameter is a set of 4 float values.
set\_shader\_param\_float4x4 = 2403

(set\_shader\_param\_float4x4, <parameter\_name>, [0][0], [0][1], [0][2], [1][0], [1][1], [1][2], [2][0], [2][1], [2][2], [3][0], [3][1], [3][2]), Sets the float4x4 shader parameter <parameter\_name> to the given values .w components are 0001 by default
Version 1.153+. Allows direct manupulation of shader parameters. Operation scope is unknown, possibly global. Parameter is a set of 4x4 float values.
## Scene props, scene items, light sources and particle systems

On each scene in the game you can find scene props and scene items.

Scene props are the building bricks of the scene. Nearly every 3D object you will see on any scene in the game is a scene prop, with the exception of terrain and flora (on some scenes flora elements are actually scene props as well though).

Just like with troops and agents, it is important to differentiate between scene props and scene prop instances. You can have a dozen archer agents on the scene, and each of them will be an instance of the archer troop. Scene props are the same - there can be many castle wall sections on the scene, and these are instances of the same castle wall scene prop.

It is also possible to use game items as elements of the scene. These are the scene items, and they behave just like normal scene props. However all operations will affect either scene prop instances, or scene items, but not both.

Finally, there are spawned items. These are the "dropped" items which the player can pick up during the mission.

### Conditional operations

prop\_instance\_is\_valid = 1838

(prop\_instance\_is\_valid, <scene\_prop\_instance\_id>),
Checks that the reference to a scene prop instance is valid (i.e. it was not removed).
prop\_instance\_is\_animating = 1862

(prop\_instance\_is\_animating, <destination>, <scene\_prop\_id>),
Checks that the scene prop instance is currently animating.
prop\_instance\_intersects\_with\_prop\_instance = 1880

(prop\_instance\_intersects\_with\_prop\_instance, <checked\_scene\_prop\_id>, <scene\_prop\_id>),
Checks if two scene props are intersecting (i.e. collided). Useful when animating scene props movement. Pass -1 for second parameter to check the prop against all other props on the scene.
Official: cannot check polygon-to-polygon physics models, but can check any other combinations between sphere, capsule and polygon physics models.
scene\_prop\_has\_agent\_on\_it = 1801

(scene\_prop\_has\_agent\_on\_it, <scene\_prop\_instance\_id>, <agent\_id>),
Checks that the specified agent is above the scene prop instance. scene\_prop\_has\_agent\_over\_it would be a more appropriate name for the operation.
### Scene prop instance slot operations

scene\_prop\_set\_slot = 510

(scene\_prop\_set\_slot, <scene\_prop\_instance\_id>, <slot\_no>, <value>),
scene\_prop\_get\_slot = 530

(scene\_prop\_get\_slot, <destination>, <scene\_prop\_instance\_id>, <slot\_no>),
scene\_prop\_slot\_eq = 550

(scene\_prop\_slot\_eq, <scene\_prop\_instance\_id>, <slot\_no>, <value>),
scene\_prop\_slot\_ge = 570

(scene\_prop\_slot\_ge, <scene\_prop\_instance\_id>, <slot\_no>, <value>),
### Scene prop general operations

prop\_instance\_get\_scene\_prop\_kind = 1853

(prop\_instance\_get\_scene\_prop\_kind, <destination>, <scene\_prop\_id>),
Retrieves the scene prop for the specified prop instance.
scene\_prop\_get\_num\_instances = 1810

(scene\_prop\_get\_num\_instances, <destination>, <scene\_prop\_id>),
Retrieves the total number of instances of a specified scene prop on the current scene.
scene\_prop\_get\_instance = 1811

(scene\_prop\_get\_instance, <destination>, <scene\_prop\_id>, <instance\_no>),
Retrieves the reference to a scene prop instance by it's number.
scene\_prop\_enable\_after\_time = 1800

(scene\_prop\_enable\_after\_time, <scene\_prop\_id>, <time\_period>),
Prevents usable scene prop from being used for the specified time period in 1/100th of second. Commonly used to implement "cooldown" periods.
set\_spawn\_position = 1970

(set\_spawn\_position, <position>),
Defines the position which will later be used by (spawn\_scene\_prop), (spawn\_scene\_item), (spawn\_agent) and (spawn\_horse) operations.
spawn\_scene\_prop = 1974

(spawn\_scene\_prop, <scene\_prop\_id>),
Spawns a new scene prop instance of the specified type at the position defined by the last call to (set\_spawn\_position). Operation store the prop\_instance\_id of the spawned position in reg0.
prop\_instance\_get\_variation\_id = 1840

(prop\_instance\_get\_variation\_id, <destination>, <scene\_prop\_id>),
Retrieves the first variation ID number for the specified scene prop instance.
prop\_instance\_get\_variation\_id\_2 = 1841

(prop\_instance\_get\_variation\_id\_2, <destination>, <scene\_prop\_id>),
Retrieves the second variation ID number for the specified scene prop instance.
replace\_prop\_instance = 1889

(replace\_prop\_instance, <scene\_prop\_id>, <new\_scene\_prop\_id>),
Replaces a single scene prop instance with an instance of another scene prop (usually with the same dimensions, but not necessarily so). Can only be called in ti\_before\_mission\_start trigger in module\_mission\_templates.py.
replace\_scene\_props = 1890

(replace\_scene\_props, <old\_scene\_prop\_id>, <new\_scene\_prop\_id>),
Replaces all instances of specified scene prop type with another scene prop type. Commonly used to replace damaged walls with their intact versions during normal visits to castle scenes. Can only be called in ti\_before\_mission\_start trigger in module\_mission\_templates.py.
scene\_prop\_fade\_out = 1822

(scene\_prop\_fade\_out, <scene\_prop\_id>, <fade\_out\_time>, [meta\_mesh]),
Version 1.153+. Makes the scene prop instance disappear within specified time.
Leaving meta\_mesh blank will have the operation only affect the main mesh, setting it to -1 will affect all submeshes.
scene\_prop\_fade\_in = 1823

(scene\_prop\_fade\_in, <scene\_prop\_id>, <fade\_in\_time>),
Version 1.153+. Makes the scene prop instance reappear within specified time.
prop\_instance\_set\_material = 2617

(prop\_instance\_set\_material, <prop\_instance\_no>, <sub\_mesh\_no>, <string\_register>),
Version 1.161+. 4research. give sub mesh as -1 to change all meshes' materials.
### Scene prop manipulation

scene\_prop\_get\_visibility = 1812

(scene\_prop\_get\_visibility, <destination>, <scene\_prop\_id>),
Retrieves the current visibility state of the scene prop instance (1 = visible, 0 = invisible).
scene\_prop\_set\_visibility = 1813

(scene\_prop\_set\_visibility, <scene\_prop\_id>, <value>),
Shows (value = 1) or hides (value = 0) the scene prop instance. Collision remains on invisible props.
scene\_prop\_get\_hit\_points = 1815

(scene\_prop\_get\_hit\_points, <destination>, <scene\_prop\_id>),
Retrieves current number of hit points that the scene prop instance has.
scene\_prop\_get\_max\_hit\_points = 1816

(scene\_prop\_get\_max\_hit\_points, <destination>, <scene\_prop\_id>),
Retrieves the maximum number of hit points that the scene prop instance has (useful to calculate the percent of damage).
scene\_prop\_set\_hit\_points = 1814

(scene\_prop\_set\_hit\_points, <scene\_prop\_id>, <value>),
Sets the number of hit points that the scene prop has. Both current and max hit points are affected. Only makes sense for sokf\_destructible scene props.
scene\_prop\_set\_cur\_hit\_points = 1820

(scene\_prop\_set\_cur\_hit\_points, <scene\_prop\_id>, <value>),
Version 1.153+. Sets current HP amount for scene prop.
prop\_instance\_receive\_damage = 1877

(prop\_instance\_receive\_damage, <scene\_prop\_id>, <agent\_id>, <damage\_value>),
Makes scene prop instance receive specified amount of damage from any arbitrary agent. Agent reference is apparently necessary to properly initialize ti\_on\_scene\_prop\_hit trigger parameters.
prop\_instance\_refill\_hit\_points = 1870

(prop\_instance\_refill\_hit\_points, <scene\_prop\_id>),
Restores hit points of a scene prop instance to their maximum value.
scene\_prop\_get\_team = 1817

(scene\_prop\_get\_team, <value>, <scene\_prop\_id>),
Retrieves the team controlling the scene prop instance.
scene\_prop\_set\_team = 1818

(scene\_prop\_set\_team, <scene\_prop\_id>, <value>),
Assigns the scene prop instance to a certain team.
scene\_prop\_set\_prune\_time = 1819

(scene\_prop\_set\_prune\_time, <scene\_prop\_id>, <value>),
Not documented. Not used in Native. Taleworlds comment: Prune time can only be set to objects that are already on the prune queue. Static objects are not affected by this operation.
prop\_instance\_get\_position = 1850

(prop\_instance\_get\_position, <position>, <scene\_prop\_id>),
Retrieves the prop instance current position on the scene.
prop\_instance\_get\_starting\_position = 1851

(prop\_instance\_get\_starting\_position, <position>, <scene\_prop\_id>),
Retrieves the prop instance starting position on the scene (i.e. the place where it was positioned when initialized).
prop\_instance\_set\_position = 1855

(prop\_instance\_set\_position, <scene\_prop\_id>, <position>, [dont\_send\_to\_clients]),
Teleports prop instance to another position. Optional flag dont\_send\_to\_clients can be used on the server to prevent position change from being replicated to client machines (useful when doing some calculations which require to move the prop temporarily to another place).
prop\_instance\_animate\_to\_position = 1860

(prop\_instance\_animate\_to\_position, <scene\_prop\_id>, position, <duration-in-1/100-seconds>),
Moves prop instance to another position during the specified time frame (i.e. animates). Time is specified in 1/100th of second.
Prop is moving each frame after mission timer triggers.
If prop was animating it stops current animation first, i.e. ti\_on\_scene\_prop\_animation\_finished is launched. Also prop is moved to animation target position simultaneously.
Doesn't move on the first frame.
There is a small gap of 10cm engines thinks as reached to target position and teleports prop there.
prop\_instance\_get\_animation\_target\_position = 1863

(prop\_instance\_get\_animation\_target\_position, <pos>, <scene\_prop\_id>),
Retrieves the position that the prop instance is currently animating to.
prop\_instance\_stop\_animating = 1861

(prop\_instance\_stop\_animating, <scene\_prop\_id>),
Stops animating of the prop instance in the current position.
prop\_instance\_get\_scale = 1852

(prop\_instance\_get\_scale, <position>, <scene\_prop\_id>),
Retrieves the current scaling factors of the prop instance.
prop\_instance\_set\_scale = 1854

(prop\_instance\_set\_scale, <scene\_prop\_id>, <value\_x\_fixed\_point>, <value\_y\_fixed\_point>, <value\_z\_fixed\_point>),
Sets new scaling factors for the scene prop.
prop\_instance\_enable\_physics = 1864

(prop\_instance\_enable\_physics, <scene\_prop\_id>, <value>),
Enables (value = 1) or disables (value = 0) physics calculation (gravity, collision checks) for the scene prop instance.
prop\_instance\_initialize\_rotation\_angles = 1866

(prop\_instance\_initialize\_rotation\_angles, <scene\_prop\_id>),
Should be called to initialize the scene prop instance prior to any calls to (prop\_instance\_rotate\_to\_position).
prop\_instance\_rotate\_to\_position = 1865

(prop\_instance\_rotate\_to\_position, <scene\_prop\_id>, <position>, <duration-in-1/100-seconds>, <total\_rotate\_angle\_fixed\_point>),
Specified prop instance will move to the target position within the specified duration of time, and within the same time it will rotate for the specified angle. Used in Native code to simulate behavior of belfry wheels and rotating winches.
prop\_instance\_clear\_attached\_missiles = 1885

(prop\_instance\_clear\_attached\_missiles, <scene\_prop\_id>),
Version 1.153+. Removes all missiles currently attached to the scene prop. Only works with dynamic scene props. (non-retrievable missiles)
prop\_instance\_dynamics\_set\_properties = 1871

(prop\_instance\_dynamics\_set\_properties, <scene\_prop\_id>, <position>),
Initializes physical parameters of a scene prop. Position (X,Y) coordinates are used to store object's mass and friction coefficient. Coordinate Z is reserved (set it to zero just in case). Scene prop must be defined as sokf\_moveable|sokf\_dynamic\_physics, and a call to (prop\_instance\_enable\_physics) must be previously made.
Official: (prop\_instance\_dynamics\_set\_properties,<scene\_prop\_id>,mass\_friction),
prop\_instance\_dynamics\_set\_velocity = 1872

(prop\_instance\_dynamics\_set\_velocity, <scene\_prop\_id>, <position>),
Sets current movement speed for a scene prop. Position's coordinates define velocity along corresponding axis. Same comments as for (prop\_instance\_dynamics\_set\_properties).
Official: (prop\_instance\_dynamics\_set\_velocity,<scene\_prop\_id>,linear\_velocity),
prop\_instance\_dynamics\_set\_omega = 1873

(prop\_instance\_dynamics\_set\_omega, <scene\_prop\_id>, <position>),
Sets current rotation speed for a scene prop. Position's coordinates define rotational speed around corresponding axis. Same comments as for (prop\_instance\_dynamics\_set\_properties).
Official: (prop\_instance\_dynamics\_set\_omega,<scene\_prop\_id>,angular\_velocity),
prop\_instance\_dynamics\_apply\_impulse = 1874

(prop\_instance\_dynamics\_apply\_impulse, <scene\_prop\_id>, <position>),
Applies an impulse of specified scale to the scene prop. Position's coordinates define instant change in movement speed along corresponding axis. Same comments as for (prop\_instance\_dynamics\_set\_properties).
Official: (prop\_instance\_dynamics\_apply\_impulse,<scene\_prop\_id>,impulse\_force),
prop\_instance\_deform\_to\_time = 2610

(prop\_instance\_deform\_to\_time, <prop\_instance\_no>, <value>),
Version 1.161+. Deforms a vertex-animated scene prop to specified vertex time. If you open the mesh in OpenBrf, right one of "Time of frame" boxes contains the relevant value. If value is 0 will deform to time 1 instead, so make sure to duplicate 0 frame as last one if you want it to be accessible for deform. If value is 0 will deform to time 1 instead, so make sure to duplicate 0 frame as last one if you want it to be accessible for deform.
prop\_instance\_deform\_in\_range = 2611

(prop\_instance\_deform\_in\_range, <prop\_instance\_no>, <start\_frame>, <end\_frame>, <duration-in-1/1000-seconds>),
Version 1.161+. Animate vertex-animated scene prop from start frame to end frame within the specified time period (in milliseconds). If you open the mesh in OpenBrf, right one of "Time of frame" boxes contains the relevant values for frame parameters.
prop\_instance\_deform\_in\_cycle\_loop = 2612

(prop\_instance\_deform\_in\_cycle\_loop, <prop\_instance\_no>, <start\_frame>, <end\_frame>, <duration-in-1/1000-seconds>),
Version 1.161+. Performs looping animation of vertex-animated scene prop within the specified vertex frame ranges and within specified time (in milliseconds). If you open the mesh in OpenBrf, right one of "Time of frame" boxes contains the relevant values for frame parameters.
prop\_instance\_get\_current\_deform\_progress = 2615

(prop\_instance\_get\_current\_deform\_progress, <destination>, <prop\_instance\_no>),
Version 1.161+. Returns a percentage value between 0 and 100 if animation is still in progress. Returns 100 otherwise.
prop\_instance\_get\_current\_deform\_frame = 2616

(prop\_instance\_get\_current\_deform\_frame, <destination>, <prop\_instance\_no>),
Version 1.161+. Returns current frame of a vertex-animated scene prop, rounded to nearest integer value.
prop\_instance\_play\_sound = 1881

(prop\_instance\_play\_sound, <scene\_prop\_id>, <sound\_id>, [flags]),
Version 1.153+. Makes the scene prop play a specified sound. See sf\_\* flags in header\_sounds.py for reference on possible options.
prop\_instance\_stop\_sound = 1882

(prop\_instance\_stop\_sound, <scene\_prop\_id>),
Version 1.153+. Stops any sound currently played by the scene prop instance.
### Scene items operations

scene\_item\_get\_num\_instances = 1830

(scene\_item\_get\_num\_instances, <destination>, <item\_id>),
Gets the number of specified scene items present on the scene. Scene items behave exactly like scene props (i.e. cannot be picked).
scene\_item\_get\_instance = 1831

(scene\_item\_get\_instance, <destination>, <item\_id>, <instance\_no>),
Retrieves the reference to a single instance of a scene item by it's sequential number.
scene\_spawned\_item\_get\_num\_instances = 1832

(scene\_spawned\_item\_get\_num\_instances, <destination>, <item\_id>),
Retrieves the number of specified spawned items present on the scene. Spawned items are actual items, i.e. they can be picked by player.
scene\_spawned\_item\_get\_instance = 1833

(scene\_spawned\_item\_get\_instance, <destination>, <item\_id>, <instance\_no>),
Retrieves the reference to a single instance of a spawned item by it's sequential number.
replace\_scene\_items\_with\_scene\_props = 1891

(replace\_scene\_items\_with\_scene\_props, <old\_item\_id>, <new\_scene\_prop\_id>),
Replaces all instances of specified scene item with scene props. Can only be called in ti\_before\_mission\_start trigger in module\_mission\_templates.py.
set\_spawn\_position = 1970

(set\_spawn\_position, <position>),:: DUPLICATE ENTRY
Defines the position which will later be used by (spawn\_scene\_prop), (spawn\_scene\_item), (spawn\_agent) and (spawn\_horse) operations.
spawn\_item = 1971

(spawn\_item, <item\_kind\_id>, <item\_modifier>, [seconds\_before\_pruning]),
Spawns a new item, possibly with modifier, on the scene in the position specified by previous call to (set\_spawn\_position). Optional parameter determines time period (in second) after which the item will disappear. Using 0 will prevent the item from disappearing.
spawn\_item\_without\_refill = 1976

(spawn\_item\_without\_refill, <item\_kind\_id>, <item\_modifier>, [seconds\_before\_pruning]),
Version 1.153+. UNTESTED. It is unclear how this is different from standard (spawn\_item).
### Light sources and particle systems

set\_current\_color = 1950

(set\_current\_color, <red\_value>, <green\_value>, <blue\_value>),
Sets color for subsequent calls to (add\_point\_light) etc. Color component ranges are 0..255.
set\_position\_delta = 1955

(set\_position\_delta, <value>, <value>, <value>),
Can only be called inside item or scene prop triggers. Sets (X,Y,Z) offsets from the item/prop current position for subsequent calls to (add\_point\_light) etc. Offsets are apparently in centimeters.
add\_point\_light = 1960

(add\_point\_light, [flicker\_magnitude], [flicker\_interval]),
Adds a point light source to an object with optional flickering magnitude (range 0..100) and flickering interval (in 1/100th of second). Uses position offset and color provided to previous calls to (set\_position\_delta) and (set\_current\_color). Can only be used in item triggers.
add\_point\_light\_to\_entity = 1961

(add\_point\_light\_to\_entity, [flicker\_magnitude], [flicker\_interval]),
Adds a point light source to an object with optional flickering magnitude (range 0..100) and flickering interval (in 1/100th of second). Uses position offset and color provided to previous calls to (set\_position\_delta) and (set\_current\_color). Can only be used in scene prop triggers.
[?] Attaches an emisive into any [Item] or [Scene Prop] when putting this into their functions. Doesn't works on the Original Game.
particle\_system\_add\_new = 1965

(particle\_system\_add\_new, <par\_sys\_id>,[position]),
Adds a new particle system to an object. Uses position offset and color provided to previous calls to (set\_position\_delta) and (set\_current\_color). Can only be used in item/prop triggers.
particle\_system\_emit = 1968

(particle\_system\_emit, <par\_sys\_id>, <value\_num\_particles>, <value\_period>),
Adds a particle system in some fancy way. Uses position offset and color provided to previous calls to (set\_position\_delta) and (set\_current\_color). Can only be used in item/prop triggers.
particle\_system\_burst = 1969

(particle\_system\_burst, <par\_sys\_id>, <position>, [percentage\_burst\_strength]),
Bursts a particle system in specified position.
particle\_system\_burst\_no\_sync = 1975

(particle\_system\_burst\_without\_sync,<par\_sys\_id>,<position\_no>,[percentage\_burst\_strength]),
Version 1.153+. Same as above, but apparently does not synchronize this between server and client.
prop\_instance\_add\_particle\_system = 1886

(prop\_instance\_add\_particle\_system, <scene\_prop\_id>, <par\_sys\_id>, <position\_no>),
Version 1.153+. Adds a new particle system to the scene prop. Note that <position\_no> is local, i.e. in relation to scene prop's coordinates and rotation.
prop\_instance\_stop\_all\_particle\_systems = 1887

(prop\_instance\_stop\_all\_particle\_systems, <scene\_prop\_id>),
Version 1.153+. Removes all particle systems currently associated with scene prop instance.
## Agents and teams

An agent represents of a single soldier on the 3D scene. Always keep this in mind when dealing with regular troops. A party may have 30 Swadian Knights. They will form a single troop stack in the party, and they will all be copies of the one and only Swadian Knight troop. However when the battle starts, this stack will spawn 30 distinct Agents.

Agents do not persist - they only exist in the game for the duration of the mission. As soon as the player returns to the world map, all agents who were present on the scene immediately disappear. If this was a battle during a normal game encounter, then the game will keep track of the battle results, and depending on the number of agents killed from all sides the engine will kill or wound some troops in the troop stacks of the parties who were participating in the battle.

During the mission, all agents are split into teams. By default player and his companions are placed into Team 0, but this may be changed in the mission template or by code. Player's enemies are usually team 1 (though again, this is not set in stone). Module System provides the modder with a great degree of control over teams composition, relation to each other (you can make hostile, allied or neutral teams, and you can have more than one team on the scene).

### Conditional operations

agent\_is\_in\_special\_mode = 1693

`(agent_is_in_special_mode, <agent_no>),`
Checks that the agent is currently in scripted mode.
agent\_is\_routed = 1699

`(agent_is_routed, <agent_no>),`
Checks that the agent has fled from the map (i.e. reached the edge of the map in fleeing mode and then faded).
agent\_is\_alive = 1702

`(agent_is_alive, <agent_no>),`
Checks that the agent is alive. This will fail for dead or retreated agents (retreating counts from starting to fade out).
agent\_is\_wounded = 1703

`(agent_is_wounded, <agent_no>),`
Checks that the agent has been knocked unconscious. Alive agents return 0 even with zero hit points.
agent\_is\_human = 1704

`(agent_is_human, <agent_no>),`
Checks that the agent is human (i.e. not horse).
agent\_is\_ally = 1706

`(agent_is_ally, <agent_no>),`
Checks that the agent is allied to the player (belongs to player's party or allied party in current encounter).
Fails if player agent hasn't spawned yet.
agent\_is\_non\_player = 1707

`(agent_is_non_player, <agent_no>),`
Checks that the agent is not a player.
agent\_is\_defender = 1708

`(agent_is_defender, <agent_no>),`
Checks that the agent belongs to the defending side (see encounter operations for details).
agent\_is\_active = 1712

`(agent_is_active, <agent_no>),`
Checks that the <agent\_no> reference is active i.e. agent is valid. This will always succeed inside try\_for\_agents loop.
agent\_has\_item\_equipped = 1729

`(agent_has_item_equipped, <agent_no>, <item_id>),`
Checks that the agent has a specific item equipped.
agent\_is\_in\_parried\_animation = 1769

`(agent_is_in_parried_animation, <agent_no>),`
Checks that the agent is currently in parrying animation (defending from some attack).
agent\_is\_alarmed = 1806

`(agent_is_alarmed, <agent_no>),`
Checks that the agent is alarmed (in combat mode with weapon drawn).
class\_is\_listening\_order = 1775

`(class_is_listening_order, <team_no>, <sub_class>),`
Checks that the specified group of specified team is listening to player's orders.
teams\_are\_enemies = 1788

`(teams_are_enemies, <team_no>, <team_no_2>),`
Checks that the two teams are hostile to each other.
agent\_is\_in\_line\_of\_sight = 1826

`(agent_is_in_line_of_sight, <agent_no>, <position_no>),`
Version 1.153+. Checks that the agent can be seen from specified position. Rotation of position register is not used (i.e. agent will be seen even if position is "looking" the other way).
Is more expensive in performance than position\_has\_line\_of\_sight\_to\_position.
### Team and agent slot operations

Team and agent slots reset every mission.

team\_set\_slot = 509

(team\_set\_slot, <team\_id>, <slot\_no>, <value>),
team\_get\_slot = 529

(team\_get\_slot, <destination>, <player\_id>, <slot\_no>),
team\_slot\_eq = 549

(team\_slot\_eq, <team\_id>, <slot\_no>, <value>),
team\_slot\_ge = 569

(team\_slot\_ge, <team\_id>, <slot\_no>, <value>),
agent\_set\_slot = 505

(agent\_set\_slot, <agent\_id>, <slot\_no>, <value>),
agent\_get\_slot = 525

(agent\_get\_slot, <destination>, <agent\_id>, <slot\_no>),
agent\_slot\_eq = 545

(agent\_slot\_eq, <agent\_id>, <slot\_no>, <value>),
agent\_slot\_ge = 565

(agent\_slot\_ge, <agent\_id>, <slot\_no>, <value>),
### Agent spawning, removal and general operations

add\_reinforcements\_to\_entry = 1930

(add\_reinforcements\_to\_entry, <mission\_template\_entry\_no>, <wave\_size>),
For battle missions, adds reinforcement wave to the specified entry point. Additional parameter determines relative wave size. Agents in reinforcement wave are taken from all parties of the side that the entry point belongs to due to mtef\_team\_\* flags.
set\_spawn\_position = 1970

(set\_spawn\_position, <position>),:: DUPLICATE ENTRY
Defines the position which will later be used by (spawn\_scene\_prop), (spawn\_scene\_item), (spawn\_agent) and (spawn\_horse) operations.
spawn\_agent = 1972

(spawn\_agent, <troop\_id>),
Spawns a new troop in the specified position and saves the reference to the new agent in reg0.
spawn\_horse = 1973

(spawn\_horse, <item\_kind\_id>, <item\_modifier>),
Spawns a new horse (with any modifier) in the specified position and saves the reference to the new agent in reg0.
remove\_agent = 1755

(remove\_agent, <agent\_id>),
Instantly kills or wounds an agent (will emit dying sound).
agent\_fade\_out = 1749

(agent\_fade\_out, <agent\_id>),
Fades out the agent from the scene (same effect as fleeing enemies when they get to the edge of map).
They will be counted as dead (agent\_is\_alive) and not routed (agent\_is\_routed).
Doesn't work on ragdolls.
Doesn't fire trigger ti\_on\_agent\_killed\_or\_wounded.
agent\_play\_sound = 1750

(agent\_play\_sound, <agent\_id>, <sound\_id>),
Makes the agent emit the specified sound.
agent\_stop\_sound = 1808

(agent\_stop\_sound, <agent\_id>),
Stops whatever sound agent is currently performing. Only the reference to the last used sound channel is stored, it is impossible to know which ones were used before for a certain agent.
agent\_set\_visibility = 2096

(agent\_set\_visibility, <agent\_id>, <value>),
Version 1.153+. Sets agent visibility. 0 for invisible, 1 for visible.
get\_player\_agent\_no = 1700

(get\_player\_agent\_no, <destination>),
Retrieves the reference to the player-controlled agent. Singleplayer mode only.
agent\_get\_kill\_count = 1723

(agent\_get\_kill\_count, <destination>, <agent\_id>, [get\_wounded]),
Retrieves the total number of kills by the specified agent during this battle. Call with non-zero <get\_wounded> parameter to retrieve the total number of enemies the agent has knocked down.
Doesn't count agent's horse kills.
agent\_get\_position = 1710

(agent\_get\_position, <position>, <agent\_id>),
Retrieves the position of the specified agent on the scene.
X, Y, Z - fixed point values, rotation - integer values in degrees from 0 to 359.
Position is at ground level even when agent is jumping.
Sets X-rotation = 0, Y-rotation = 0. Y-rotation can change from 340 to 20 (aproximately) when turning mounted.
Horse and rider have the same position and speed-position.
agent\_set\_position = 1711

(agent\_set\_position, <agent\_id>, <position>),
Teleports the agent to specified position on the scene, sets to ground level automatically if dynamics are not turned off before setting agent position (agent\_set\_no\_dynamics). Be careful with riders - you must teleport the horse, not the rider for the operation to work correctly! Does not properly set the rotation of players in MP Warband as their mouse-look direction overrides it. Gets synchronized by game engine automatically if called on server. Each time you call this operation the game sends a network event to all clients. Too many calls will fresh or mess up the client completely, so the only solution is not calling them 20 times per frame.
agent\_get\_horse = 1714

(agent\_get\_horse, <destination>, <agent\_id>),
Retrieves the reference to the horse agent that the specified agent is riding, or -1 if he's not riding a horse (or is a horse himself).
agent\_get\_rider = 1715

(agent\_get\_rider, <destination>, <horse\_agent\_id>),
Retrieves the reference to the rider agent who is riding the specified horse, or -1 if there's no rider or the specified agent is not a horse.
agent\_get\_party\_id = 1716

(agent\_get\_party\_id, <destination>, <agent\_id>),
Retrieves the party that the specified agent belongs to (supposedly should only work in battle missions for agents spawned as starting/reinforcement waves).
agent\_get\_entry\_no = 1717

(agent\_get\_entry\_no, <destination>, <agent\_id>),
Retrieves the entry point number where this agent has spawned. What does this return for agents spawned with (spawn\_agent)? 4research.
agent\_get\_troop\_id = 1718

(agent\_get\_troop\_id, <destination>, <agent\_id>),
Retrieves the troop type of the specified agent. Returns -1 for horses (because horses are items, not troops).
agent\_get\_item\_id = 1719

(agent\_get\_item\_id, <destination>, <horse\_agent\_id>),
Retrieves the item type of the specified horse agent. Returns -1 for humans.
### Agent combat parameters and stats

store\_agent\_hit\_points = 1720

`(store_agent_hit_points, <destination>, <agent_id>, [absolute]),`
Retrieves current agent health. Optional last parameter determines whether actual health (absolute = 1) or relative percentile health (absolute = 0) is returned. Default is relative.
agent\_set\_hit\_points = 1721

`(agent_set_hit_points, <agent_id>, <value>,[absolute]),`
Sets new value for agent health. Optional last parameter determines whether the value is interpreted as actual health (absolute = 1) or relative percentile health (absolute = 0). Default is relative.
agent\_set\_max\_hit\_points = 2090

`(agent_set_max_hit_points, <agent_id>, <value>, [absolute]),`
Version 1.153+. Changes agent's max hit points. Optional flag [absolute] determines if <value> is an absolute number of his points, or relative percentage (0..1000) of default value. Treated as percentage by default.
Official: range [0..100]
agent\_deliver\_damage\_to\_agent = 1722

`(agent_deliver_damage_to_agent, <agent_id_deliverer>, <agent_id>, [damage_amount], [weapon_item_id]),`
Makes one agent deal damage to another. Parameter damage\_amount is optional, if it is skipped or <= 0, then damage will be calculated using attacker's weapon item and stats (like a normal weapon attack). Optional parameter weapon\_item\_id was added in 1.153 and will force the game the calculate the damage using this weapon.
agent\_deliver\_damage\_to\_agent\_advanced = 1827

`(agent_deliver_damage_to_agent_advanced, <destination>, <attacker_agent_id>, <agent_id>, <value>, [weapon_item_id]),`
Version 1.153+. Same as (agent\_deliver\_damage\_to\_agent), but resulting damage is returned. Also operation takes relations between agents into account, which may result in no damage, or even damage to attacker due to friendly fire rules.
add\_missile = 1829

`(add_missile, <agent_id>, <starting_position>, <starting_speed_fixed_point>, <weapon_item_id>, <weapon_item_modifier>, <missile_item_id>, <missile_item_modifier>),`
Version 1.153+. Creates a missile with specified parameters. Note that <starting\_position> parameter also determines the direction in which missile flies.
Supposedly after execution gets pos1 of wielded item.
agent\_get\_speed = 1689

`(agent_get_speed, <position>, <agent_id>),`
Retrieves agent speed to (X,Y) coordinates of the position register. Speed is local position to agent.
X, Y - fixed point values. Sets Z = 0, rotation of <position> doesn't affected.
Cavalry don't have x-coordinate. Their position-y-rotation leans to left o right.
agent\_set\_no\_death\_knock\_down\_only = 1733

`(agent_set_no_death_knock_down_only, <agent_id>, <value>),`
Sets the agent as unkillable (value = 1) or normal (value = 0). Unkillable agents will drop on the ground instead of dying and will stand up afterwards.
agent\_set\_horse\_speed\_factor = 1734

`(agent_set_horse_speed_factor, <agent_id>, <speed_multiplier-in-1/100>),`
Multiplies agent's horse speed (and maneuverability?) by the specified percentile value (using 100 will make the horse). Note that this is called on the rider, not on the horse! Supposedly will persist even if the agent changes horses. 4research.
agent\_set\_speed\_limit = 1736

`(agent_set_speed_limit, <agent_id>, <speed_limit(kilometers/hour)>),`
Limits agent speed by the specified value in kph. Use 5 for average walking speed. Affects only AI agents.
Setting to 0 will limit the speed to a minimum value wich is never equal to 0.
agent\_get\_damage\_modifier = 2065

`(agent_get_damage_modifier, <destination>, <agent_id>),`
Version 1.157+. output value is in percentage, 100 is default, value can be between [0..1000]
agent\_set\_damage\_modifier = 2091

`(agent_set_damage_modifier, <agent_id>, <value>),`
Version 1.153+. Changes the damage delivered by this agent. Value is in percentage, 100 is default, 1000 is max possible value.
agent\_get\_accuracy\_modifier = 2066

`(agent_get_accuracy_modifier, <destination>, <agent_id>),`
Version 1.157+. output value is in percentage, 100 is default, value can be between [0..1000]
agent\_set\_accuracy\_modifier = 2092

`(agent_set_accuracy_modifier, <agent_id>, <value>),`
Version 1.153+. Changes agent's accuracy (with ranged weapons?). Value is in percentage, 100 is default, value can be between [0..1000]
agent\_get\_speed\_modifier = 2067

`(agent_get_speed_modifier, <destination>, <agent_id>),`
Version 1.157+. output value is in percentage, 100 is default, value can be between [0..1000]
agent\_set\_speed\_modifier = 2093

`(agent_set_speed_modifier, <agent_id>, <value>),`
Version 1.153+. Changes agent's speed. Value is in percentage, 100 is default, value can be between [0..1000]
agent\_get\_reload\_speed\_modifier = 2068

`(agent_get_reload_speed_modifier, <destination>, <agent_id>),`
Version 1.157+. output value is in percentage, 100 is default, value can be between [0..1000]
agent\_set\_reload\_speed\_modifier = 2094

`(agent_set_reload_speed_modifier, <agent_id>, <value>),`
Version 1.153+. Changes agent's reload speed. Value is in percentage, 100 is default, value can be between [0..1000]
agent\_get\_use\_speed\_modifier = 2069

`(agent_get_use_speed_modifier, <destination>, <agent_id>),`
Version 1.157+. output value is in percentage, 100 is default, value can be between [0..1000]
agent\_set\_use\_speed\_modifier = 2095

`(agent_set_use_speed_modifier, <agent_id>, <value>),`
Version 1.153+. Changes agent's speed with using various scene props. Value is in percentage, 100 is default, value can be between [0..1000]
agent\_set\_ranged\_damage\_modifier = 2099

`(agent_set_ranged_damage_modifier, <agent_id>, <value>),`
Version 1.157+. Changes agent's damage with ranged weapons. Value is in percentage, 100 is default, value can be between [0..1000]
agent\_get\_time\_elapsed\_since\_removed = 1760

`(agent_get_time_elapsed_since_removed, <destination>, <agent_id>),`
Retrieves the number of seconds that have passed since agent's death. Native uses this only for multiplayer to track player's respawns. Can it be used in singleplayer too? 4research.
str\_store\_agent\_face\_keys = 2749

`(str_store_agent_face_keys, <string_reg>, <agent_id>),`
Stores agent face code. Regular agents have random generated face from two face codes of the troop.
### Agent equipment

agent\_refill\_wielded\_shield\_hit\_points = 1692

(agent\_refill\_wielded\_shield\_hit\_points, <agent\_id>),
Restores all hit points for the shield the agent is currently wielding.
agent\_set\_invulnerable\_shield = 1725

(agent\_set\_invulnerable\_shield, <agent\_id>, <value>),
Makes the agent shield invulnerable to any damage (value = 1) or makes him vulnerable again (value = 0).
agent\_get\_wielded\_item = 1726

(agent\_get\_wielded\_item, <destination>, <agent\_id>, <hand\_no>),
Retrieves the item reference that the agent is currently wielding in his right hand (hand\_no = 0) or left hand (hand\_no = 1). Note that weapons are always wielded in right hand, and shield in left hand. When wielding a two-handed weapon (including bows and crossbows), this operation will return -1 for left hand.
agent\_get\_ammo = 1727

(agent\_get\_ammo, <destination>, <agent\_id>, <value>),
Retrieves the current ammo amount agent has for his wielded item (value = 1) or all his items (value = 0).
agent\_get\_item\_cur\_ammo = 1977

(agent\_get\_item\_cur\_ammo, <destination>, <agent\_id>, <slot\_no>),
Version 1.153+. Returns remaining ammo for specified agent's item.
agent\_refill\_ammo = 1728

(agent\_refill\_ammo, <agent\_id>),
Refills all ammo and throwing weapon stacks that the agent has in his equipment.
agent\_set\_wielded\_item = 1747

(agent\_set\_wielded\_item, <agent\_id>, <item\_id>),
Forces the agent to wield the specified item. Agent must have that item in his equipment for this to work. Use item\_id = -1 to unwield any currently wielded item.
agent\_equip\_item = 1779

(agent\_equip\_item, <agent\_id>, <item\_id>, [weapon\_slot\_no]),
Adds the specified item to agent and forces him to equip it. Optional weapon\_slot\_no parameter is only used with weapons and will put the newly added item to that slot (range 1..4). If it is omitted with a weapon item, then the agent must have an empty weapon slot for the operation to succeed.
agent\_unequip\_item = 1774

(agent\_unequip\_item, <agent\_id>, <item\_id>, [weapon\_slot\_no]),
Removes the specified item from the agent. Optional parameter weapon\_slot\_no is in range 1..4 and determines what weapon slot to remove (item\_id must still be set correctly).
agent\_set\_ammo = 1776

(agent\_set\_ammo, <agent\_id>, <item\_id>, <value>),
Sets current agent ammo amount to the specified value between 0 and maximum ammo. <item\_id> means - ammo item (arrows, bullets, grenades).
When you have more than one "quiver" of the same type you must add the total value of all in order to set the correct ammo amount.
agent\_get\_item\_slot = 1804

(agent\_get\_item\_slot, <destination>, <agent\_id>, <value>),
Retrieves item\_id for specified agent's slot Possible slot values range in 0..7, order is weapon1, weapon2, weapon3, weapon4, head\_armor, body\_armor, leg\_armor, hand\_armor.
agent\_get\_ammo\_for\_slot = 1825

(agent\_get\_ammo\_for\_slot, <destination>, <agent\_id>, <slot\_no>),
Retrieves the amount of ammo agent has in the referenced slot (range 0..3).

### Agent animations

agent\_set\_no\_dynamics = 1762

(agent\_set\_no\_dynamics, <agent\_id>, <value>),
Makes the agent stand on the spot (value = 1) or move normally (value = 0). When frozen on the spot the agent can still turn around and fight if necessary. Used in Native for the wedding scene (required for cut-scenes).
agent\_get\_animation = 1768

(agent\_get\_animation, <destination>, <agent\_id>, <body\_part>),
Retrieves current agent animation for specified body part (0 = lower, 1 = upper).
agent\_set\_animation = 1740

(agent\_set\_animation, <agent\_id>, <anim\_id>, [channel\_no]),
Forces the agent to perform the specified animation. Optional channel\_no parameter determines whether upper body (value = 1) or lower body (value = 0, default) is affected by animation.
agent\_set\_stand\_animation = 1741

(agent\_set\_stand\_animation, <agent\_id>, <anim\_id>),
Defines the animation that this agent will use when standing still. Does not force the agent into actually doing this animation.
agent\_set\_walk\_forward\_animation = 1742

(agent\_set\_walk\_forward\_animation, <agent\_id>, <anim\_id>),
Defines the animation that this agent will use when walking forward. Only works for NPC agents.
agent\_set\_animation\_progress = 1743

(agent\_set\_animation\_progress, <agent\_id>, <value\_fixed\_point>),
Allows to skip the agent to a certain point in the animation cycle, as specified by the fixed point value (0..fixed\_point\_multiplier).
agent\_ai\_set\_can\_crouch = 2083

(agent\_ai\_set\_can\_crouch, <agent\_id>, <value>),
Version 1.153+. Allows or forbids the agent to crouch. 0 to forbid, 1 to allow.
agent\_get\_crouch\_mode = 2097

(agent\_get\_crouch\_mode, <destination>, <agent\_id>),
Version 1.153+. Retrieves agent's crouch status (1 = crouching, 0 = standing).
agent\_set\_crouch\_mode = 2098

(agent\_set\_crouch\_mode, <agent\_id>, <value>),
Version 1.153+. Sets agent's crouch status (1 = crouch, 0 = stand up).
agent\_get\_attached\_scene\_prop = 1756

(agent\_get\_attached\_scene\_prop, <destination>, <agent\_id>),
Retrieves the reference to scene prop instance which is attached to the agent, or -1 if there isn't any.
agent\_set\_attached\_scene\_prop = 1757

(agent\_set\_attached\_scene\_prop, <agent\_id>, <scene\_prop\_id>),
Attaches the specified prop instance to the agent. Used in multiplayer CTF missions to attach flags to players.
The scale factor at the skin entry gets applied to the scene prop.
agent\_set\_attached\_scene\_prop\_x = 1758

(agent\_set\_attached\_scene\_prop\_x, <agent\_id>, <value>),
Offsets the position of the attached scene prop in relation to agent, in centimeters, along the X axis (left/right).
agent\_set\_attached\_scene\_prop\_y = 1809

(agent\_set\_attached\_scene\_prop\_y, <agent\_id>, <value>),
Offsets the position of the attached scene prop in relation to agent, in centimeters, along the Y axis (backwards/forward).
agent\_set\_attached\_scene\_prop\_z = 1759

(agent\_set\_attached\_scene\_prop\_z, <agent\_id>, <value>),
Offsets the position of the attached scene prop in relation to agent, in centimeters, along the Z axis (down/up).
agent\_get\_bone\_position = 2076

(agent\_get\_bone\_position, <position\_no>, <agent\_no>, <bone\_no>, [<local\_or\_global>]),
Version 1.161+. Returns current position for agent's bone. Examine skeletons.brf and horse\_skeleton.brf in CommonRes folder to see hitboxes of these bones and their <bone\_no>.
Pass 1 as optional <local\_or\_global> parameter to retrieve global bone coordinates.
### Agent AI and scripted behavior

agent\_ai\_set\_interact\_with\_player = 2077

(agent\_ai\_set\_interact\_with\_player, <agent\_no>, <value>),
Version 1.165+. Enables or disables agent AI interation with player. Will not turn to face player pre-dialog, but still will turn during conversation.
agent\_set\_is\_alarmed = 1807

(agent\_set\_is\_alarmed, <agent\_id>, <value>),
Sets agent's status as alarmed (value = 1) or peaceful (value = 0).
agent\_clear\_relations\_with\_agents = 1802

(agent\_clear\_relations\_with\_agents, <agent\_id>),
Clears any agent-to-agent relations for specified agent.
agent\_add\_relation\_with\_agent = 1803

(agent\_add\_relation\_with\_agent, <agent\_id>, <agent\_id>, <value>),
Changes relations between two agents on the scene to enemy (value = -1), neutral (value = 0), ally (value = 1). Note that neutral agents are immune to friendly fire.
agent\_get\_number\_of\_enemies\_following = 1761

(agent\_get\_number\_of\_enemies\_following, <destination>, <agent\_id>),
Retrieves the total number of enemies who are currently attacking the specified agents. May be used for AI decision-making.
agent\_ai\_get\_num\_cached\_enemies = 2670

(agent\_ai\_get\_num\_cached\_enemies, <destination>, <agent\_no>),
Version 1.165+. Returns total number of nearby enemies as has been cached by agent AI.
Every 2 seconds a cache created with enemies stored from nearest to farthest. Max slots are 16.
agent\_ai\_get\_cached\_enemy = 2671

(agent\_ai\_get\_cached\_enemy, <destination>, <agent\_no>, <cache\_index>),
Version 1.165+. Return agent reference from AI's list of cached enemies, from nearest to farthest.
Returns -1 if the cached enemy from index is not exist.
agent\_get\_attack\_action = 1763

(agent\_get\_attack\_action, <destination>, <agent\_id>),
Retrieves agent's current attack action. Possible values: free = 0, readying\_attack = 1, releasing\_attack = 2, completing\_attack\_after\_hit = 3, attack\_parried = 4, reloading = 5, after\_release = 6, cancelling\_attack = 7.
agent\_get\_defend\_action = 1764

(agent\_get\_defend\_action, <destination>, <agent\_id>),
Retrieves agent's current defend action. Possible values: free = 0, parrying = 1, blocking = 2.
agent\_get\_action\_dir = 1767

Retrieves the direction of current agent's action.
Possible values at attacking: invalid = -1, ranged/thrust = 0, right swing = 1, left swing = 2, overswing = 3.
Possible values at defending: invalid = -1, forward/down = 0, right = 1, left = 2, up = 3, global/blocking with shield = 5.
agent\_set\_attack\_action = 1745

(agent\_set\_attack\_action, <agent\_id>, <direction\_value>, <action\_value>),
Forces the agent to perform an attack action. Direction value: -2 = cancel any action (1.153+), 0 = thrust, 1 = slashright, 2 = slashleft, 3 = overswing. Action value: 0 = ready and release, 1 = ready and hold.
agent\_set\_defend\_action = 1746

(agent\_set\_defend\_action, <agent\_id>, <value>, <duration-in-1/1000-seconds>),
Forces the agent to perform a defend action. Possible values: -2 = cancel any action (1.153+), 0 = defend\_down, 1 = defend\_right, 2 = defend\_left, 3 = defend\_up. Does time value determine delay, speed or duration? 4research.
agent\_set\_scripted\_destination = 1730

Official: (agent\_set\_scripted\_destination, <agent\_id>, <position\_no>, <auto\_set\_z\_to\_ground\_level>, <no\_rethink>),
(agent\_set\_scripted\_destination, <agent\_id>, <position>, [auto\_set\_z\_to\_ground\_level], [no\_rethink]),
Forces the agent to travel to specified position and stay there until new behavior is set or scripted mode cleared. First optional parameter determines whether the position Z coordinate will be automatically set to ground level (value = 1) or not (value = 0). Second optional parameter added in 1.165 patch, set it to 1 to save resources.
agent\_set\_scripted\_destination\_no\_attack = 1748

(agent\_set\_scripted\_destination\_no\_attack, <agent\_id>, <position>, <auto\_set\_z\_to\_ground\_level>),
Same as above, but the agent will not attack his enemies.
agent\_get\_scripted\_destination = 1731

(agent\_get\_scripted\_destination, <position>, <agent\_id>),
Retrieves the position which is defined as agent's scripted destination, if any.
agent\_force\_rethink = 1732

(agent\_force\_rethink, <agent\_id>),
Forces the agent to recalculate his current actions after setting him a new scripted destination or changing other factors affecting his behavior.
agent\_clear\_scripted\_mode = 1735

(agent\_clear\_scripted\_mode, <agent\_id>),
Clears scripting mode from the agent, making him behave as usual again.
agent\_ai\_set\_always\_attack\_in\_melee = 1737

(agent\_ai\_set\_always\_attack\_in\_melee, <agent\_id>, <value>),
If you hide behind some obstacle diappearing from line of sight of enemy archers, they stand there and wait until you show up again or making a step or two in your direction occasionally. This flag makes them switch to melee instantly and charge you without waiting.
agent\_get\_simple\_behavior = 1738

(agent\_get\_simple\_behavior, <destination>, <agent\_id>),
Retrieves agent's current simple behavior (see aisb\_\* constants in header\_mission\_templates.py for details).
agent\_ai\_get\_behavior\_target = 2082

(agent\_ai\_get\_behavior\_target, <destination>, <agent\_id>),
Version 1.153+. UNTESTED. Supposedly returns agent\_id which is the target of current agent's behavior.
agent\_get\_combat\_state = 1739

(agent\_get\_combat\_state, <destination>, <agent\_id>),
Retrieves agent's current combat state:
0 = nothing special, this value is also always returned for player and for dead agents.
1 = target in sight (for ranged units)
2 = guarding (without a shield)
3 = preparing a melee attack or firing a ranged weapon
4 = releasing a melee attack or reloading a crossbow
7 = recovering after being hit in melee OR blocking with a shield. Contradictory information, 4research.
8 = target to the right (horse archers) OR no target in sight (ranged units). Contradictory information, 4research.
agent\_ai\_get\_move\_target = 2081

(agent\_ai\_get\_move\_target, <destination>, <agent\_id>),
Version 1.153+. UNTESTED. Supposedly returns the enemy agent to whom the agent is currently moving to.
agent\_get\_look\_position = 1709

(agent\_get\_look\_position, <position>, <agent\_id>),
Retrieves the coordinates of the agent position and currently looking angles.
agent\_set\_look\_target\_position = 1744

(agent\_set\_look\_target\_position, <agent\_id>, <position>),
Forces an agent to look at the specified position (turn his head as necessary). Non alarmed agents will look for a short amount of time. Not all alarmed agents will look continuesly at the point.
agent\_ai\_get\_look\_target = 2080

(agent\_ai\_get\_look\_target, <destination>, <agent\_id>),
Version 1.153+. UNTESTED. Supposedly returns agent\_id that the agent is currently looking at.
agent\_set\_look\_target\_agent = 1713

(agent\_set\_look\_target\_agent, <watcher\_agent\_id>, <observed\_agent\_id>),
Forces the agent to look at specified agent (track his movements). Alarmed agents will ignore this.
agent\_start\_running\_away = 1751

(agent\_start\_running\_away, <agent\_id>, [<position\_no>]),
Makes the agent flee the battlefield, ignoring everything else and not attacking. If the agent reaches the edge of map in this mode, he will fade out. Optional position\_no parameter added in 1.153 and will make the agent flee to specified position instead (pos0 is not allowed and will be ignored). When used on a mounted horse makes the agent 'fall off' instantly and the horse will run away (works for player too). Falling off from horse doesn't fire ti\_on\_agent\_dismount trigger.
Agents left the map in this mode will be counted as routed (agent\_is\_routed) and dead (agent\_is\_alive). But they will not decrease party size.
Riderless horses don't start running away. Use <agent\_set\_scripted\_destination, horse, border\_pos>. The horse will fade out when reached border.
agent\_stop\_running\_away = 1752

(agent\_stop\_run\_away, <agent\_id>),
Cancels fleeing behavior for the agent, turning him back to combat state.
agent\_ai\_set\_aggressiveness = 1753

(agent\_ai\_set\_aggressiveness, <agent\_id>, <value>),
Sets the aggressiveness parameter for agent AI to use. Default value is 100. Higher values make agent more aggressive. Used to avoid melee, when a bot moves away from you in melee.
agent\_set\_kick\_allowed = 1754

(agent\_set\_kick\_allowed, <agent\_id>, <value>),
Enables (value = 1) or disables (value = 0) kicking for the specified agent. Only makes sense for player-controlled agents as bots don't know how to kick anyway (if not scripted into the mod, kicking AI).
set\_cheer\_at\_no\_enemy = 2379

(set\_cheer\_at\_no\_enemy, <value>),
Version 1.153+. Determines whether the agents will cheer when no enemy remain on the map. 0 = do not cheer, 1 = cheer.
A voice\_victory sound entry at the skin entry is required for it to work.
agent\_add\_offer\_with\_timeout = 1777

(agent\_add\_offer\_with\_timeout, <agent\_id>, <offerer\_agent\_id>, <duration-in-1/1000-seconds>),
Esoteric stuff. Used in multiplayer duels. Second agent\_id is offerer, 0 value for duration is an infinite offer.
agent\_check\_offer\_from\_agent = 1778

(agent\_check\_offer\_from\_agent, <agent\_id>, <offerer\_agent\_id>),:second agent\_id is offerer
Esoteric stuff. Used in multiplayer duels. Second agent\_id is offerer.
### Team operations

agent\_get\_group = 1765

`(agent_get_group, <destination>, <agent_id>),`
In multiplayer: Retrieves reference to player who is currently the leader of specified bot agent.
In singleplayer: Retrieves agent group wich is the same as agent team.
agent\_set\_group = 1766

`(agent_set_group, <agent_id>, <player_leader_id>),`
In multiplayer: Puts the bot agent under command of specified player.
In singleplayer: Change the group. Agent team is not changed. Use agent\_set\_team.
agent\_get\_team = 1770

`(agent_get_team, <destination>, <agent_id>),`
Retrieves the team that the agent belongs to.
agent\_set\_team = 1771

`(agent_set_team, <agent_id>, <value>),`
Puts the agent to specified team number. Also copies "value" to agent group.
The max <value> is 7. But the 7 team is hardcoded neutral to everyone. If you set team out of range (0, 6) than 7 team will be assigned.
agent\_get\_class = 1772

`(agent_get_class , <destination>, <agent_id>),`
Retrieves the agent class (see grc\_\* constants in header\_mission\_templates.py for reference). Note this operation returns the troop class that the game divines from troop equipment and flags, ignoring any custom troop class settings.
agent\_get\_division = 1773

`(agent_get_division , <destination>, <agent_id>),`
Retrieves the agent division (custom troop class number in 0..8 range).
agent\_set\_division = 1783

`(agent_set_division, <agent_id>, <value>),`
Puts the agent into the specified division. This does not affect agent's troop class. Note that there's a bug in Warband: if an order is issued to agent's original division, the agent will immediately switch back to it's original division number. Therefore, if you want to manipulate agent divisions dynamically during the battle, you need to implement some workarounds for this bug.
team\_get\_hold\_fire\_order = 1784

`(team_get_hold_fire_order, <destination>, <team_no>, <division>),`
Retrieves current status of hold fire order for specified team/division (see aordr\_\* constants in header\_mission\_templates.py for reference).
team\_get\_movement\_order = 1785

`(team_get_movement_order, <destination>, <team_no>, <division>),`
Retrieves current movement orders for specified team/division (see mordr\_\* constants in header\_mission\_templates.py for reference).
team\_get\_riding\_order = 1786

`(team_get_riding_order, <destination>, <team_no>, <division>),`
Retrieves current status of riding order for specified team/division (see rordr\_\* constants in header\_mission\_templates.py for reference).
team\_get\_weapon\_usage\_order = 1787

`(team_get_weapon_usage_order, <destination>, <team_no>, <division>),`
Retrieves current status of weapon usage order for specified team/division (see wordr\_\* constants in header\_mission\_templates.py for reference).
team\_give\_order = 1790

`(team_give_order, <team_no>, <division>, <order_id>),`
Issues an order to specified team/division. Non alarmed agents will ignore.
team\_set\_order\_position = 1791

`(team_set_order_position, <team_no>, <division>, <position>),`
Defines the position for specified team/division when currently issued order requires one.
team\_get\_leader = 1792

`(team_get_leader, <destination>, <team_no>),`
Retrieves the reference to the agent who is the leader of specified team.
team\_set\_leader = 1793

`(team_set_leader, <team_no>, <new_leader_agent_id>),`
Sets the player agent as the new leader of specified team. Doesn't work with regular agent.
team\_get\_order\_position = 1794

`(team_get_order_position, <position>, <team_no>, <division>),`
Retrieves position which is used for specified team/division current orders.
team\_set\_order\_listener = 1795

Official: `(team_set_order_listener, <team_no>, <sub_class>, <value>),`
merge with old listeners if value is non-zero
clear listeners if sub\_class is less than zero
`(team_set_order_listener, <team_no>, <division>, [add_to_listeners]),`
Set the specified division as the one which will be following orders issued by the player (assuming the player is on the same team). If optional parameter add\_to\_listeners is greater than 0, then the operation will instead \*add\* specified division to order listeners. If division number is -1, then list of order listeners is cleared. If division number is 9, then all divisions will listen to player's orders.
team\_set\_relation = 1796

`(team_set_relation, <team_no>, <team_no_2>, <value>),`
Sets relations between two teams. Possible values: enemy (-1) (default), neutral (0) and friendly (1).
Doesn't work for 7 team. It's hardcoded neutral to everyone.
store\_remaining\_team\_no = 2360

`(store_remaining_team_no, <destination>),`
Retrieves the number of the last remaining team. Currently not used in Native, possibly deprecated.
team\_get\_gap\_distance = 1828

`(team_get_gap_distance, <destination>, <team_no>, <sub_class>),`
Version 1.153+. UNTESTED. Supposedly returns average gap between troops of a specified team/class (depends on how many Stand Closer/Spread Out orders were given).
### Combat statistics

store\_enemy\_count = 2380

(store\_enemy\_count, <destination>),
No longer used in Native. Apparently stores total number of active enemy agents. Possibly deprecated. 4research.
store\_friend\_count = 2381

(store\_friend\_count, <destination>),
No longer used in Native. Apparently stores total number of active friendly agents. Possibly deprecated. 4research.
store\_ally\_count = 2382

(store\_ally\_count, <destination>),
No longer used in Native. Apparently stores total number of active allied agents (how is it different from friends?). Possibly deprecated. 4research.
store\_defender\_count = 2383

(store\_defender\_count, <destination>),
No longer used in Native. Apparently stores total number of active agents on defender's side. Possibly deprecated. 4research.
store\_attacker\_count = 2384

(store\_attacker\_count, <destination>),
No longer used in Native. Apparently stores total number of active agents on attacker's side. Possibly deprecated. 4research.
store\_normalized\_team\_count = 2385

(store\_normalized\_team\_count, <destination>, <team\_no>),
Stores the number of agents belonging to specified team, normalized according to battle\_size and advantage. Commonly used to calculate advantage and possibly reinforcement wave sizes.
100% is equal to relative spawn agents count on mission start. For example if spawn point have 40 then 50% will be 20.
## Presentations

Presentations are a complex subject, because of their flexibility. Each presentation is nothing more but a number of screen control elements, called overlays. There are many types of overlays, each coming with it's own behavior and looks. For as long as the presentation is running, you can monitor the status of those overlays and change their looks, contents and position on the screen.

Presentation is nothing but a set of triggers. There are only five triggers that the presentation can have, but skillful control of them allows you to do nearly everything you can think of.

ti\_on\_presentation\_load fires only once when the presentation is started. his is the place where you will usually create all overlays that your resentation needs, initialize their looks and contents and put them to heir positions on the screen.

ti\_on\_presentation\_event\_state\_change is probably the most important and easy one. It fires every time some overlay in your presentation changes state. For each type of overlay this means something. For a button overlay, this means that the user has clicked the button. In this case, you will want to run the code responsible for that button effects. So you can put a "Win" button on your presentation, and when it's clicked, you can run the code which will give all castles and towns in the game to you.:-)

ti\_on\_presentation\_mouse\_press trigger fires every time user clicks a mouse button on one of presentation overlays, even if the overlay did not change it's state as the result.

ti\_on\_presentation\_mouse\_enter\_leave trigger fires when the mouse pointer moves over one of presentation's overlays, or moves out of it. This might be useful if you want your presentation to react to user's mouse movements, not only clicks.

ti\_on\_presentation\_run trigger will fire every frame (in other words, with the frequency of your game FPS). You can put some code in this trigger if you want your presentation to constantly do something even if the user is passive.

Note that while a running presentation will usually pause your game until you stop it, it is also possible to write presentations which will not stop the game, but will run as the time goes. To see an example, go into any battle in Warband and press Backspace. You will see the interface which displays the mini-map of the battle, positions of all troops, and elements that you can use to issue orders to your companions (if you have any). All this is a presentation as well, called "prsnt\_battle". And if you have played multiplayer, then you might be interested to know that all menus, including equipment selection for your character, are presentations as well.

Buttons are clickable objects. Button is clickable even if not visible.
It can be hidden by alpha channel (transparency) or other overlays (meshes or buttons with highest overlay\_ID or render height).
If two buttons occupy the same area the one with highest overlay\_ID will trigger.

### Conditional operations

is\_presentation\_active = 903

(is\_presentation\_active, <presentation\_id),
Checks that the specified presentation is currently running.
### General presentation operations

start\_presentation = 900

(start\_presentation, <presentation\_id>),
Starts the specified presentation.
start\_background\_presentation = 901

(start\_background\_presentation, <presentation\_id>),
Apparently allows you to start a presentation in background but stay in the menu. 4research.
Official: can only be used in game menus
presentation\_set\_duration = 902

(presentation\_set\_duration, <duration-in-1/100-seconds>),
Sets presentation duration time, in 1/100th of second. Must be called when a presentation is active. If several presentations are active, duration will be set for all of them.
### Creating overlays

create\_text\_overlay = 910

(create\_text\_overlay, <destination>, <string\_id>, [style\_flags]),
Creates a text label overlay and returns it's overlay\_id.
If tf\_scrollable - doesn't work overlay\_set\_additional\_render\_height
create\_mesh\_overlay = 911

(create\_mesh\_overlay, <destination>, <mesh\_id>),
Creates a mesh overlay and returns it's overlay\_id.
create\_mesh\_overlay\_with\_item\_id = 944

(create\_mesh\_overlay\_with\_item\_id, <destination>, <item\_id>),
Creates a mesh overlay, using the specified item mesh. Returns overlay\_id.
create\_mesh\_overlay\_with\_tableau\_material = 939

(create\_mesh\_overlay\_with\_tableau\_material, <destination>, <mesh\_id>, <tableau\_material\_id>, <value>),
Creates a mesh overlay, using the specified tableau\_material. When mesh\_id = -1, it is generated automatically. Value is passed as the parameter for tableau\_material script. Returns overlay\_id.
create\_button\_overlay = 912

(create\_button\_overlay, <destination>, <string\_id>, <alignment>),
Creates a generic button overlay and returns it's overlay\_id. The only difference between this and subsequent two operations is that they use different button meshes.
Possible mesh - transparent plane.
create\_game\_button\_overlay = 940

(create\_game\_button\_overlay, <destination>, <string\_id>),
Creates a game button overlay and returns it's overlay\_id. The size specified with <overlay\_set\_area\_size>.
create\_in\_game\_button\_overlay = 941

(create\_in\_game\_button\_overlay, <destination>, <string\_id>),
Creates an in-game button overlay and returns it's overlay\_id.
create\_image\_button\_overlay = 913

(create\_image\_button\_overlay, <destination>, <mesh\_id>, <mesh\_id>),
Creates an image button, using two meshes for normal (1st mesh) and pressed (2nd mesh) status. Button does not have a textual label. Returns button overlay\_id.
create\_image\_button\_overlay\_with\_tableau\_material = 938

(create\_image\_button\_overlay\_with\_tableau\_material, <destination>, <mesh\_id>, <tableau\_material\_id>, <value>),
Creates an image button from the specified mesh, using tableau\_material as the image. When mesh = -1, it is generated automatically. Value is passed as the parameter to the tableau\_material script. Returns overlay\_id.
create\_slider\_overlay = 914

(create\_slider\_overlay, <destination>, <min\_value>, <max\_value>),
Creates horizontal slider overlay, with positions of the slider varying between min and max values. Current value of the slider can be changed with (overlay\_set\_val). Returns slider's overlay\_id.
create\_progress\_overlay = 915

(create\_progress\_overlay, <destination>, <min\_value>, <max\_value>),
Creates progress bar overlay, with positions of the bar varying between min and max values. Current value of the progress bar can be changed with (overlay\_set\_val). Returns bar's overlay\_id.
create\_number\_box\_overlay = 942

(create\_number\_box\_overlay, <destination>, <min\_value>, <max\_value>),
Creates a number box overlay (a small field for numeric value and small increase/decrease buttons to the right) with specified min and max values. Returns number box overlay\_id.
create\_text\_box\_overlay = 917

(create\_text\_box\_overlay, <destination>),
Apparently deprecated. No longer used in Native.
create\_simple\_text\_box\_overlay = 919

(create\_simple\_text\_box\_overlay, <destination>),
Creates a text field overlay, where user can enter any text. Returns text field's overlay\_id. Text contents of the field can be retrieved from s0 trigger in ti\_on\_presentation\_event\_state\_change event for the text field.
<overlay\_set\_size> uses: (size\_X, scale\_Y) where: size\_X - absolute coordinates and scale\_Y - relative coordinates
create\_check\_box\_overlay = 918

(create\_check\_box\_overlay, <destination>, <checkbox\_off\_mesh>, <checkbox\_on\_mesh>),
Creates a checkbox overlay. Returns checkbox overlay\_id.
create\_listbox\_overlay = 943

(create\_list\_box\_overlay, <destination>),
Creates a listbox overlay. Individual items can be added with (overlay\_add\_item) and index of currently selected item can be set with (overlay\_set\_val). Returns listbox overlay\_id.
Old syntax (does it changed?): (create\_list\_box\_overlay, <destination>, <string>, <value>),
Resizing during presentation run is bugged. Repositioning during presentation load uses left-bottom point, during presentation run - middle-bottom.
create\_combo\_label\_overlay = 948

(create\_combo\_label\_overlay, <destination>),
Creates a combo label overlay. Looks like plain text label. Individual items can be added with (overlay\_add\_item) and currently selected item can be set with (overlay\_set\_val). Returns combo block's overlay\_id.
create\_combo\_button\_overlay = 916

(create\_combo\_button\_overlay, <destination>),
Creates a combo button overlay. For example see "Screen Resolution" dropdown in Settings menu. Individual items can be added with (overlay\_add\_item) and currently selected item can be set with (overlay\_set\_val). Returns combo block's overlay\_id.
overlay\_add\_item = 931

(overlay\_add\_item, <overlay\_id>, <string\_id>),
Adds an item to the listbox or combobox. Items are indexed from 0. Note the order in which items appear in the dropdown is reverse to the order in which they're added.
### Overlays hierarchy manipulation

set\_container\_overlay = 945

(set\_container\_overlay, <overlay\_id>),
Defines the specified overlay as the container. All subsequently created overlays will be placed inside the container, and their coordinates will be based on container's position. All containers with their contents will be displayed \*above\* any non-container overlays. Use -1 to stop placing overlays to current container and resume normal behavior.
overlay\_set\_container\_overlay = 951

(overlay\_set\_container\_overlay, <overlay\_id>, <container\_overlay\_id>),
Allows you to put one overlay into a container, or remove it from container (if container\_overlay\_id = -1) without setting current overlay. May be unreliable.
### Overlay manipulation

overlay\_get\_position = 946

(overlay\_get\_position, <position>, <overlay\_id>),
Retrieves overlay current position to specified position trigger, using position's X and Y coordinates. Note that the screen size in Warband is (1.00,0.75), further modified by fixed point multiplier.
overlay\_set\_val = 927

(overlay\_set\_val, <overlay\_id>, <value>),
Sets the value of the overlays which have numeric values.
Official: can be used for sliders, combo buttons and check boxes
overlay\_set\_text = 920

(overlay\_set\_text, <overlay\_id>, <string\_id>),
Changes the overlay text (if it has any). Works for labels, text fields, buttons with text labels...
overlay\_set\_boundaries = 928

(overlay\_set\_boundaries, <overlay\_id>, <min\_value>, <max\_value>),
Changes the value boundaries for the overlays that have them.
overlay\_set\_position = 926

(overlay\_set\_position, <overlay\_id>, <position>),
Sets the overlay position on the screen, using position's X and Y coordinates. Note that the screen size in Warband is (1.00,0.75), further modified by fixed point multiplier.
overlay\_set\_size = 925

(overlay\_set\_size, <overlay\_id>, <position>),
Sets the overlay size, using position's X and Y coordinates. Note that the screen size in Warband is (1.00,0.75), further modified by fixed point multiplier. Also see (overlay\_set\_area\_size).
overlay\_set\_area\_size = 929

(overlay\_set\_area\_size, <overlay\_id>, <position>),
Defines the actual area on the screen used to display the overlay. If it's size is greater than area size, it will create a scrollable area with appropriate scrollbars. Can be used to create scrollable areas for large text, or scrollable containers with many children elements (see Host Game screen for a typical example).
overlay\_set\_additional\_render\_height = 952

(overlay\_set\_additional\_render\_height, <overlay\_id>, <height\_adder>),
Version 1.153+. Will show overlay above others if height\_adder greater than 0. Max 296 for text.
overlay\_animate\_to\_position = 937

(overlay\_animate\_to\_position, <overlay\_id>, <duration-in-1/1000-seconds>, <position>),
Moves overlay to specified position during a specified timeframe, specified in 1/1000th of second.
overlay\_animate\_to\_size = 936

(overlay\_animate\_to\_size, <overlay\_id>, <duration-in-1/1000-seconds>, <position>),
Changes overlay size to specified value during a specified timeframe, specified in 1/1000th of second.
overlay\_set\_mesh\_rotation = 930

(overlay\_set\_mesh\_rotation, <overlay\_id>, <position>),
Despite the name, works with any overlay, allowing you to put it on the screen in rotated position. To determine the angles, position's rotation values are used (not coordinates!). Usually you will want to only use rotation around Z axis (which results in clockwise or anti-clockwise rotation as seen by user). Note that rotating overlays which are placed inside a container may cause strange results, so some trial and error will be necessary in such situation.
overlay\_set\_material = 956

(overlay\_set\_material, <overlay\_id>, <string\_no>),
Version 1.161+. Replaces the material used for rendering specified overlay.
overlay\_set\_color = 921

(overlay\_set\_color, <overlay\_id>, <color>),
Changes the overlay color (hexadecimal value 0xRRGGBB). May not work with some overlay types.
overlay\_set\_alpha = 922

(overlay\_set\_alpha, <overlay\_id>, <alpha>),
Changes the overlay alpha (hexadecimal value in 0x00..0xFF range). May not work with some overlay types.
overlay\_set\_hilight\_color = 923

(overlay\_set\_hilight\_color, <overlay\_id>, <color>),
Highlights the overlay with specified color. May not work with some overlay types.
overlay\_set\_hilight\_alpha = 924

(overlay\_set\_hilight\_alpha, <overlay\_id>, <alpha>),
Highlights the overlay with specified alpha. May not work with some overlay types.
overlay\_animate\_to\_color = 932

(overlay\_animate\_to\_color, <overlay\_id>, <duration-in-1/1000-seconds>, <color>),
Changes overlay's color during a specified timeframe, specified in 1/000th of second.
overlay\_animate\_to\_alpha = 933

(overlay\_animate\_to\_alpha, <overlay\_id>, <duration-in-1/1000-seconds>, <color>),
Changes overlay's alpha during a specified timeframe, specified in 1/000th of second.
Doesn't work with text overlays using <tf\_with\_outline>.
overlay\_set\_alpha doesn't work when animating is processed. Use overlay\_animate\_to\_alpha with 0 msec.
overlay\_animate\_to\_highlight\_color = 934

(overlay\_animate\_to\_highlight\_color, <overlay\_id>, <duration-in-1/1000-seconds>, <color>),
Highlights overlay to specified color during a specified timeframe, specified in 1/000th of second.
overlay\_animate\_to\_highlight\_alpha = 935

(overlay\_animate\_to\_highlight\_alpha, <overlay\_id>, <duration-in-1/1000-seconds>, <color>),
Highlights overlay to specified alpha during a specified timeframe, specified in 1/000th of second.
overlay\_set\_display = 947

(overlay\_set\_display, <overlay\_id>, <value>),
Shows (value = 1) or hides (value = 0) the specified overlay.
overlay\_obtain\_focus = 949

(overlay\_obtain\_focus, <overlay\_id>),
Makes the specified overlay obtain input focus. Only works for textboxes.
overlay\_set\_tooltip = 950

(overlay\_set\_tooltip, <overlay\_id>, <string\_id>),
Defines a text which will be displayed as a tooltip when mouse pointer will hover over the specified overlay. Unreliable, always test how it works.
### Popups and some esoteric stuff

show\_item\_details = 970

(show\_item\_details, <item\_id>, <position>, <price\_multiplier\_percentile>),
Shows a popup box at the specified position, containing standard game information for the specified item. Last parameter determines price percentile multiplier. Multiplier value of 100 will display item standard price, value of 0 will display "Default Item" instead of price (used in multiplayer equipment selection presentation).
Official: price\_multiplier is percent, usually returned by script\_game\_get\_item\_[buy/sell]\_price\_factor
show\_item\_details\_with\_modifier = 972

(show\_item\_details\_with\_modifier, <item\_id>, <item\_modifier>, <position>, <price\_multiplier\_percentile>),
Same as above, but displays stats and price information for an item with a modifier.
close\_item\_details = 971

(close\_item\_details),
Closes the item details popup box.
show\_troop\_details = 2388

(show\_troop\_details, <troop\_id>, <position>, <troop\_price>),
Version 1.153+. Supposedly displays a popup with troop information at specified place. 4research.
## Multiplayer and networking

This section is eagerly waiting for someone to write documentation comments.

### Conditional operations

player\_is\_active = 401

(player\_is\_active, <player\_id>),
Checks that the specified player is active (i.e. connected to server). Players are assigned a free ID after connection and on disconnection it becomes free/invalid until taken by another connecting player.
multiplayer\_is\_server = 417

(multiplayer\_is\_server),
Checks that the code is running on multiplayer server. Operation will fail on client machines or in singleplayer mode. This will succeed for listen and dedicated servers and will only fail on clients.
multiplayer\_is\_dedicated\_server = 418

(multiplayer\_is\_dedicated\_server),
Checks that the game running is a dedicated server. This will only succeed for dedicated servers and will fail on listen servers and clients.
game\_in\_multiplayer\_mode = 419

(game\_in\_multiplayer\_mode),
Checks that the game is running in multiplayer mode.
player\_is\_admin = 430

(player\_is\_admin, <player\_id>),
Checks that the player used the admin password to join the server.
player\_is\_busy\_with\_menus = 438

(player\_is\_busy\_with\_menus, <player\_id>),
This one is used when a player presses a hotkey like TAB or ESC to check if he doesn't have any kind of presentation open, however, it works strangely and is almost always acompannied by some sort of (neg|is\_presentation\_active, "prst"), in native.
Research: Is actually not getting used together with (neg|is\_presentation\_active, "prst"). It is getting called on the server and isn't synched with clients. Used in multiplayer to prevent the spawning of a player agent if the player is still busy with the menus (and might still change the loadout of the agent).
player\_item\_slot\_is\_picked\_up = 461

(player\_item\_slot\_is\_picked\_up, <player\_id>, <item\_slot\_no>),
Checks that the provided item slot for the referenced player was picked up from the battlefield instead of bought.
### Player slot operations

player\_set\_slot = 508

(player\_set\_slot, <player\_id>, <slot\_no>, <value>),
player\_get\_slot = 528

(player\_get\_slot, <destination>, <player\_id>, <slot\_no>),
player\_slot\_eq = 548

(player\_slot\_eq, <player\_id>, <slot\_no>, <value>),
player\_slot\_ge = 568

(player\_slot\_ge, <player\_id>, <slot\_no>, <value>),
### Network communication operations

send\_message\_to\_url = 380

(send\_message\_to\_url, <string\_id>, <encode\_url>),
Sends an HTTP request. Response from that URL will be returned to "script\_game\_receive\_url\_response". Parameter <encode\_url> is optional and effects are unclear. Supposedly it's equivalent of calling (str\_encode\_url) on the first parameter which doesn't make sense for me.
multiplayer\_send\_message\_to\_server = 388

(multiplayer\_send\_message\_to\_server, <message\_type>),
Multiplayer client operation. Send a simple message (only message code, no data) to game server.
multiplayer\_send\_int\_to\_server = 389

(multiplayer\_send\_int\_to\_server, <message\_type>, <value>),
Multiplayer client operation. Send a message with a single extra integer value to game server.
multiplayer\_send\_2\_int\_to\_server = 390

(multiplayer\_send\_2\_int\_to\_server, <message\_type>, <value>, <value>),
Same as (multiplayer\_send\_int\_to\_server), but two integer values are sent.
multiplayer\_send\_3\_int\_to\_server = 391

(multiplayer\_send\_3\_int\_to\_server, <message\_type>, <value>, <value>, <value>),
Same as (multiplayer\_send\_int\_to\_server), but three integer values are sent.
multiplayer\_send\_4\_int\_to\_server = 392

(multiplayer\_send\_4\_int\_to\_server, <message\_type>, <value>, <value>, <value>, <value>),
Same as (multiplayer\_send\_int\_to\_server), but four integer values are sent.
multiplayer\_send\_string\_to\_server = 393

(multiplayer\_send\_string\_to\_server, <message\_type>, <string\_id>),
Multiplayer client operation. Send a message with a string value to game server.
<message\_type> parameter must be between 0 and 127 or it will be truncated. In the case of Native they can be found on header\_common.py as client and server events.

These are handled in script\_game\_receive\_network\_message and are used for server events. As for strings, the input is s0 (in the script).

The other 6 operations (multiplayer\_send\_\*\_to\_player) have the same functionality but are called on the server and send the message to the player referenced by <player\_id>. Also handled by script\_game\_receive\_network\_message.

multiplayer\_send\_message\_to\_player = 394

(multiplayer\_send\_message\_to\_player, <player\_id>, <message\_type>),
Multiplayer server operation. Send a simple message (only message code, no data) to one of connected players.
multiplayer\_send\_int\_to\_player = 395

(multiplayer\_send\_int\_to\_player, <player\_id>, <message\_type>, <value>),
Multiplayer server operation. Send a message with a single extra integer value to one of connected players.
multiplayer\_send\_2\_int\_to\_player = 396

(multiplayer\_send\_2\_int\_to\_player, <player\_id>, <message\_type>, <value>, <value>),
Same as (multiplayer\_send\_int\_to\_player), but two integer values are sent.
multiplayer\_send\_3\_int\_to\_player = 397

(multiplayer\_send\_3\_int\_to\_player, <player\_id>, <message\_type>, <value>, <value>, <value>),
Same as (multiplayer\_send\_int\_to\_player), but three integer values are sent.
multiplayer\_send\_4\_int\_to\_player = 398

(multiplayer\_send\_4\_int\_to\_player, <player\_id>, <message\_type>, <value>, <value>, <value>, <value>),
Same as (multiplayer\_send\_int\_to\_player), but four integer values are sent.
multiplayer\_send\_string\_to\_player = 399

(multiplayer\_send\_string\_to\_player, <player\_id>, <message\_type>, <string\_id>),
Multiplayer server operation. Send a message with a string value to one of connected players.
### Player handling operations

get\_max\_players = 400

(get\_max\_players, <destination>),
Returns maximum possible number of connected players. Apparently always returns a constant value, however it's return value can change as maximum increases with new patches.
player\_get\_team\_no = 402

(player\_get\_team\_no, <destination>, <player\_id>),
Retrieves the team that the player belongs to.
player\_set\_team\_no = 403

(player\_set\_team\_no, <player\_id>, <team\_id>),
Assigns a player to the specified team.
player\_get\_troop\_id = 404

(player\_get\_troop\_id, <destination>, <player\_id>),
Retrieves player's selected troop reference.
player\_set\_troop\_id = 405

(player\_set\_troop\_id, <player\_id>, <troop\_id>),
Assigns the selected troop reference to a player.
player\_get\_agent\_id = 406

(player\_get\_agent\_id, <destination>, <player\_id>),
Retrieves player's current agent reference. Returns a negative value if player has no agent.
agent\_get\_player\_id = 1724

(agent\_get\_player\_id, <destination>, <agent\_id>),
Retrieves player reference that is currently controlling the specified agent.
player\_get\_gold = 407

(player\_get\_gold, <destination>, <player\_id>),
Retrieves player's current gold amount.
player\_set\_gold = 408

(player\_set\_gold, <player\_id>, <value>, <max\_value>),
Sets player's new gold amount and maximum allowed gold amount. Use 0 for <max\_value> to remove gold limit.
player\_spawn\_new\_agent = 409

(player\_spawn\_new\_agent, <player\_id>, <entry\_point>),
Spawns a new agent for the specified player. Essentially a combination of (spawn\_agent) and (player\_control\_agent) operations.
player\_add\_spawn\_item = 410

(player\_add\_spawn\_item, <player\_id>, <item\_slot\_no>, <item\_id>),
Adds the specified item to the specified player. Will take effect after the next player\_spawn\_new\_agent. Available item slots are: ek\_item\_0, ek\_item\_1, ek\_item\_2, ek\_item\_3, ek\_head, ek\_body, ek\_foot, ek\_gloves, ek\_horse. Unsure if ek\_food is used in multiplayer; Taken from header\_items.py
multiplayer\_get\_my\_team = 411

(multiplayer\_get\_my\_team, <destination>),
Client operation. Retrieves player's currently selected team.
multiplayer\_get\_my\_troop = 412

(multiplayer\_get\_my\_troop, <destination>),
Client operation. Retrieves player's currently selected troop.
multiplayer\_set\_my\_troop = 413

(multiplayer\_set\_my\_troop, <destination>),
Client operation. Selects a new troop for the player.
multiplayer\_get\_my\_gold = 414

(multiplayer\_get\_my\_gold, <destination>),
Client operation. Retrieves current player's gold amount.
multiplayer\_get\_my\_player = 415

(multiplayer\_get\_my\_player, <destination>),
Client operation. Retrieves current player's player\_id reference.
multiplayer\_make\_everyone\_enemy = 420

(multiplayer\_make\_everyone\_enemy),
Used in deathmatch mode to make everyone hostile to all other agents.
player\_control\_agent = 421

(player\_control\_agent, <player\_id>, <agent\_id>),
Server operation. Puts the agent under specified player's control. Operation will change agent's face code and banner to those of player.
player\_get\_item\_id = 422

(player\_get\_item\_id, <destination>, <player\_id>, <item\_slot\_no>),
Server operation. Retrieves item that's currently equipped by specified player in <item\_slot\_no> equipment slot.
player\_get\_banner\_id = 423

(player\_get\_banner\_id, <destination>, <player\_id>),
Server operation. Retrieves banner\_id reference used by the specified player. Note that in MP banners are enumerated starting from 0 (unlike single-player where they're enumeration depends on scene prop banners' reference range).
player\_set\_is\_admin = 429

(player\_set\_is\_admin, <player\_id>, <value>),
Server operation. Set the current player as admin (value = 1) or not (value = 0).
player\_get\_score = 431

(player\_get\_score, <destination>, <player\_id>),

player\_set\_score = 432

(player\_set\_score, <player\_id>, <value>),

player\_get\_kill\_count = 433

(player\_get\_kill\_count, <destination>, <player\_id>),

player\_set\_kill\_count = 434

(player\_set\_kill\_count, <player\_id>, <value>),

player\_get\_death\_count = 435

(player\_get\_death\_count, <destination>, <player\_id>),

player\_set\_death\_count = 436

(player\_set\_death\_count, <player\_id>, <value>),

player\_get\_ping = 437

(player\_get\_ping, <destination>, <player\_id>),

player\_get\_is\_muted = 439

(player\_get\_is\_muted, <destination>, <player\_id>),
Sets if a player gets muted (1) or unmuted (0). mute\_for\_everyone is an optional parameter and should be set to 1 if player is muted for everyone (this works only on server).
player\_set\_is\_muted = 440

(player\_set\_is\_muted, <player\_id>, <value>, [mute\_for\_everyone]),
Sets if a player gets muted (1) or unmuted (0). mute\_for\_everyone is an optional parameter and should be set to 1 if player is muted for everyone (this works only on server).
player\_get\_unique\_id = 441

(player\_get\_unique\_id, <destination>, <player\_id>),:can only bew used on server side
Server operation. Retrieves player's unique identifier which is determined by player's game license code. This number is supposed to be unique for each license, allowing reliable player identification across servers.
player\_get\_gender = 442

(player\_get\_gender, <destination>, <player\_id>),
Gets the current player gender/skin, in Native 0 for the male and 1 for the female skin. Take note that Native can only process two genders/skins in multiplayer.
player\_save\_picked\_up\_items\_for\_next\_spawn = 459

(player\_save\_picked\_up\_items\_for\_next\_spawn, <player\_id>),

player\_get\_value\_of\_original\_items = 460

(player\_get\_value\_of\_original\_items, <player\_id>),
Undocumented. Official docs: this operation returns values of the items, but default troop items will be counted as zero (except horse)
profile\_get\_banner\_id = 350

(profile\_get\_banner\_id, <destination>),
Client operation. Retrieves banner\_id reference used by the game for multiplayer. Note that in MP banners are enumerated starting from 0 (unlike single-player where they're enumeration depends on scene prop banners' reference range).
profile\_set\_banner\_id = 351

(profile\_set\_banner\_id, <value>),
Client operation. Assigns a new banner\_id to be used for multiplayer. Note that in MP banners are enumerated starting from 0 (unlike single-player where they're enumeration depends on scene prop banners' reference range).
### Team handling operations

team\_get\_bot\_kill\_count = 450

(team\_get\_bot\_kill\_count, <destination>, <team\_id>),

team\_set\_bot\_kill\_count = 451

(team\_get\_bot\_kill\_count, <destination>, <team\_id>),

team\_get\_bot\_death\_count = 452

(team\_get\_bot\_death\_count, <destination>, <team\_id>),

team\_set\_bot\_death\_count = 453

(team\_get\_bot\_death\_count, <destination>, <team\_id>),

team\_get\_kill\_count = 454

(team\_get\_kill\_count, <destination>, <team\_id>),

team\_get\_score = 455

(team\_get\_score, <destination>, <team\_id>),

team\_set\_score = 456

(team\_set\_score, <team\_id>, <value>),

team\_set\_faction = 457

(team\_set\_faction, <team\_id>, <faction\_id>),

team\_get\_faction = 458

(team\_get\_faction, <destination>, <team\_id>),

### General scene and mission handling operations

multiplayer\_clear\_scene = 416

(multiplayer\_clear\_scene),

multiplayer\_find\_spawn\_point = 425

(multiplayer\_find\_spawn\_point, <destination>, <team\_no>, <examine\_all\_spawn\_points>, <is\_horseman>),

set\_spawn\_effector\_scene\_prop\_kind, set\_spawn\_effector\_scene\_prop\_id - this two are used in capture the flag and similar game modes to make players of a certain team tend to spawn nearer to those scene props

set\_spawn\_effector\_scene\_prop\_kind = 426

(set\_spawn\_effector\_scene\_prop\_kind, <team\_no>, <scene\_prop\_kind\_no>),
Specifies some scene prop kind as one of the teams' spawn effector, making players of that team more likely to spawn closer to the specified effector prop instances. Use -1 to disable spawn effector for a team.
set\_spawn\_effector\_scene\_prop\_id = 427

(set\_spawn\_effector\_scene\_prop\_id, <team\_no>, <scene\_prop\_id>),
Specifies a single prop instance as a team's spawn effector. Different from (set\_spawn\_effector\_scene\_prop\_kind) as other instances of the same scene prop will not affect player spawning.
start\_multiplayer\_mission = 470

(start\_multiplayer\_mission, <mission\_template\_id>, <scene\_id>, <started\_manually>),

### Administrative operations and settings

kick\_player = 465

(kick\_player, <player\_id>),

ban\_player = 466

(ban\_player, <player\_id>, <value>, <player\_id>),
Official docs: set value = 1 for banning temporarily, assign 2nd player id as the administrator player id if banning is permanent
Those values are saved into a text file
save\_ban\_info\_of\_player = 467

(save\_ban\_info\_of\_player, <player\_id>),

ban\_player\_using\_saved\_ban\_info = 468

(ban\_player\_using\_saved\_ban\_info),

server\_add\_message\_to\_log = 473

(server\_add\_message\_to\_log, <string\_id>),

server\_get\_renaming\_server\_allowed, server\_get\_changing\_game\_type\_allowed - both of these get the values for dedicated servers which have commands to run on the console to (dis)allowing them

server\_get\_renaming\_server\_allowed = 475

(server\_get\_renaming\_server\_allowed, <destination>),
Official docs: 0-1
server\_get\_changing\_game\_type\_allowed = 476

(server\_get\_changing\_game\_type\_allowed, <destination>),
Official docs: 0-1
server\_get\_combat\_speed = 478

(server\_get\_combat\_speed, <destination>),
Official docs: 0-2
server\_set\_combat\_speed = 479

(server\_set\_combat\_speed, <value>),
Official docs: 0-2
Unofficial: <value> is actually 0-4, going from slowest to fastest, you can see it's used in module\_presentations from 0 to 4
server\_get\_friendly\_fire = 480

(server\_get\_friendly\_fire, <destination>),
Gets if friendly fire is enabled (1) or not (0).
server\_set\_friendly\_fire = 481

(server\_set\_friendly\_fire, <value>),
Official docs: 0 = off, 1 = on
server\_get\_control\_block\_dir = 482

(server\_get\_control\_block\_dir, <destination>),
Gets if control block direction at the server are 'automatic' (0) or 'by mouse movement' (1).
server\_set\_control\_block\_dir = 483

(server\_set\_control\_block\_dir, <value>),
Official docs: 0 = automatic, 1 = by mouse movement
server\_set\_password = 484

(server\_set\_password, <string\_id>),

server\_get\_add\_to\_game\_servers\_list = 485

(server\_get\_add\_to\_game\_servers\_list, <destination>),
Gets if server is added to game servers list (1) or not (0).
server\_set\_add\_to\_game\_servers\_list = 486

(server\_set\_add\_to\_game\_servers\_list, <value>),
Sets if server is added to game servers list (1) or not (0).
server\_get\_ghost\_mode = 487

(server\_get\_ghost\_mode, <destination>),
Gets if dead players are allowed to move their camera freely (0), sticked to any player (1), sticked to team members (2), sticked to team members' view (3).
server\_set\_ghost\_mode = 488

(server\_set\_ghost\_mode, <value>),
Sets if dead players are allowed to move their camera freely (0), sticked to any player (1), sticked to team members (2), sticked to team members' view (3).
server\_set\_name = 489

(server\_set\_name, <string\_id>),

server\_get\_max\_num\_players = 490

(server\_get\_max\_num\_players, <destination>),

server\_set\_max\_num\_players = 491

(server\_set\_max\_num\_players, <value>),

server\_set\_welcome\_message = 492

(server\_set\_welcome\_message, <string\_id>),

server\_get\_melee\_friendly\_fire = 493

(server\_get\_melee\_friendly\_fire, <destination>),
Gets if melee friendly fire is enabled (1) or not (0).
server\_set\_melee\_friendly\_fire = 494

(server\_set\_melee\_friendly\_fire, <value>),
Official docs: 0 = off, 1 = on
server\_get\_friendly\_fire\_damage\_self\_ratio = 495

(server\_get\_friendly\_fire\_damage\_self\_ratio, <destination>),
Gets the percentage of damage received by self when player hits a friend (0-100).
server\_set\_friendly\_fire\_damage\_self\_ratio = 496

(server\_set\_friendly\_fire\_damage\_self\_ratio, <value>),
Official docs: 0-100
Sets the percentage of damage received by self when player hits a friend (0-100).
server\_get\_friendly\_fire\_damage\_friend\_ratio = 497

(server\_get\_friendly\_fire\_damage\_friend\_ratio, <destination>),
Gets the percentage of damage received by friend when player hits a friend (0-100).
server\_set\_friendly\_fire\_damage\_friend\_ratio = 498

(server\_set\_friendly\_fire\_damage\_friend\_ratio, <value>),
Sets the percentage of damage received by friend when player hits a friend (0-100).
server\_get\_anti\_cheat = 499

(server\_get\_anti\_cheat, <destination>),
Gets if valve anti cheat is enabled (1) or not (0).
server\_set\_anti\_cheat = 477

(server\_set\_anti\_cheat, <value>),
Sets if valve anti cheat is enabled (1) or not (0).
## Remaining esoteric stuff (no idea what it does)

Honestly, I have no idea what these functions could be used for. If you know, please let me know ASAP!:-)

set\_physics\_delta\_time = 58

(set\_physics\_delta\_time, <fixed\_value>),:Default is 0.025 (40 fps).
set\_tooltip\_text = 1130

(set\_tooltip\_text, <string\_id>),
Assigns the output text for the selected item?
ai\_mesh\_face\_group\_show\_hide = 1805

(ai\_mesh\_face\_group\_show\_hide, <group\_no>, <value>),: 1 for enable, 0 for disable
Debug -- Draws the selected index of triangles/quads from the navigation graph on-screen.
auto\_set\_meta\_mission\_at\_end\_commited = 1305

(auto\_set\_meta\_mission\_at\_end\_commited),
Returns the mission as successful by the game. Used in campaign.