Tes5Mod:Mod File Format/REFR

REFR records are over 90% of all records.  They are simply references, but they are references to anything at any point in time (relatively speaking, whether triggered or otherwise), at any location in the game, doing something specified, or nothing.  They can have extra items, or extra flags attached to them to identify them as containers, important places/locations.

Though there are a lot of fields for modifying various aspects of different things, the only fields required are a NAME (this is the main object we are referring to) and DATA (locational information).

Record header flags:
:0x200 - Hidden From Local Map
:0x400 - Persistent Reference (? not shown in the CK)
:0x800 - Initially Disabled
:0x10000 - Is Full LOD
:0x2000000 - No AI Acquire
:0x10000000 - Reflected By Auto Water
:0x20000000 - Don't Havok Settle
:0x40000000 - not Respawns

{| class="wikitable" width="100%" 
! width="3%" | C
! width="3%" | V
! width="10%" | Field
! width="15%" | Name
! width="12%" | Type/Size
! | Info
|-
| - || || EDID || Editor ID || zstring ||editor id
|-
| - || || VMAD || script info || VMAD || scripting info
|-
| + || || NAME || basic object || formid || Formid of anything as the base object.
|-
| - || || XMBO || model bounds? || float[3] || X, Y, Z bounds, usually same as XPRM bounds (CK 1.8+ throws error if not equal)
|-
| - || || XPRM || primitive || struct || 32 byte struct
:float[3] - x,y,z Bounds / 2
:float[3] - r,g,b Color / 255
:float - unknown: 0.15, 0.2, 0.25, 1.0 seen; same for any given base object
:uint32 - unknown: 1-4 seen
::1 - Box
::2 - Sphere
::3 - Portal Box
::4 - Unknown
|-
| - || || XPOD || portal destination || formid[2] || origin/dest REFR
|-
| - || || XRMR || reference marker  || struct ||
:ubyte - count of following XLRM
:ubyte - flags (0x1 - 0x20 appear unknown)
::0x00000040 - Has Image Space
::0x00000080 - Has Lighting Template
::0x00010000 - seen in 0x000C6B47, 48
:ubyte[2] - Unknown
|-
| - || || LNAM || lighting template || formid  ||
|-
| - || || INAM || image space || formid  || INAM is used differently in a different context (see below)
|-
| - || || SCHR || Old Script || SCHR || Old scripting field.
|-
| * || || XLRM || location room marker || formid || REFR usually to a STAT
|-
| - || || XRGD || ragdoll data  || struct || A long binary stream whose contents are not understood at this time.
|-
| - || || XRDS || Radius || float || ~1.25. Controls the radii on objects like lights.
|-
| - || || XEMI || emitted light || formid || LIGH
|-
| - || || XLIG || light data || struct || 16- or 20-byte struct
:float - FOV Offset from Base Object (°)
:float - Fade Offset from Base Object
:float - End Distance Cap
:float - Shadow Depth Bias
:unknown - (4 bytes, not a float, seen in Dawnguard and Hearthfire)
|-
| - || || XESP || enable parent || struct || 8-byte struct 
:formid - Parent reference (Object to take enable state from)
:uint32 - Flags (records with no flags set have random values in high bits)
::0x0001 = Set Enable State Opposite Parent
::0x0002 = Pop In
|-
| - || || XALP || Alpha Cutoff || ubyte[2] || 2-byte struct
:ubyte - Current Alpha Cutoff
:ubyte - Default Alpha Cutoff

Note: sometimes default displayed in CK instead of current; unclear when that occurs
|-
| - || || XNDP || door pivot? || struct || 8-byte struct
:formID -  NAVM
:uint16 -  Navmesh triangle index
:uint16 -  Padding
|-
| - || || XTEL || door teleport || struct || 32-byte struct
:formid - destination DOOR
:float[3] - x/y/z position
:float[3] - x/y/z rotation (radians)
:uint32 - flag: 0x01 No alarm
|-
| - || || XSCL || scale || float || setScale
|-
| - || || XAPD || activation parent flags || ubyte || 0x01 - Parent Activate Only
|-
| - || || XAPR ||activation parent || struct || 8-byte struct 
:formid - REFR usually to a STAT
:float - Delay
|-
| - || || XLIB || leveled item base || formid || LVLI of objects using this as a base
|-
| - || || XLKR || linked ref ||struct||8-byte struct 
:formid 0 or KYWD (usually LinkCarryStart/End)  
:formid REFR usually to a STAT (FURN also)
10 instances of 4 byte struct with just a formid in Skyrim.esm
|-
| - || || XLOC || lock information (door/cont) || struct || 20 bytes
:byte Level
::-1 - Requires Key
:: 0 - Novice
:: 1 - Novice also, same as 0 (source)
::25 - Apprentice
::50 - Adept
::75 - Expert
::100 - Master
:ubyte[3] - flags?
:formid KEYM (Key)
:ubyte flags
:: 0x04 - Leveled
:ubyte[3] - flags? 
:ubyte[8] - 0s
|-
| * || || XLRT || location ref type || formid || LCRT
|-
| - || || XOWN || owner || formid || usually FACT but horse/dog has NPC_
|-
| - || || XCNT || item count || uint32 || if more than 1 (eg arrows)
|-
| - || || XCVL || || float[3] || X, Y, Z - Water Current Linear Velocity (only found in one instance)
|-
| - || || XCVR || || float[3] || X, Y, Z - Water Current Rotational Velocity (no instance found)
|-
| - || || XCZA || || ||
|-
| - || || XCZC || || ||
|-
| - || || XEZN || || formid || Encounter Zone
|-
| - || || XFVC || Favor Cost || float ||
|-
| - || || FNAM ||Marker Flags || uint8 ||
:uint8
::{0x01} - Visible
::{0x02} - Can Travel To
::{0x04} - "Show All" Hidden
|-
| - || || FULL || ingame name || lstring || Name of the Marker
|-
| - || || TNAM || Marker Type || uint16 || The Icon for the Map Marker - Enum
:uint16
 
::1 - City
::2 - Town
::3 - Settlement
::4 - Cave
::5 - Camp
::6 - Fort
::7 - Nordic Ruins
::8 - Dwemer Ruin
::9 - Shipwreck
::10 - Grove
::11 - Landmark
::12 - Dragon Lair
::13 - Farm
::14 - Wood Mill
::15 - Mine
::16 - Imperial Camp
::17 - Stormcloak Camp
::18 - Doomstone
::19 - Wheat Mill
::20 - Smelter
::21 - Stable
::22 - Imperial Tower
::23 - Clearing
::24 - Pass
::25 - Altar
::26 - Rock
::27 - Lighthouse
::28 - Orc Stronghold
::29 - Giant Camp
::30 - Shack
::31 - Nordic Tower
::32 - Nordic Dwelling
::33 - Docks
::34 - Shrine
::35 - Riften Castle
::36 - Riften Capitol
::37 - Windhelm Castle
::38 - Windhelm Capitol
::39 - Whiterun Castle
::40 - Whiterun Capitol
::41 - Solitude Castle
::42 - Solitude Capitol
::43 - Markarth Castle
::44 - Markarth Capitol
::45 - Winterhold Castle
::46 - Winterhold Capitol
::47 - Morthal Castle
::48 - Morthal Capitol
::49 - Falkreath Castle
::50 - Falkreath Capitol
::51 - Dawnstar Castle
::52 - Dawnstar Capitol
::53 - DLC02 -- Temple of Miraak
::54 - DLC02 -- Raven Rock
::55 - DLC02 -- Standing Stones
::56 - DLC02 -- Telvanni Tower
::57 - DLC02 -- To Skyrim
::58 - DLC02 -- To Solstheim
::59 - DLC02 -- Castle Karstaag
 
|-
| - || || XHTW || Head-Tracking Weight || Float ||
|-
| - || || XIS2 || || || zero length, present if "Ignored By Sandbox" is checked
|-
| - || || XLCM || type? || uint32? || only values seen are 0x00, 0x02, 0x03
|-
| - || || XMBR || || formID || MultiBound Reference
|-
| - || || XOCP || || ||
|-
| * || || XPWR || || formID || Reflected by
|-
| - || || XTRI || || uint32 || Primitive: Collision Layer, selected by matching BNAM field of COLL form
|-
| - || || ONAM || || || zero length, appears together with XACT if "Open by Default" is set
|-
| - || || XACT || || uint32 || always value 0x0d, appears together with ONAM if "Open by Default" is set
|-
| - || 43 || XATR || attach ref || formID  ||
|-
| - || || XWCN || || uint32 || Size of XWCU/16
|-
| - || || XWCU || ||  struct[] || Water Current, series of 16 byte structures seems to be 3 structures always
:float X
:float Y
:float Z
:float? unknown
First structure seems to be "Linear Velocity", second "Angular Velocity", with a structure of all zeroes following - but see CELL.XWCU
|- 
| - || 37 || XPRD || Patrol Data || float || Patrol Data Idle Time
|-
| - || 37 || XPPA || Marker|| 0-length || Marker, XPRD/XPPA/PDTO/INAM are a set
|-
| - || 37 || PDTO || Patrol Data Topic || struct || Same as PDTO field in PACK record
|-
| - || 37 || INAM || Idle Name? || formid? || Probably an IDLE link, as seen in PACK record
|- 
| - || || XLRL|| || formid || LCTN, not found in .esms, added by CK 1.8 when edited
|-
| - || || DATA || locational data || struct || 24 byte
:float[3] - x/y/z position
:float[3] - x/y/z rotation (radians)
Note:   gives the cell location
|}