Narrative Query Templates

The narrative_queries table contains a list of narrative query templates that campaign scripts can use to create narrative queries. See the page on narrative for an overview of the narrative event framework. See also the narrative_query documentation for detailed information about the narrative_query object interface.

Loaded in Campaign Loaded in Campaign
Loaded in Battle Loaded in Battle
Loaded in Frontend Loaded in Frontend
Back to top

Functionality

narrative_queries.savegame_value_exists(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive trigger message,
  [string
negative trigger message],
  string
value key,
  [function
additional condition]
)

Creates a narrative query that queries a value in the savegame, looked up by the supplied key, and acts upon the result. If the value exists then the positive trigger message(s) are fired, otherwise the negative trigger message(s) are fired, if any were supplied.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Positive trigger message to fire if the saved value exists. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Negative trigger message to fire if the saved value does not exist. This can be a single string or a table of strings if multiple messages are desired.

6

string

Key of value to look up from the savegame. This is passed to campaign_manager:get_saved_value to retrieve the value.

7

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 87

narrative_queries.narrative_event_has_triggered(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive trigger message,
  [string
negative trigger message],
  string
narrative event name,
  [boolean
pass on all],
  [function
additional condition]
)

Creates a narrative query that queries whether a narrative event with the supplied name for the supplied faction has triggered in this savegame, and acts upon the result. If the narrative event has triggered then the positive trigger message(s) are fired, otherwise the negative trigger message(s) are fired, if any were supplied.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Positive trigger message to fire if the saved value exists. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Negative trigger message to fire if the saved value does not exist. This can be a single string or a table of strings if multiple messages are desired.

6

string

Name of narrative event to query. This may also be a table of strings if multiple narrative events are to be queried.

7

boolean

optional, default value=false

Trigger the positive message if all specified narrative events have fired. If false or nil is supplied here then the positive message will be triggered if any of the specified narrative events have fired.

8

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 188

narrative_queries.advice_history(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
experienced message,
  [string
not experienced message],
  [table
any advice strings],
  [table
all advice strings],
  [table
any advice keys],
  [table
all advice keys],
  [function
additional condition]
)

Creates a narrative query that queries the player's advice history against a supplied set of advice strings and advice keys when triggered.
Up to four sets of data can be passed to the function, representing any advice strings, all advice strings, any advice keys and all advice keys. When the narrative query is triggered the data collections are checked in this order. Where they are present, their contents are checked and the advice-experienced message may be triggered.
If all four collections are checked and the advice-experienced message has not been triggered, then the advice-not-experienced message is triggered (if one has been supplied).
If triggered in multiplayer mode the narrative query always behaves as if the advice has been experienced, as the advice history will be different on different machines in a multiplayer game so it would not be safe to do otherwise.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Message to trigger if the player has experienced the supplied advice. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Message to trigger if the player has not experienced the supplied advice. This can be a single string or a table of strings if multiple messages are desired.

6

table

optional, default value=nil

Any advice strings table. When triggered, the narrative trigger will check the history of advice strings supplied in this table using the function common.get_advice_history_string_seen. If any advice strings in this table have been experienced by the local player then the advice-experienced message is triggered.

7

table

optional, default value=nil

All advice strings table. When triggered, the narrative trigger will check the history of all advice keys supplied in this table using the function common.get_advice_history_string_seen. If all advice strings in this table have been experienced by the local player then the advice-experienced message is triggered.

8

table

optional, default value=nil

Any advice keys table. When triggered, the narrative trigger will check the history of advice keys supplied in this table using the function common.get_advice_thread_score. If any advice items represented by keys in this table have been experienced by the local player then the advice-experienced message is triggered.

9

table

optional, default value=nil

All advice keys table. When triggered, the narrative trigger will check the history of all advice keys supplied in this table using the function common.get_advice_thread_score. If all advice items represented by keys in this table have been experienced by the local player then the advice-experienced message is triggered.

10

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 328

narrative_queries.advice_history_for_narrative_chain(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
experienced message,
  [string
not experienced message],
  [table
all advice strings],
  [function
additional condition]
)

Creates a narrative query that interrogates the player's advice history for a narrative chain. If all of the supplied set of advice keys or any of the supplied set of advice strings are in the advice history, or it's a multiplayer game, or the campaign difficulty is very hard or above, then the positive target message(s) are triggered. Otherwise, the negative target message(s) are triggered, if any have been supplied.
If triggered in multiplayer mode the narrative query always behaves as if the advice has been experienced, as the advice history will be different on different machines in a multiplayer game so it would not be safe to do otherwise.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Target message to trigger if the player has experienced the supplied advice. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Target message to trigger if the player has not experienced the supplied advice. This can be a single string or a table of strings if multiple messages are desired.

6

table

optional, default value=nil

