Tes5Mod: Save File Format/Papyrus

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search

Papyrus[edit]

Name Type/Size Info
header uint16 -1 for invalid save or Skyrim VM version
strCount uint16
strings wstring[strCount]
scriptCount uint32
script Script[scriptCount]
scriptInstanceCount uint32
scriptInstance ScriptInstance[scriptInstanceCount]
referenceCount uint32
reference Reference[referenceCount]
arrayInfoCount uint32
arrayInfo ArrayInfo[arrayInfoCount] Array type and length
papyrusRuntime uint32 ID for next active script
activeScriptCount uint32
activeScript ActiveScript[activeScriptCount]
scriptData ScriptData[scriptInstanceCount]
referenceData ReferenceData[referenceCount]
arrayData ArrayData[arrayInfoCount]
activeScriptData ActiveScriptData[activeScriptCount]
FunctionMessageCount uint32
FunctionMessages FunctionMessage[FunctionMessageCount] To be updated
SuspendedStackCount1 uint32
SuspendedStacks1 SuspendedStack[SuspendedStackCount1] To be updated
SuspendedStackCount2 uint32
SuspendedStacks2 SuspendedStack[SuspendedStackCount2] To be updated
unknown uint32
unknown uint32 Present only since Skyrim VM version 2 and if the previous field is not null
unknown0Count uint32
unknowns0 uint32[unknown0Count]
queuedUnbindCount uint32 Present only since Skyrim VM version 4.
queuedUnbinds queudUnbind[queudUnbindCount] Present only since Skyrim VM version 4. This is the last field of the first part of the Papyrus data. To be updated
saveFileVersion sint16 -1 marks an invalid save
ArrayCount1 uint32
Array1 Array1[ArrayCount1]
ArrayCount1a uint32
Array1a Array1a[ArrayCount1a]
ArrayCount2 uint32
Array2 Array2[ArrayCount2]
ArrayCount3 uint32
Array3 Array3[ArrayCount3]
ArrayCount4 uint32
Array4 Array4[ArrayCount4]
ScriptListCount uint32
ScriptList w32string[ScriptListCount]
ArrayCount4a uint32 Possibly another array structure counter
ArrayCount4b uint32
Array4b Array4b[ArrayCount4b]
ArrayCount4c uint32
Array4c Array4c[ArrayCount4c]
ArrayCount4d uint32
Array4d Array4d[ArrayCount4d]
ArrayCount5 uint32
Array5 Array5[ArrayCount5]
ArrayCount6 uint32
Array6 Array6[ArrayCount6]
ArrayCount7 uint32
Array7 Array7[ArrayCount7]
ArrayCount8 uint32
Array8 Array8[ArrayCount8]
ArrayCount9 uint32
Array9 uin32[ArrayCount9]
ArrayCount10 uint32
Array10 Array10[ArrayCount10]
ArrayCount11 uint32
Array11 Array11[ArrayCount11]
ArrayCount12 uint32
Array12 Array12[ArrayCount12]
ArrayCount13 uint32
Array13 Array13[ArrayCount13]
ArrayCount14 uint32
Array14 Array14[ArrayCount14]
ArrayCount15 uint32
Array15 Array15[ArrayCount15]

ArrayData[edit]

Name Type/Size Info
arrayID uint32 Reference by ScriptData members
data Variable[ArrayLength] ArrayLength from ArrayInfo with the same arrayID.

ArrayInfo[edit]

Name Type/Size Info
arrayID uint32 Reference by ScriptData members
type uint8
1 = RefID
2 = String
3 = Integer
4 = Float
5 = Boolean
refType uint16 Only appear when type == 1 otherwise this variable is not present.
String table reference.
length uint32 Number of elements in the array.

MemberData[edit]

Name Type/Size Info
memberName uint16 String table reference
memberType uint16 String table reference

Script[edit]

Name Type/Size Info
scriptName uint16 String table reference
type uint16 String table reference
memberCount uint32
memberData MemberData[memberCount]

ScriptData[edit]

Name Type/Size Info
scriptID uint32 Link with script instance ID
flag? uint8
Type uint16 String Table Reference
unknown uint32
unknown uint32 Appears only if (flag and 0x04) == 0x04
memberCount uint32 Number of stored variables
member Variable[memberCount]

ReferenceData[edit]

Name Type/Size Info
ReferenceID uint32 Link with reference ID
flag? uint8
Type uint16 String Table Reference
unknown uint32
unknown uint32 Appears only if (flag and 0x04) == 0x04
memberCount uint32 Number of stored variables
member Variable[memberCount]

