@scrawl
scrawl wrote:I did a bunch of research on this two months ago and came to the conclusion that a complete rewrite of the combat tracking code is required. I don't remember all the details, but the basic problem is that combat is handled as state when it shouldn't be in most cases. I was planning to tackle this once I've analyzed how combat is stored in the vanilla save files. That should give some more insight.
You've probably already discovered this, but just in case you haven't.
Some assorted notes on how combat may be recorded in save game file.
Short form:
I think the TGTN subrecord in current CELL tells you when someone is fighting, and who they're fighting.
There are also TGTN subrecords in the REFR record with a name of “PlayerSaveGame”.
More notes.
Was using the save game from the FrostMoth Smugglers (Bug 2172). Seeing what changed in save game before and during combat.
Noticed the following:
1. Does not appear to be stored with the NPCC record.
2. The AI_F record isn't just a string, there's 6 bytes that change in each save file.
REFR record with name of “PlayerSaveGame” may be important.
Have noticed that when combat started, the record acquired a TGTN sub record of “gualtierus spurius”. (It also had a FGTN sub record of “saenus lusius”)
Speculation:
“FGTN” == Following?
“TGTN” == targeting?
Also note,
WNAM changed from “almsivi intervention enchantmen” to “calm humanoid” (I did cast “calm humanoid” to stop the battle, but once it wore off, combat restarted.)
XNAM was “sc_almsiviintervention”. XNAM and YNAM sub records were missing.
I think WNAM may be “Weapon name”, the name of the weapon (or spell or magical artefact currently selected.)
CELL record “Solstheim, Gandrung Caverns” looks to be important as well.
When combat starts, the entry for “gualtierus spurius” gets the following subrecords that with a value of “saenus lusius”
CSTN
LSTN
CSHN
TGTN <=== note, same subrecord as appears in REFR record.
Also, a second “TGTN” record appears with a value of “PlayerSaveGame”
Also in CELL, the entry for “saenus lusius” gains the following sub records, with value of “gualtierus spurius”
CSTN
TGTN
Now have look at changes to save game file after I use “command humanoid” from aryon's glove to make Fargoth my follower and start a fight by attacking “eldafire”
The CELL entry for “Seyda Neen”
- “elda fire” gains the following CSHN & TGTN for “PlayerSaveGame” + TGTN for “fargoth”.
- “fargoth” gains CSTN, CSHN & TGTN for “eldafire”, + TGTN for “Imperial Guard00000002” + FGTN for “PlayerSaveGame”
- “Imperial Guard00000000” gains CSTN, CSHN & TGTN for “PlayerSaveGame”
- “Imperial Guard00000002” gains CSTN & TGTN for “PlayerSaveGame” + TGTN “fargoth”
- “Imperial Guard00000001” gains LSTN & TGTN for “PlayerSaveGame”
Also a new REFR record is created with name “PlayerSaveGame”.
Has the following:
NAME: PlayerSaveGame
CSTN: eldafire00000000
CSHN: eldafire00000000
TGTN: eldafire00000000
TGTN: Imperial Guard00000000
TGTN: Imperial Guard00000002
FGTN: fargoth00000000
WNAM: aryongloveleft_en_unique
XNAM: aryongloveleft
Other notes:
(speculation) in NPCC record, XHLT sub record is location of item (if being worn)