The traps.2da defines both builder-placed and player-settable traps.

Usage and Hardcoded Notes

The file defines traps - both the builder placed ones (ie attached to triggers, placeables and doors) and the player-settable ones (on item properties).

The line IDs are limited to 0 through 255 due to GFF and engine using BYTE sizing.

You only need lots of different trap types for user-created traps (ie item properties/recoverable from the ground).

For custom traps the player won't have access to you can set your own custom DC (or set via. SetTrapDisarmDC/SetTrapDetectDC script commands) in the toolset extending the use of this 2da if you have tons of trap types and difficulties you want to imagine, since you can script whatever effects of the trap and the trap won't need to ever be set by a player if it cannot be recovered.

To stop the problem of having an actual trap item recovered that is for your custom traps, the easiest method is instead of using SetTrapRecoverable or trying to remember all the hand-placed traps and setting it on the blueprint, simply have ResRef be blank (so no item will be spawned) or better yet some misc item called "Trap Parts" that can be sold or maybe used by crafting, or one of the trap crafting components, but otherwise can't be used to set a new trap.

Trap Item Properties

These two files define the item property relationship to traps.2da:

iprp_traps.2da - Trap Type subtype table. Main definition of what trap difficulties there are, linked to the columns in iprp_trapcost.2da below.

iprp_trapcost.2da - Trap Cost Table (actually hardcoded in game, so iprp_costtable.2da won't change it!). This defines the type of trap (eg Sonic, Spike) as rows, and then columns for the lookup of the difficulty.

The columns are in numerical order, so it doesn't look up the "Average" column but instead looks for the "Minor" column and adds on the subtype value stored in the item property (so you can add more past "Epic" but if you add "Wimpy" it won't be in a nice order).

Once the right column is found, it looks up the row for the cost table entry (eg Spike is row 1) and along in that column to the ID.

This ID is the row in traps.2da. So Spike → Average difficulty links to row ID 1 in traps.2da.

2da Columns

Column LabelExampleValid ValuesDescription and Notes
ID (Blank)170-254

Max Class is defined as 255 and is an unusable line.

Many of the default 0-40 lines have hardcoded features and it is not recommended to reuse these. See above.

LabelAverageFireTextHuman readable name unused by the engine or toolset.
TrapScriptNW_T1_FireAvgCScript ResRefThe trap script to fire.
SetDC25Positive Integer

This is the DC needed to set this trap with the skill Set Trap. Since usually this is done out of combat and take 20 can be used, any DC under 22 (20 + 1 necessary rank) can basically be considered an easy one!

DetectDCMod14Positive integer

The toolset should be using a value of 10 + this field for the detect DC, but new trigger blueprints and editing the trap on existing blueprints just use a detect DC of 10 (Minor Spike Trap DC).

When the game creates them via. DM commands, CreateTrapOnObject or CreateTrapAtLocation this is used as the Detect DC.

For traps placed using Set Trap skills, the game uses this value + the Set Trap skill ranks to alter the Detect DC.

DisarmDCMod26Positive integer

The toolset should be using a value of 10 + this field for the disarm DC, but new trigger blueprints and editing the trap on existing blueprints just use a disarm DC of 22 (Minor Spike Trap DC).

When the game creates them via. DM commands, CreateTrapOnObject or CreateTrapAtLocation this is used as the Disarm DC.

For traps placed using Set Trap skills, the game uses this value + the Set Trap skill ranks to alter the Disarm DC.

TrapName6863TLK reference

Toolset uses this to show what trap it is, and is used when examining a trap.

DM created traps use this to set the trap trigger object name as well.

ResRefNW_IT_TRAP018Item ResRef

The item to spawn if the trap is recovered from a trigger/placeable/door. This field can be blank (will raise a warning but otherwise just do nothing if recovery is attempted) or you can spawn any single object - such as trap parts or a "blank trap" or even one of a different kind.

See notes above about 2da line limits and the reuse of trap lines for custom non-player usable traps.

IconResRefiit_trap_004Texture ResRefOnly used when examining a trap loaded in the Examine popup. For the items these icons need to be set when creating the blueprint.
  • No labels