ScriptInstance[edit]

Name Type/Size Info
scriptID uint32
scriptName uint16 String table reference
unknown2bits uint16 Only the first two bits are used.
unknown sint16 The used value is: unknown2bits * 1000 + unknown
RefID RefID Ignored if preceding unknown is -1.
unknown uint8

References[edit]

Name Type/Size Info
referenceID uint32
type uint16 String table reference.

ActiveScripts[edit]

Name Type/Size Info
scriptID uint32 ID is Papyrus runtime
scriptType uint8

Variable[edit]

Name Type/Size Info
type uint8
0 = Null (4) but not empty (4 bytes of zero)
1 = RefID (6)
2 = String (2)
3 = Integer (4)
4 = Float (4)
5 = Boolean (4)
11 = RefID Array (6, 2 bytes for type and 4 more bytes for array ID)
12 = String Array (4)   => Array ID
13 = Integer Array (4)  => Array ID
14 = Float Array (4)    => Array ID
15 = Boolean Array (4)  => Array ID
data Depends on type

ActiveScriptData[edit]

Name Type/Size Info
scriptID uint32 Link with active script ID
majorVersion uint8 3
minorVersion uint8 1 (Dawnguard, Hearthfire and Dragonborn scripts are 2)
unknown Variable
flag? uint8
unknownByte uint8
unknown2 uint32 Appears only if (flag and 0x01) == 0x01
unknown3 uint8
unknown4 depends on value of unknown3 Appears only if unknown3 is between 1 - 3
1 = uint32 count, char string[count], *
2 = variable
3 = uint32 count, char string[count], *, Variable
*If string maths one of these, here is more things:
String:             Data:
TopicInfo           none
QuestStage          3 bytes refId, uint16 String table reference, uint8 unknown
ScenePhaseResults   3 bytes refId, uint32 unknown
SceneActionResults  3 bytes refId, uint32 unknown
SceneResults        3 bytes refId
Stackframecount uint32
Stackframe Stackframe[Stackframecount]
unknown5 uint8 Appears only if Stackframecount is not NULL

Stackframe[edit]

Name Type/Size Info
variablecount uint32
flag? uint8
function type uint8
Script name uint16 String table reference
Script base name uint16 String table reference
event uint16 String table reference
status uint16 String table reference. Appears only if (flag and 0x01) == 0x00, and function type is 0x00
opcode version uint8
opcode minor version uint8
return type uint16 String table reference
function docstring uint16 String table reference
function user flags uint32
function flags uint8
function parameter count uint16
Functionparam Functionparam[function parameter count]
function locals count uint16
Functionlocal Functionlocal[function locals count]
opcode count uint16
opcodeData opcodeData[opcode count]
unknown3 uint32
unknown Variable
unknown Variable[variablecount]

opcodeData[edit]

Name Type/Size Info
opcode uint8
opcode: type:           paremeters:
0x00  NOOP
0x01  Iadd                SII
0x02  Fadd                SFF
0x03  Isubtract           SII
0x04  Fsubtract           SFF
0x05  IMultiply           SII
0x06  FMultiply           SFF
0x07  IDivide             SII
0x08  FDivide             SFF
0x09  Imod                SII
0x0a  Not                 SA
0x0b  Inegate             SI
0x0c  Fnegate             SF
0x0d  Assign              SA
0x0e  Cast                SA
0x0f  CompareEQ           SAA
0x10  CompareLT           SAA
0x11  CompareLTE          SAA
0x12  CompareGT           SAA
0x13  CompareLTE          SAA
0x14  Jump                L
0x15  JumpT               AL
0x16  JumpF               AL
0x17  CallMethod          NSS*
0x18  CallParent          NS*
0x19  CallStatic          NNS*
0x1a  Return              A
0x1b  StrCat              SQQ
0x1c  PropGet             NSS
0x1d  PropSet             NSA
0x1e  ArrayCreate         Su
0x1f  ArrayLength         SS
0x20  ArrayGetElement     SSI
0x21  ArraySetElement     SIA
0x22  ArrayFindelement    SSAI
0x23  ArrayRFindElement   SSAI
0x24  INVALID
I = integer
F = float
S = string
A = auto?
* = uint32 extra parameters count
Parameter Parameter[count] count depends on opcode type. (eg. 0x01 Iadd SII takes 3 parameters)

Parameter[edit]

