Jump to content

FormID of a reference


jazzisparis

Recommended Posts

Hello everyone,

Does any of you know if there exists a script function (vanilla or NVSE) which receives a reference/base object and returns a numeric, decimal value, representing its FormID?
I went through the NVSE documentation, up to the latest 3b2, but so far could not find one.

Thanks,
jazzisparis

Link to comment
Share on other sites

Indeed, you are right to be curious. :smile:

 

I am modifying a few properties of an object (a weapon), and need to make sure that in case the player loads a saved game before those properties could be reset to their default values, the reset will be completed immediately when the game loads. The idea was to get the object's FormID, along with the index of the file it came from, store them in a global constant, then, on the loaded session, use both to reconstruct the base object (using BuildRef).

At the moment, I'm using a Form List to store the base object and pass it between sessions, which works quite well, but is a bit awkward. I just wondered if there was another, neater way of doing it.

Link to comment
Share on other sites

That does sound complex, and I'm not sure I follow it completely. I figured you wanted the ID in decimal for BuildRef, but I don't know of a way you can even access a FormID itself as a variable to perform a mathematical conversion.

My confusion was centered around needing to build a reference to something you already have access to a reference of. :P

Link to comment
Share on other sites

Don't the stats of weapons (and other items) reset to their editor defaults upon game reload? Things like changing ammo lists, names etc all revert back. Or are you referring to loading a save in an existing instance of the game?

Link to comment
Share on other sites

 

I don't know of a way you can even access a FormID itself as a variable to perform a mathematical conversion.

The %i format specifier can be used to print the FormID of a passed reference, so it is at least partially accessible. I guess the NVSE team never thought a function returning a FormID would be very useful to anyone, and therefore never implemented one.

 

Or are you referring to loading a save in an existing instance of the game?

That's right.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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