All advice strings table. When triggered, the narrative trigger will check the history of advice strings supplied in this table using the function common.get_advice_history_string_seen. If all advice strings in this table have been experienced by the local player then the advice-experienced message is triggered.

7

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 356

narrative_queries.one_settlement_from_completing_province(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive message,
  [string
negative message],
  [function
additional condition]
)

Creates a narrative query that queries the specified faction's territorial holdings and acts upon the result. Should the faction be exactly one settlement away from complete control of any province the positive message(s) are fired. Otherwise, the negative message(s) are fired, if any were supplied.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Message to trigger if the faction is one settlement from completing a province. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Message to trigger if the faction is not one settlement from completing a province. This can be a single string or a table of strings if multiple messages are desired.

6

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 490

narrative_queries.controls_x_provinces(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive message,
  [string
negative message],
  number
provinces,
  [function
additional condition]
)

Creates a narrative query that queries the specified faction's territorial holdings and acts upon the result. Should the faction already fully control at least the supplied number of provinces then the positive message(s) are fired. Otherwise, the negative message(s) are fired, if any were supplied.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Message to trigger if the faction is one settlement from completing a province. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Message to trigger if the faction is not one settlement from completing a province. This can be a single string or a table of strings if multiple messages are desired.

6

number

Number of provinces the faction has to fully control for the positive message to be forced.

7

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 579

narrative_queries.highest_level_settlement_for_faction(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive message,
  [string
negative message],
  number
query level,
  [function
additional condition]
)

Creates a narrative query that queries the specified faction's highest-level settlement and acts on the result. Should the level of the highest-level settlement be equal to or greater than the supplied query level then the positive message(s) are fired. Otherwise, the negative message(s) are fired, if any were supplied.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Message to trigger if the faction has a settlement at or above the query level. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Message to trigger if the faction does not have a settlement at or above the query level. This can be a single string or a table of strings if multiple messages are desired.

6

number

Minimum level the highest-level settlement of the faction must be in order to trigger the positive result message(s).

7

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 673

narrative_queries.is_researching(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive message,
  [string
negative message],
  [function
additional condition]
)

Creates a narrative query that queries whether the specified faction is currently researching a technology and acts on the result.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Message to trigger if the faction is currently researching a technology. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Message to trigger if the faction is not currently researching a technology. This can be a single string or a table of strings if multiple messages are desired.

6

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 748

narrative_queries.has_available_technologies(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive message,
  [string
negative message],
  [function
additional condition]
)

Creates a narrative query that queries whether the specified faction currently has technologies available for research and acts on the result.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Message to trigger if the faction has technologies available. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Message to trigger if the faction does not have technologies available. This can be a single string or a table of strings if multiple messages are desired.

6

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 819

narrative_queries.has_income(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive message,
  [string
negative message],
  number
income,
  [function
additional condition]
)

Creates a narrative query that queries whether the specified faction currently has an income level above the specified amount and acts on the result.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Message to trigger if the faction has the required income. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Message to trigger if the faction does not have the required income. This can be a single string or a table of strings if multiple messages are desired.

6

number

Income amount.

7

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 894

narrative_queries.can_capture_territory(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive message,
  [string
negative message],
  [function
additional condition]
)

Creates a narrative query that queries whether the specified faction can capture territory, and acts on the result. If the faction cannot capture territory they are presumably a horde faction. If the faction can capture territory then the positive trigger message(s) are fired, otherwise the negative trigger message(s) are fired.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Message to trigger if the faction can capture territory. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Message to trigger if the faction cannot capture territory. This can be a single string or a table of strings if multiple messages are desired.

6

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 968

narrative_queries.can_recruit_any_hero(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive message,
  [string
negative message],
  [function
additional condition]
)

Creates a narrative query that queries whether the specified faction can recruit any hero and acts on the result. If the faction can recruit a hero then the positive trigger message(s) are fired, otherwise the negative trigger message(s) are fired.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Message to trigger if the faction can recruit a hero. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Message to trigger if the faction cannot recruit a hero. This can be a single string or a table of strings if multiple messages are desired.

6

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 1048

narrative_queries.can_recruit_hero_of_type(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive message,
  [string
negative message],
  [table
hero types],
  [function
additional condition]
)

Creates a narrative query that queries whether the specified faction can recruit a hero of the supplied list of types, and acts on the result. If the faction can recruit a hero then the positive trigger message(s) are fired, otherwise the negative trigger message(s) are fired.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Message to trigger if the faction can recruit a hero. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Message to trigger if the faction cannot recruit a hero. This can be a single string or a table of strings if multiple messages are desired.

6

table

optional, default value=nil

Indexed table of string hero types. If no table is supplied then all hero types are matched.

7

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 1066

narrative_queries.contains_any_hero(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive message,
  [string
negative message],
  [function
additional condition]
)

