Atdm:campaign info

From The DarkMod Wiki
Jump to: navigation, search

The campaign info entity can be placed once in a mission to control the amount of inventory items and weapons that are carried over to the next mission in a campaign. It's possible to define more than one rule on such an entity, see below for a description of the spawnarg and their syntax.

Because it's possible to define many rules on one entity, it doesn't make much sense to place more than one atdm:campaign_info entity in your map.

The rules will be enforced after the "Mission Complete" event when the map is still active, i.e. it's "filtering" outgoing items. Each map can have its own campaign info entity to define its own set of rules.

Syntax

While weapons and "regular" items such as the lantern, keys or health potions are all located in the player's inventory, there are two different sets of spawnargs for defining the carry-over rules after Mission Complete.

For both types of spawnargs it's possible to define a "general" rule (which is applied to all difficulty levels) and optionally a difficulty-specific rule. If provided, the difficulty-specific rule will always override the general one. The difficulty-specific spawnargs have the same syntax as the general ones except for the diff_N prefix (with N being the difficulty level ranging from 0 to 2 - "Easy" is 0).

A limit value of -1 will always imply "no limit".

Note: when adding an atdm:campaign_info entity to your map, it will inherit a set of default spawnargs from the entityDef. These default values don't apply any limits to the player's inventory they're just there for easy reference when ticking the "Show inherited" checkbox in DarkRadiant's Entity Inspector, to save you some typing.

Weapon Limits

The general syntax is lie this:

"weapon_limit_WEAPONNAME" "X"

with WEAPONNAME being a placeholder for the actual weapon names. The weapon name is a unique identifier found on the weapon items and their ammo. The value "X" is an integer number defining the maximum amount of ammo that is allowed to be carried over to the next mission (for ammo-based weapons like the Water Arrow). For melee weapons without ammo (Shortsword, Blackjack) values greater than "1" won't make any difference and will be treated like a "1" (which is equivalent to "will be kept").

The "weapon_limit_X" spawnarg affects all difficulty levels, but it's possible to override that one by adding spawnargs with a "diff_N_" prefix, e.g. "diff_0_weapon_limit_waterarrow" which will trump the "weapon_limit_waterarrow" without prefix. (The "diff_0" prefix applies to Easy difficulty.)

A limit value of "-1" always means "no limit", e.g. there is no carry-over limit applied to this weapon.

Working examples for a few weapon limits are:

"weapon_limit_gasarrow"                        "1"	// Max. 1 gas arrow on all difficulties
"diff_0_weapon_limit_blackjack"                "0"	// "0" means: no blackjack on easy
"diff_0_weapon_limit_sword"                    "1"	// "1" means: the sword will be kept ("-1" works as well) on easy
"diff_0_weapon_limit_waterarrow"               "20"	// keep no more than 20 water arrows on easy
"diff_0_weapon_limit_firearrow"                "-1"	// "-1" means: no limit on easy

For quick reference, possible weapon IDs for vanilla TDM are (you can look them up in the tdm_weapon_....def files in the tdm_defs01.pk4):

shortsword
blackjack
broadhead
waterarrow
firearrow
ropearrow
gasarrow
mossarrow
noisemaker
unarmed (for completeness' sake)

Note: while "unarmed" is a valid weaponname it's not necessary or recommended to apply a limit to that one. I doubt that any desired effect could be achieved by applying any rules to this type.

Inventory Item Limits

Inventory item limits apply to all non-weapon items in the player's inventory. The rules defined by these spawnargs are referencing the items by their inventory name (the one defined by the "inv_name" spawnarg).

Each inventory item limit rule consists of two spawnargs carrying the same number.

"item_N"     "INV_NAME"
"limit_N"    "LIMIT"

Here, N is an index used by the game code to distinguish the various rules from each other. INV_NAME is the placeholder for the item's name, e.g. "Health Potion". LIMIT is an integer value which can either be "-1" (no limit) or any number between "0" and about 2 billion, e.g. "4".

The following example

"item_1"     "Breath Potion"
"limit_1"    "4"

will limit the amount of Breath Potions that are allowed to be taken to the next mission to a maximum of 4. This rule will apply to all difficulty levels (unless they're overridden, see below).

Like the weapon limits it's possible to override the general rule by providing a difficulty-specific rule, one with a diff_N_ prefix (with N ranging from 0 (easy) to 2 (hard)). Example:

// Keep max. 3 holy waters on all levels, but keep unlimited amount on easy (override)
"item_2"               "Holy Water"
"limit_2"              "3"
"diff_0_limit_2"       "-1"

Note 1: It's not necessary to specify "diff_0_item_2" spawnarg, it's enough to override the limit spawnarg only: diff_0_limit_2. Note 2: This rule example has the number 2 because I've been assuming there is a rule with number 1 already defined on the entity (the Breath Potion example above).