Skyrim Mod:Mod File Format/CTDA Field
A UESPWiki – Sua fonte de The Elder Scrolls desde 1995
CTDA fields are widely used in Skyrim records to provide conditions that must be met. The format is similar to that used in Oblivion records, although there are more function indices.
In Skyrim.esm, the following types have CTDA fields: ALCH, COBJ, CPTH, ENCH, FACT, IDLE, INFO, LSCR, MESG, MGEF, MUST, PACK, PERK, QUST, SCEN, SCRL, SMBN, SMQN, SNDR, SPEL.
Related Fields
CTDA fields are often accompanied by several fields.
- CITC (uint32) is sometimes used as a 'Condition Item Count', or a count of CTDA fields. Only certain specific cases make use of a CITC field — but in those cases, the CITC field is required, even if there are no CTDA fields (in which case CITC is 0). Therefore, occurrences of CITC fields correlate poorly with occurrences of CTDA fields.
- CIS1 (zstring) variable name, trails CTDA that uses it, replaces 1st argument in function call (value for param1 is very high, unknown if significant or arbitrary)
- CIS2 (zstring) variable name, trails CTDA that uses it, replaces 2nd argument in function call (value for param2 is very high, unknown if significant or arbitrary)
Field Layout
The condition is assembled into a statement of the format:
<Reference>.<Function>(<Param1>, <Param2>) <Operator> <Value>
For example,
PlayerRef.GetDistance(MQ304AlduinHideInMistSouthMarker) > 6500
(Where formids have been translated into EditorIDs to make the statement more intelligible)
Name | Type/Size | Info |
---|---|---|
operator | uint8 | Condition type where the upper 3 bits contain the compare operator and the lower 5 bits contain flags.
|
unknown | uint8[3] | Unused data? |
ComparisonValue | formid/float | Value against which the function result is compared or a GLOB formid if the UseGlobal flag is set |
FunctionIndex | uint16 | Function index. See Functions for a list of function indices. Most of the Oblivion indices are still valid, but hundreds of new functions have been added. The value in this field is the index given on the above page, minus 4096. |
padding | uint8[2] | Padding (may be non-zero, but the bytes are unused) |
All Functions Except GetEventData | ||
param1 | formID/int32 | First parameter. This can be a number or a Form ID depending on the function; zero if no parameters needed. Note that if param1 is a string type then there will be a CIS1 subrecord following the CTDA with the string. |
param2 | formID/int32 | Second parameter. This can be a number of a Form ID depending on the function; zero if second parameter is not needed. Note that if param2 is a string type then there will be a CIS2 subrecord following the CTDA with the string. |
GetEventData | ||
param1 | uint16 | Event Function. (Enumeration - specifics still need to be documented.) |
param2 | char[2] | Event Member. (See below.) |
param3 | formID | Third parameter. |
RunOnType | uint32 | How to apply the condition
|
reference | formID | Function reference. For example, if the function is "isDead", the function is applied to the object in the function reference. Zero if no reference needed. |
unknown | int32 | Always -1. |
Event Member
Codes for each event member depend on the event type. Note that some event types are not used, but are present in the game code.
Event Type | Code | Value |
---|---|---|
Actor Dialogue Event | L1 | Location |
R1 | Actor 1 | |
R2 | Actor 2 | |
Actor Hello Event | L1 | Location |
R1 | Actor 1 | |
R2 | Actor 2 | |
Arrest Event | R1 | ArestingGuard [sic] |
R2 | Criminal | |
L1 | Location | |
V1 | iCrimeType | |
Assault Actor Event | R1 | Victim |
R2 | Attacker | |
L1 | Location | |
V1 | Crime | |
Bribe | R1 | Actor |
V1 | Gold Value | |
Cast Magic Event | R1 | CastingActor |
R2 | SpellTarget | |
L1 | Location | |
F1 | SpellForm | |
Change Location Event | R1 | Actor |
L1 | Old Location | |
L2 | New Location | |
Change Relationship Rank | R1 | NPC 1 |
R2 | NPC 2 | |
V1 | Old Relationship | |
V2 | New Relationship | |
Craft Item | R1 | Workbench |
L1 | BenchLocation | |
O1 | CreatedObject | |
Crime Gold Event | R1 | Victim |
R2 | Criminal | |
F1 | Crime Faction | |
V1 | Gold Value | |
V2 | iCrimeType | |
Dead Body | R1 | Actor |
R2 | Dead Actor | |
L1 | Location | |
Escape Jail | L1 | Location |
F1 | pCrimeGroup | |
Flatter | R1 | Actor |
Increase Level | V1 | New Level |
Intimidate | R1 | Actor |
Jail Event | R1 | hGuard |
F1 | pCrimeGroup | |
L1 | Location | |
V1 | Crime Gold | |
Kill Actor Event | R1 | Victim |
R2 | Killer | |
L1 | Location | |
V1 | Crime Status | |
V2 | Relationship Rank to Killer before Death | |
Lock Pick | R1 | Actor |
R2 | Lock Object | |
New Voice Power | R1 | Actor |
F1 | Voice Power | |
Pay Fine Event | R1 | hCriminal |
R2 | hGuard | |
F1 | pCrimeGroup | |
V1 | Crime Gold | |
Player Activate Actor | L1 | Location |
R1 | Actor (one extra space is present after name) | |
Player Add Item | R1 | OwnerRef |
R2 | OriginalContainer | |
L1 | Location | |
F1 | ObjectForm | |
V1 | AquireType [sic] | |
Player Cured | F1 | Infection |
Player Infected | R1 | Transmitting Actor |
F1 | Infection | |
Player Recieves [sic] Favor | R1 | Actor |
Player Remove Item | R1 | OwnerRef |
R2 | ItemRef | |
L1 | Location | |
F1 | ObjectForm | |
V1 | RemoveType | |
Quest Start | Q1 | Quest |
Script Event | K1 | Keyword |
L1 | Location | |
R1 | Ref 1 | |
R2 | Ref 2 | |
V1 | Value 1 | |
V2 | Value 2 | |
Served Time | L1 | Location |
F1 | pCrimeGroup | |
V1 | Crime Gold | |
V2 | Days Jail | |
Skill Increase | V1 | Skill |
Trespass Actor Event | R1 | Victim |
R2 | Trespasser | |
L1 | Location | |
V1 | Crime |
Notes
-
- See this forum post for some good details on this subrecord.