Payload String Constructor
When constructing mission definitions from a string, a particularly fiddly point is assembling the payload strings for mission rewards. The payload table contains utility functions that should hopefully make this process a bit easier.
The various functions provided in the payload table can each be called with the minimum of vital data. Each will return a string which can be plugged in to mission_manager:add_payload
(or equivalent functions) to specify that the mission should deliver that reward.
The payload table also provides a basic remapping feature. This is useful for when a particular faction doesn't take a particular reward (usually money) but another reward in its place (e.g. a race-specific currency like daemonic glory). Rather than having to manually override each mission record for a particular faction which would be time-consuming and error-prone, data is provided which a remapping function can use to replace the mission rewards with something more appropriate.
Example:
local mm = mission_manager:new(faction_key, mission_key);
mm:add_new_objective("SEARCH_RUINS");
mm:add_condition("total 1");
mm:add_payload(payload.money(500));
Loaded in Campaign | |
Loaded in Battle | |
Loaded in Frontend |
-
payload.add_money_equivalence_mapping(
faction keystring
,
remapping callbackfunction
)
-
Adds a payload remapping for a particular faction, for money. Once this remapping is established, payloads for this faction set up with
payload.money
will instead be replaced with an alternative. The alternative is determined by the callback that is supplied to this function.
When a money payload is requested, the callback will be called and supplied three arguments - the amount of money to add, the faction key, and a table of arbitrary parameters supplied topayload.money
that can be used to determine the equivalent payload. What goes in to this table of arbitrary parameters can be decided by the implementer, but what is added to each mission specification should match what the callback looks for.Parameters:
1
faction key
2
remapping callback
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 1994
-
payload.add_ancillary_equivalence_mapping(
faction keystring
,
remapping callbackfunction
)
-
Adds a payload remapping for a particular faction, for ancillary payloads. Once this remapping is established, payloads for this faction set up with
payload.ancillary_mission_payload
will instead be replaced with an alternative. The alternative is determined by the callback that is supplied to this function.
When an ancillary payload is requested, the callback will be called and supplied three arguments - the faction key, the ancillary categorystring
, and the ancillary raritystring
.Parameters:
1
faction key
2
remapping callback
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2012
-
payload.money_direct(
amountnumber
)
-
Returns a payload string which defines a money reward for a string mission definition. No money-equivalence is looked up when this function is called - use
payload.money
to return a money-equivalent reward when appropriate.Parameters:
1
amount
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2037
-
payload.money(
amountnumber
,
faction keystring
,
equivalence parameterstable
)
-
Returns a payload string which defines a money reward (or equivalent) for a string mission definition. When this function is called, a money-equivalence mapping is looking up based on the supplied faction key. If one was previously added with
payload.add_money_equivalence_mapping
then the mapping callback that was supplied to that function is called, and the returned result of that callback is returned by this function. If no remapping for this faction is found, then a money payload string is returned.Parameters:
1
amount
2
faction key
3
equivalence parameters
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2050
-
payload.text_display(
text keystring
)
-
Returns a payload string which defines a text override for the payload description. If a text override is specified, the mission panel will display that message as the mission reward instead of trying to generate one itself. This is useful in certain circumstances, such as if completing the mission brings some custom scripted reward that the game does not natively support.
Parameters:
1
Key of text to display, from the
campaign_payloads_ui_details
database table.Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2079
-
payload.agent(
spawn regionstring
,
agent typestring
,
agent subtypestring
, [
action pointsnumber
])
-
Returns a payload string which defines an agent reward for a string mission definition. No kind of equivalence is looked up.
Parameters:
1
Key of region in which to spawn the agent, from the
regions
database table.2
Agent type key, from the
agents
database table.3
Agent subtype key, from the
agent_subtypes
database table.4
optional, default value=100
Percentage of action points that the spawned agent should start with. By default the agent starts with 100% action points.
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2106
-
payload.agent_at_faction_leader(
agent typestring
,
agent subtypestring
, [
action pointsnumber
])
-
Returns a payload string which defines an agent reward that is created at the event's faction leader for a string mission definition. No kind of equivalence is looked up.
Parameters:
1
Agent type key, from the
agents
database table.2
Agent subtype key, from the
agent_subtypes
database table.3
optional, default value=100
Percentage of action points that the spawned agent should start with. By default the agent starts with 100% action points.
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2144
-
payload.agent_for_faction(
faction key
string
,
agent type
string
,
agent subtype
[string
],
action points
[number
]
) -
Returns a payload string which defines an agent reward for a string mission definition, for a faction. This differs from
payload.agent
in that this function takes a faction key, and looks up the home region of that faction. If the faction has no home region, then a script error is thrown and money is substituted.Parameters:
1
Key of faction for which the agent is being spawned, from the
factions
table. This is used to specify the region in which the agent is spawned - the home region of the faction is used.2
Agent type key, from the
agents
database table.3
optional, default value=nil
Agent subtype key, from the
agent_subtypes
database table.4
optional, default value=100
Percentage of action points that the spawned agent should start with. By default the agent starts with 100% action points.
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2177
-
payload.ancillary_mission_payload(
faction key
string
,
ancillary category
[string
],
ancillary rarity
[string
]
) -
Returns a mission reward string that adds the specified ancillary to the faction pool when the mission being constructed is completed.
Parameters:
1
Faction key, from the
factions
database table.2
optional, default value=nil
Ancillary category. Valid values are presently
"armour"
,"enchanted_item"
>,"banner"
>,"talisman"
>,"weapon"
and"arcane_item"
. Arcane items may only be equipped by spellcasters.3
optional, default value=nil
Ancillary rarity. Valid values are presently
"common"
,"uncommon"
and"rare"
.Returns:
ancillary
mission reward string
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2217
-
payload.ancillary_mission_payload_specific(
faction keystring
)
-
Returns a mission reward string that adds the specified ancillary to the faction pool when the mission being constructed is completed.
Parameters:
1
Faction key, from the
factions
database table.Returns:
ancillary
mission reward string
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2248
-
payload.pooled_resource_mission_payload(
pooled resource keystring
,
factor keystring
,
quantitynumber
)
-
Returns a mission reward string that adds the specified quantity of the specified pooled resource with the specified factor when the mission being constructed is completed.
Parameters:
1
Pooled resource key, from the
pooled_resources
database table.2
Factor key, from the
factor
field in thepooled_resource_factor_junctions
database table.3
Quantity of pooled resource to award.
Returns:
pooled resource mission reward stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2280
-
payload.khorne_glory(
amountnumber
)
-
Returns a payload string which defines a Khorne glory reward for a Daemons of Chaos string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2291
-
payload.nurgle_glory(
amountnumber
)
-
Returns a payload string which defines a Nurgle glory reward for a Daemons of Chaos string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2304
-
payload.slaanesh_glory(
amountnumber
)
-
Returns a payload string which defines a Slaanesh glory reward for a Daemons of Chaos string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2317
-
payload.tzeentch_glory(
amountnumber
)
-
Returns a payload string which defines a Tzeentch glory reward for a Daemons of Chaos string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2330
-
payload.undivided_glory(
amountnumber
)
-
Returns a payload string which defines an Undivided glory reward for a Daemons of Chaos string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2343
-
payload.skulls(
amountnumber
)
-
Returns a payload string which defines a Skulls reward for a Khorne string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2356
-
payload.infections(
amountnumber
)
-
Returns a payload string which defines an Infections reward for a Nurgle string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2369
-
payload.devotees(
amountnumber
)
-
Returns a payload string which defines a Devotees reward for a Slaanesh string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2382
-
payload.grimoires(
amountnumber
)
-
Returns a payload string which defines a Grimoires reward for a Tzeentch string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2395
-
payload.devotion(
amountnumber
)
-
Returns a payload string which defines a Devotion reward for a Kislev string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2408
-
payload.supporters(
amountnumber
)
-
Returns a payload string which defines a Supporters reward for a Kislev string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2421
-
payload.meat(
amountnumber
)
-
Returns a payload string which defines a Meat reward for an Ogre Kingdoms string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2434
-
payload.chivalry(
amountnumber
)
-
Returns a payload string which defines a Chivalry reward for a Bretonnia string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2447
-
payload.slaves(
amountnumber
)
-
Returns a payload string which defines a Slaves reward for a Dark Elf string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2460
-
payload.infamy(
amountnumber
)
-
Returns a payload string which defines a infamy reward for a Vampire Coast string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2473
-
payload.souls(
amountnumber
)
-
Returns a payload string which defines a souls reward for a Warriors of Chaos string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2486
-
payload.canopic(
amountnumber
)
-
Returns a payload string which defines a canopic_jars reward for a Tomb Kings string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2499
-
payload.spirit(
amountnumber
)
-
Returns a payload string which defines a spirit_essence reward for a Mother Ostankya (Kislev) string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2512
-
payload.mercenary_mission_payload(
unit keystring
,
quantitynumber
)
-
Returns a mission reward string that adds the specified quantity of the specified unit to the faction's mercenary pool when the mission being constructed is completed. This would only have an effect for faction's that feature a mercenary pool.
Parameters:
1
Unit key, from the
main_units
database table.2
Quantity of units to add.
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2537
-
payload.effect_bundle_mission_payload(
effect bundle keystring
,
turnsnumber
)
-
Returns a mission reward string that applies the specified effect bundle to the faction when the mission being constructed is completed. An optional duration in turns may be specified.
Parameters:
1
Effect bundle key, from the
effect_bundles
database table.2
Number of turns the effect should be applied for. If this is omitted
Returns:
nil
defined in ../../warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2559