Name Type/Size Info
type uint8
1 and 2 = uint16 string table referece
3 = uint32
4 = float
5 = uint8
data depends on type

Functionparam[edit]

Name Type/Size Info
function param name uint16 String table reference
function param type uint16 String table reference

Functionlocal[edit]

Name Type/Size Info
function local name uint16 String table reference
function type name uint16 String table reference

FunctionMessage[edit]

Name Type/Size Info
unknown uint8 If value >2, no id, flag and message are present
id uint32 Link with active script ID
flag uint8
message FunctionMessageData Appears only if flag >0

FunctionMessageData[edit]

Name Type/Size Info
unknown uint8
script name uint16 String table reference
event uint16 String table reference
unknown Variable
variablecount uint32
unknown Variable[variablecount]

SuspendedStack[edit]

Name Type/Size Info
id uint32 Link with active script ID
flag uint8
message FunctionMessageData Appears only if flag >0

queudUnbind[edit]

Name Type/Size Info
ID uint32 Link with script instance ID
unknown2 uint32

Array1[edit]

Name Type/Size Info
unknown1 uint32
unknown2 uint32


Example data dump - Array1

[30 01 00 00 34 13 00 00]
[7C 07 00 00 35 13 00 00]
[64 00 00 00 88 44 00 00]
[11 02 00 00 22 EC 1A 00]
[CE 01 00 00 22 EC 1A 00]



Array1a[edit]

Name Type/Size Info
unknown1 uint32
unknown2 uint32


Example data dump - Array1a

[10 00 00 00 BE C5 01 00]
[31 00 00 00 F3 C8 02 00]
[10 00 00 00 5F E6 01 00]
[52 00 00 00 54 36 02 00]
[86 00 00 00 C3 A9 00 00]


Array2[edit]

Name Type/Size Info
unknown1 uint32
unknown2 uint32


Example data dump - Array2

[4C 01 00 00 0E 28 0D 00]
[67 00 00 00 72 3D 0D 00]
[F4 01 00 00 26 33 08 00]
[8C 03 00 00 BC 9B 06 00]


Array3[edit]

Name Type/Size Info
type uint8
string 1 uint16 string reference??
unknown 1 uint16
string 2 uint16 string reference??
unknown 2 uint32
flags uint16
reference RefID


Example data dump - Array3

[00 87 00 00 00 88 13 00 00 00 00 FF FF 43 50 2E]
[00 D2 02 00 00 88 13 00 00 00 00 FF FF 42 43 0E]
[00 69 01 00 00 88 13 00 00 00 00 FF FF 42 E0 EE]
[00 79 0B 00 00 88 13 00 00 00 00 FF FF 44 D7 8E]
[01 10 01 00 00 E8 03 00 00 00 00 25 00 4F 5B C1]
[00 67 03 00 00 88 13 00 00 00 00 FF FF 43 68 D8]


Array4[edit]

Name Type/Size Info
string 1 uint16 string reference??
unknown 1 uint16
unknown 2 uint8
string 2 uint16 string reference??
unknown 3 uint32
flags uint16
reference RefID


Example data dump - Array4

[01 7C 02 00 00 E8 03 00 00 00 00 FF FF 47 43 45]
[01 B5 02 00 00 E8 03 00 00 00 00 FF FF 47 43 4A]
[01 7C 02 00 00 E8 03 00 00 00 00 10 00 43 AC DB]
[01 B5 02 00 00 E8 03 00 00 00 00 12 00 43 AC DB]
[01 23 03 00 00 E8 03 00 00 00 00 FF FF 42 BF 9C]


Array4b[edit]

Name Type/Size Info
unknown 1 uint8
unknown 2 uint16
unknown 3 uint16
reference 1 RefID
reference 2 RefID
reference 3 RefID
reference 4 RefID


Example data dump - Array4b

[16 0F 0B 00 00 4B 23 86 80 0C 2A 80 0C 2C 43 2D B7]
[16 CB 09 00 00 4B 23 86 80 0D 41 80 0D 3F 43 2D B7]


Array4c[edit]

Name Type/Size Info
flag uint8
data uint32
reference RefID
data 1 array uint32[3] exists if flag in [0, 6]
data 2 array uint32[4] exists if flag = 0
unk uint8 exists if flag in [0, 3]


Example data dump - Array4c

[00 5D D4 69 00 80 1C C4 40 00 14 00 00 00 00 00 00 00 00 00 00 7A 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00]
[06 32 D4 69 00 80 3C 4F 0D 59 C8 47 CD 34 71 C7 A6 A0 30 46]
[03 87 8B 61 00 80 24 78 02]
[03 86 8B 61 00 80 24 77 02]