Creates a narrative query that queries whether the specified faction contains any hero, and acts on the result. If the faction contains any heroes then the positive trigger message(s) are fired, otherwise the negative trigger message(s) are fired.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Message to trigger if the faction can recruit a hero. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Message to trigger if the faction cannot recruit a hero. This can be a single string or a table of strings if multiple messages are desired.

6

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 1145

narrative_queries.contains_any_hero_of_type(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive message,
  [string
negative message],
  [table
hero types],
  [function
additional condition]
)

Creates a narrative query that queries whether the specified faction contains heroes of the specified type(s), and acts on the result. If the faction contains any matching heroes then the positive trigger message(s) are fired, otherwise the negative trigger message(s) are fired.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Message to trigger if the faction can recruit a hero. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Message to trigger if the faction cannot recruit a hero. This can be a single string or a table of strings if multiple messages are desired.

6

table

optional, default value=nil

Indexed table of string character types to test against. If the specified faction contains any heroes matching any of the supplied types then a positive result is returned.

7

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 1163

narrative_queries.corruption_in_adjacent_region(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive message,
  [string
negative message],
  [string
corruption key],
  [string
culture key],
  string
corruption type,
  number
threshold value,
  [function
additional condition]
)

Creates a narrative query that queries whether any regions adjacent to the specified faction contain corruption of the specified type equal to or above the supplied threshold, and acts on the result. If any adjacent region meets the corruption threshold then the positive trigger message(s) are fired, otherwise the negative trigger message(s) are fired.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Message to trigger if the faction can recruit a hero. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Message to trigger if the faction cannot recruit a hero. This can be a single string or a table of strings if multiple messages are desired.

6

string

optional, default value=nil

Message to trigger if the faction cannot recruit a hero. This can be a single string or a table of strings if multiple messages are desired.

7

string

optional, default value=nil

Culture key of region owner to exclude. If an eligible region has a faction owner with this culture, the region will not be included.

8

string

Corruption type, from the pooled_resources database table.

9

number

Threshold value which the corruption must meet or exceed in an adjacent region for the query to pass.

10

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 1266

narrative_queries.has_concocted_plagues(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive message,
  [string
negative message],
  [number
plagues],
  [function
additional condition]
)

Creates a narrative query that queries whether the specified faction has concocted a threshold number of Nurgle plagues, and acts on the result.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Message to trigger if the faction can capture territory. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Message to trigger if the faction cannot capture territory. This can be a single string or a table of strings if multiple messages are desired.

6

number

optional, default value=1

THreshold number of plagues.

7

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 1342

narrative_queries.has_non_aggression_pact(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive message,
  [string
negative message],
  [string
target faction],
  [string
target culture],
  [string
target subculture],
  [function
additional condition]
)

Creates a narrative query that queries whether the specified faction has a non-aggression pact. Zero or more faction keys, faction culture keys or faction subculture keys may be specified. Should the subject faction have a non-aggression pact with any of the specified factions/cultures/subcultures, or should they have a non-aggression pact with any faction if no filters are specified, then the query will return a positive result.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Message to trigger if the faction can capture territory. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Message to trigger if the faction cannot capture territory. This can be a single string or a table of strings if multiple messages are desired.

6

string

optional, default value=nil

Faction key of a target faction which the subject should have an agreement with, from the factions database table. A table of string faction keys may be specified if more than one target faction is desired. In this case, the query passes if an agreement exists with any of the target factions in the list.

7

string

optional, default value=nil

Culture key of a target faction which the subject should have an agreement with, from the cultures database table. A table of string culture keys may be specified if more than one target culture is desired. In this case, the query passes if an agreement exists with a faction of any of the target cultures in the list.

8

string

optional, default value=nil

Subculture key of a target faction which the subject should have an agreement with, from the cultures_subcultures database table. A table of string subculture keys may be specified if more than one target subculture is desired. In this case, the query passes if an agreement exists with a faction of any of the target subcultures in the list.

9

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 1511

narrative_queries.has_trade_agreement(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive message,
  [string
negative message],
  [string
target faction],
  [string
target culture],
  [string
target subculture],
  [function
additional condition]
)

Creates a narrative query that queries whether the specified faction has a trade agreement. Zero or more faction keys, faction culture keys or faction subculture keys may be specified. Should the subject faction have a trade agreement with any of the specified factions/cultures/subcultures, or should they have a trade agreement with any faction if no filters are specified, then the query will return a positive result.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Message to trigger if the faction can capture territory. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Message to trigger if the faction cannot capture territory. This can be a single string or a table of strings if multiple messages are desired.

6

string

optional, default value=nil

Faction key of a target faction which the subject should have an agreement with, from the factions database table. A table of string faction keys may be specified if more than one target faction is desired. In this case, the query passes if an agreement exists with any of the target factions in the list.

7

string

