Jump to content

GetFormFromFile returning None even though object exists


XJDHDR

Recommended Posts

I am trying to use this command to get a reference to a particular container. This reference is basically a container in the QASmoke cell.

Form frmGetFormFromFileResult = Game.GetFormFromFile(0x000C2D3C, "Skyrim.esm")		; QABooksContainer

For some reason, however, the GetFormFromFile function is returning None. I can't figure out why because that container definitely exists and I triple-checked that the FormID is correct. I even tried using the GetForm function instead but that made no difference.

I did find that this function works if I used the FormID of the container's Base Object. However, I can't use this because I need to enumerate through every item in that container's inventory, the GetNthForm function is the only one I know that can do this and that function only works on ObjectRefences, not Base Objects.

Link to comment
Share on other sites

Just a shot in the dark- the console version of GetFormFromFile may not handle reference ids at all- the script version certainly does (as ObjectReference) etc. Refids are found in the game and can be generated as a list from the console. Scripting is the way to go- using something like GetNumItems as well?

Link to comment
Share on other sites

It appears as though somewhere along the way in SSE that GetFormFromFile() no longer accepts a non-persistent reference. I ran into something like this myself not too long ago when trying to set up a patch call for Tundra Homestead. It worked once I selected an XMarkerHeading object. For me that works fine so I didn't sweat it. I only needed to know the mod was present.

Not sure how you'd go about getting around this with a container reference as those are not going to be persistent objects. Why not just make the edit directly? It appears as though you may be going through more hassle than its worth.

Link to comment
Share on other sites

11 hours ago, Arthmoor said:

It appears as though somewhere along the way in SSE that GetFormFromFile() no longer accepts a non-persistent reference. I ran into something like this myself not too long ago when trying to set up a patch call for Tundra Homestead. It worked once I selected an XMarkerHeading object. For me that works fine so I didn't sweat it. I only needed to know the mod was present.

Not sure how you'd go about getting around this with a container reference as those are not going to be persistent objects. Why not just make the edit directly? It appears as though you may be going through more hassle than its worth.

I think this is what is going on. Editing the containers directly won't help because I'm not trying to add or remove items from that container; I'm just getting a list of the container's contents.

I managed to work around this by using the FormID of the Base Object. I then spawned a new copy of that container, got my list of it's contents then deleted the spawned container. This would have been easier if I could use GetNumItems and GetNthItem on Forms as well but this works well enough.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...