Array4d[edit]

Name Type/Size Info
flag1 uint8
unknown uint32
flag2 uint8
reference RefID


Example data dump - Array4d

[03 F8 DA 3D 08 03 40 78 02]
[03 7B 8B 61 00 80 24 71 02]


Array5[edit]

Name Type/Size Info
unknown 1 uint16
unknown 2 uint16
reference 1 RefID
reference 2 RefID
reference 3 RefID
unknown 3 uint16


Example data dump - Array5

[00 00 0D 00 45 0A F1 45 56 49 80 1A 20 00 02]
[00 00 0E 00 45 0A F1 45 56 4E 80 1A 20 00 02]
[00 00 0F 00 45 0A F1 45 56 4F 80 1A 20 00 02]
[00 00 10 00 00 16 A1 80 27 65 40 00 14 00 02]


Array6[edit]

Name Type/Size Info
unknown uint16
flags uint16
reference RefID


Example data dump - Array6

[00 00 FF FF 4F C1 A2]
[00 00 FF FF 00 01 96]
[00 00 FF FF 4A 2C 94]
[00 00 FF FF 00 00 00]
[00 00 FF FF 01 0E 5B]


Array7[edit]

Name Type/Size Info
unknown uint16
flags uint16
reference RefID


Example data dump - Array7

[00 00 FF FF 4F C8 5D]


Array8[edit]

Name Type/Size Info
unknown uint16
type uint16
reference RefID
count1 uint32
count2 uint32
reference array 1 RefID[count1]
reference array 2 RefID[count2]


Example data dump - Array8

[00 00 0B 00 00 00 00 01 00 00 00 01 00 00 00 48 89 A2 00 00 00]
[00 00 02 00 48 99 8D 04 00 00 00 00 00 00 00 43 AD 76 46 85 22 45 16 C8 45 AC E3]
[00 00 01 00 45 33 1D 01 00 00 00 00 00 00 00 43 AD 5E]
[00 00 FF FF 4F B8 0A 00 00 00 00 01 00 00 00 50 9C 69]
[00 00 01 00 45 33 08 03 00 00 00 00 00 00 00 45 9B 86 45 16 C8 42 F4 4C]
[00 00 02 00 45 B3 A5 03 00 00 00 00 00 00 00 43 AD 6C 46 85 23 45 AC DE]
[00 00 03 00 4D B8 51 02 00 00 00 00 00 00 00 45 7A 7A 44 26 C8]
[00 00 22 00 41 8B 4B 06 00 00 00 00 00 00 00 4D 3E 6A 4D 67 4A 4D 66 F9 4D 3E 6B 4D 67 0F 4D 67 2B]
[00 00 0A 00 00 13 D2 02 00 00 00 00 00 00 00 00 1F 5C 00 1C 4B]


Array10[edit]

Name Type/Size Info
array reference RefID
count uint32
elements Array10Element[count]


Example data dump - Array10

[47 1D FC 04 00 00 00 10 00 00 00 MillLogChuteIdle 00 00 00 00 01 00 00 00 00 00 FF FF 47 1D FC 13 00 00 00 DestructionComplete 00 00 00 00 01 00 00 00 00 00 FF FF 47 1D FC 10 00 00 00 MillLogIdleReset 01 00 00 00 01 00 00 00 7F 14 00 00 01 00 00 00 00 00 FF FF 47 1D FC 14 00 00 00 MillLogPileLoadStart 00 00 00 00 01 00 00 00 00 00 FF FF 47 1D FC]
[40 00 14 01 00 00 00 1C 00 00 00 SoundPlay . NPCHumanWoodChop 00 00 00 00 03 00 00 00 00 00 FF FF 48 3D 8D 00 00 FF FF 49 9B 49 00 00 FF FF 49 0E 50]
[40 00 14 02 00 00 00 0A 00 00 00 weaponDraw 00 00 00 00 02 00 00 00 00 00 29 00 00 00 00 00 00 27 00 00 00 00 1C 00 00 00 SoundPlay . NPCHumanWoodChop 00 00 00 00 02 00 00 00 00 00 FF FF 4C DD 7A 00 00 FF FF 00 00 00]
[40 00 14 01 00 00 00 0A 00 00 00 weaponDraw 00 00 00 00 01 00 00 00 00 00 08 00 00 00 00]
[46 CF 54 01 00 00 00 05 00 00 00 Begin 00 00 00 00 01 00 00 00 00 00 FF FF 46 CF 54]