optional, default value=nil

Culture key of a target faction which the subject should have an agreement with, from the cultures database table. A table of string culture keys may be specified if more than one target culture is desired. In this case, the query passes if an agreement exists with a faction of any of the target cultures in the list.

8

string

optional, default value=nil

Subculture key of a target faction which the subject should have an agreement with, from the cultures_subcultures database table. A table of string subculture keys may be specified if more than one target subculture is desired. In this case, the query passes if an agreement exists with a faction of any of the target subcultures in the list.

9

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 1620

narrative_queries.has_defensive_alliance(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive message,
  [string
negative message],
  [string
target faction],
  [string
target culture],
  [string
target subculture],
  [function
additional condition]
)

Creates a narrative query that queries whether the specified faction has a defensive alliance. Zero or more faction keys, faction culture keys or faction subculture keys may be specified. Should the subject faction have a defensive alliance with any of the specified factions/cultures/subcultures, or should they have a defensive alliance with any faction if no filters are specified, then the query will return a positive result.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Message to trigger if the faction can capture territory. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Message to trigger if the faction cannot capture territory. This can be a single string or a table of strings if multiple messages are desired.

6

string

optional, default value=nil

Faction key of a target faction which the subject should have an agreement with, from the factions database table. A table of string faction keys may be specified if more than one target faction is desired. In this case, the query passes if an agreement exists with any of the target factions in the list.

7

string

optional, default value=nil

Culture key of a target faction which the subject should have an agreement with, from the cultures database table. A table of string culture keys may be specified if more than one target culture is desired. In this case, the query passes if an agreement exists with a faction of any of the target cultures in the list.

8

string

optional, default value=nil

Subculture key of a target faction which the subject should have an agreement with, from the cultures_subcultures database table. A table of string subculture keys may be specified if more than one target subculture is desired. In this case, the query passes if an agreement exists with a faction of any of the target subcultures in the list.

9

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 1729

narrative_queries.has_military_alliance(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive message,
  [string
negative message],
  [string
target faction],
  [string
target culture],
  [string
target subculture],
  [function
additional condition]
)

Creates a narrative query that queries whether the specified faction has a military alliance. Zero or more faction keys, faction culture keys or faction subculture keys may be specified. Should the subject faction have a military alliance with any of the specified factions/cultures/subcultures, or should they have a military alliance with any faction if no filters are specified, then the query will return a positive result.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Message to trigger if the faction can capture territory. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Message to trigger if the faction cannot capture territory. This can be a single string or a table of strings if multiple messages are desired.

6

string

optional, default value=nil

Faction key of a target faction which the subject should have an agreement with, from the factions database table. A table of string faction keys may be specified if more than one target faction is desired. In this case, the query passes if an agreement exists with any of the target factions in the list.

7

string

optional, default value=nil

Culture key of a target faction which the subject should have an agreement with, from the cultures database table. A table of string culture keys may be specified if more than one target culture is desired. In this case, the query passes if an agreement exists with a faction of any of the target cultures in the list.

8

string

optional, default value=nil

Subculture key of a target faction which the subject should have an agreement with, from the cultures_subcultures database table. A table of string subculture keys may be specified if more than one target subculture is desired. In this case, the query passes if an agreement exists with a faction of any of the target subcultures in the list.

9

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 1838

narrative_queries.has_pooled_resource(
  
string unique name,
  string
faction key,
  string
trigger message,
  string
positive message,
  [string
negative message],
  string
pooled resource key,
  number
threshold value,
  [function
additional condition]
)

Creates a narrative query that queries whether the value of one or more pooled resources for a specified faction is equal to or greater than a specified value. If more than one pooled resource is specified, then the query triggers its positive message if any of the pooled resources meet or exceed the threshold.

Parameters:

1

string

Unique name amongst other declared narrative queries.

2

string

Key of the faction to which this narrative query applies, from the factions database table.

3

string

Message on which this narrative query should trigger. If multiple trigger messages are required a table containing string message names can be supplied here instead.

4

string

Message to trigger if the faction can capture territory. This can be a single string or a table of strings if multiple messages are desired.

5

string

optional, default value=nil

Message to trigger if the faction cannot capture territory. This can be a single string or a table of strings if multiple messages are desired.

6

string

Pooled resource key, from the pooled resources database table. If more than one pooled resource is to be queried then a table of strings may be specified here.

7

number

Threshold value, which the pooled resource should meet or exceed for the positive message to be triggered.

8

function

optional, default value=nil

Additional condition function which can force a positive or negative result. If supplied, the function is called with the context and narrative query objects passed in as separate functions. If it returns true then a positive result is forced, if false then a negative result is forced. If it returns any other value then no result is forced.

The condition function may also return a string as a second return value, which will be used for output.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_query_templates.lua, line 1941

Last updated 12/08/2022 11:56:58