Jump to content

Puzzle for Modders


Guest ffabris

Recommended Posts

Guest ffabris
Posted

Assuming you have never encountered either of these NPCs in game, consider:

Actor Orgnar = GetFormFromFile(0x00013486, "Skyrim.esm") as Actor
Actor Marcurio = GetFormFromFile(0x000B9986, "Skyrim.esm") as Actor

(You may assume that the IDs are correct; it isn't a simple coding error.) The question is: why does the first give a valid result, but the second returns none?

As it turns out, it appears that most, if not all, hirelings will fail to load via GetFormFromFile(), until the player enters the cell where they have been placed. From that point on, the call will return a valid result. Non-hireling potential followers don't have this problem, nor do most other NPCs. (Personally, I haven't run into any others which fail the way hirelings fail, but there might be.)

So... why? Why only hirelings (at least apparently)? Other hirelings that I tested and which also fail until "met" include Stenar and Vorstag.

It was suggested that the problem was a USLEEP issue of some kind. So I loaded USLEEP into TES5Edit, to see what it changes. USLEEP edits the base actor record for Marcurio (and Stenvar, Vorstag ... and many other actors which are not affected by the issue in question) by adding the dead body cleanup script, and changes a few stats. However, it makes no change whatsoever to the placed reference, HierlingMarcurioREF in cell RiftenBeeAndBarb. And that's the reference used in the GetFormFromFile() call.

This is a minor issue for me with my mod Manipulaor, but it is now more a question of wanting to understand the reason. Any ideas? (And yes, I have researched before asking here.)

Posted

My bet would be because the Orgnar ref is persistent and the Marcurio ref is not. Orgnar has the innkeeper script which has an onupdate event and is also referenced by several quests that are probably started as soon as you leave Helgen, or even earlier.

 

If you need the Actor object, why not just grab the base NPC records (13479 / B9980)? That should work regardless.

 

Guest ffabris
Posted

My bet would be because the Orgnar ref is persistent and the Marcurio ref is not. Orgnar has the innkeeper script which has an onupdate event and is also referenced by several quests that are probably started as soon as you leave Helgen, or even earlier.

Aha! That could well be. Interesting. I'll need to check of all of the actors that do load correctly, are all persistent. To my surprise, Ulfberth War-Bear is... I don't think he's referenced in specific quests (but I might be wrong).

 

Hum,... Sigurd is temp, yet he works, I think. Chief Larak is also Temp, and he loads. Gorm is also Temp and definitely loads correctly.

 

Still your idea makes sense, it would explain it. Yet... maybe there's another missing piece to the puzzle.

 

If you need the Actor object, why not just grab the base NPC records (13479 / B9980)? That should work regardless.

That would work if the mod worked with specific actors, but it isn't; it handles any actor and so has to be generic. Essentially, the user can save info for any actor under the crosshair, and then reload it in a new game (or at any time).

 

Hmm... maybe saving the result of GetActorBase() or GetLeveledActorBase() rather than the actor form ID would solve it.... except that that would break everyone's saved data. :-|

 

Added: Aha! USLEEP makes Gorm persistent. And Larak. But not Sigurd, and I'm pretty sure he loads correctly. Yes, just checked, he does. And I loaded my entire load order into TES5Edit to make sure that no other mod is setting Sigurd as Persistent.

Posted

Without digging through the DK, my guess for Ulfberth would be that he's referenced by the noobie smithing quest. Quests like these (just as shopkeeper/innkeeper quests) usually have 2 NPCs referenced, the primary one (Adriana for the smithing noobie quest) and their backup in case the primary dies, which in the case of Adriana would be Ulfberth. It's also possible it comes from a mod of course, for example AA might have a reference to Ulfberth that makes him persistent, since he figures in the quest line around getting Adriana as lover.

 

Guest ffabris
Posted

As I was going to bed last night, I realized that I had likely run into Sigurd at some point prior to making the save I used or testing. So I just used a far older save and tested again. Sure enough, Sigurd fails to load. So that confirms your theory on Temp being the reason it fails.

 

Very good guess - well done! :)

Guest ffabris
Posted

Follow-up.... I tested loading Sigurd via his BaseID (0x000CDD72) rather than his RefID (0x000CDD73), and that also fails. So I'm not sure at this point if there is any way to load temp actors.

Posted

I'm a bit late but there is no point in using GetFormFromFile to get a formid that you already know.

The point of GetFormFromFile is to fill the first two digits that are load order dependant if part of an .esp file. But all formids in Skyrim.esm load with 0x00

 

Actor Orgnar = Game.GetForm(0x00013486) as actor

Guest ffabris
Posted

Thing is, I don't know in advance what actor I need to reference. It could be any in the game. As noted above:

 

That would work if the mod worked with specific actors, but it isn't; it handles any actor and so has to be generic. Essentially, the user can save info for any actor under the crosshair, and then reload it in a new game (or at any time).

 

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...