Array10Element[edit]

Name Type/Size Info
name w32string
count1 uint32
elements1 Array10Element1[count1]
count2 uint32
elements2 Array10Element2[count2]

Array10Element1[edit]

Name Type/Size Info
count uint32
elements Array10Element1Data[count]

Array10Element1Data[edit]

Name Type/Size Info
str uint16 string refererence
flag uint16

Array10Element2[edit]

Name Type/Size Info
unknown uint16
flag uint16
reference RefID

Array11[edit]

Name Type/Size Info
unknown uint32
reference RefID
unknown uint8


Example data dump - Array11

[83 00 00 00 48 B6 27 00]
[4D 00 00 00 B5 EC 93 0C]


Array12[edit]

Name Type/Size Info
reference RefID
count uint32
elements Array12Element[count]


Example data dump - Array12

[00 00 00 02 00 00 00 00 00 00 00 00 C2 72 03 00 00 00 00 00 00 C5 72 03 00]
[00 02 97 01 00 00 00 00 00 00 00 00 C7 C7 00 00]
[00 04 8C 01 00 00 00 00 00 00 00 00 58 05 00 00]
[00 04 8E 01 00 00 00 00 00 00 00 00 68 09 00 00]
[00 00 00 01 00 00 00 01 0A 00 00 00 78 DB A1 0A]
[00 52 D9 04 00 00 00 00 00 00 00 00 91 6A 80 00 00 00 00 00 00 14 89 89 00 00 00 00 00 00 B2 13 91 00 00 00 00 00 00 D6 F2 94 00]


Array12Element[edit]

Name Type/Size Info
unk1 uint32
unk2 uint8
str uint16 string reference?
unk3 uint16

Array13[edit]

Name Type/Size Info
reference RefID
count uint32
elements Array13Element[count]


Example data dump - Array13

[00 04 8C 01 00 00 00 0A 00 00 00 01 00 00 00 C9 05 00 00 01 00 00 00 00 00 00 00 00 01 00 00 00]
[43 37 2B 01 00 00 00 41 00 00 00 01 00 00 00 2A 07 00 00 01 00 00 00 00 00 00 00 00 01 00 00 00]
[00 4D 3C 01 00 00 00 C8 00 00 00 01 00 00 00 8C F2 94 00 02 00 00 00 00 00 00 00 01 01 00 00 00 00 01 00 00 00]
[00 4D 23 01 00 00 00 0A 00 00 00 01 00 00 00 9B F2 94 00 01 00 00 00 00 00 00 00 00 01 00 00 00]
[00 4D 0E 02 00 00 00 C8 00 00 00 01 00 00 00 67 13 91 00 02 00 00 00 00 00 00 00 00 01 00 00 00 01 01 00 00 00 0A 00 00 00 01 00 00 00 C3 B8 89 00 01 00 00 00 00 00 00 00 00 01 00 00 00]
[00 4D 63 02 00 00 00 C8 00 00 00 01 00 00 00 E9 B7 89 00 01 00 00 00 00 00 00 00 00 01 00 00 00 73 00 00 00 01 00 00 00 04 89 89 00 01 00 00 00 00 00 00 00 00 01 00 00 00]
[49 54 E1 01 00 00 00 01 00 00 00 01 00 00 00 EB 32 08 00 01 00 00 00 00 00 00 00 00 01 00 00 00]


Array13Element[edit]

Name Type/Size Info
unk1 uint32
count1 uint32
data1 uint32[count1]
count2 uint32
data2 Array13Element2[count2]
unk2 uint32 always is 1?

Array13Element2[edit]

Name Type/Size Info
data uint8[5] bool array? only value 0 & 1 there is observed

Array14[edit]

Name Type/Size Info
reference RefID
count uint32
elements Array14Element[count]
data uint32


Example data dump - Array14

[40 2B 29 01 00 00 00 00 00 00 00 00 F3 32 08 00]


Array14Element[edit]

Name Type/Size Info
data uint8[5]

Array15[edit]

Name Type/Size Info
data uint32
count uint32
elements uint32[count]


Example data dump - Array15

[5D 8A 00 00 01 00 00 00 0F 98 0D 00]
[51 3D 00 00 01 00 00 00 3C 8B 37 00]


w32string[edit]

Name Type/Size Info
length uint32
string uint8[length]