Jump to content

Photo

FormID of a reference


  • Please log in to reply
5 replies to this topic

#1
jazzisparis

jazzisparis

    The baby-eating Bishop of Bath and Wells

  • Supporter
  • PipPipPipPip
  • 2,106 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



#2
luthienanarion

luthienanarion

    Substitute Stunt-Double

  • Supporter
  • PipPipPipPipPip
  • 2,989 posts

No, there are no functions that return a FormID in decimal. I'm curious why you would want a deximal-converted FormID.



#3
jazzisparis

jazzisparis

    The baby-eating Bishop of Bath and Wells

  • Supporter
  • PipPipPipPip
  • 2,106 posts

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.



#4
luthienanarion

luthienanarion

    Substitute Stunt-Double

  • Supporter
  • PipPipPipPipPip
  • 2,989 posts

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



#5
Gribbleshnibit8

Gribbleshnibit8

    Master Modder

  • Premium Member
  • 2,294 posts

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?



#6
jazzisparis

jazzisparis

    The baby-eating Bishop of Bath and Wells

  • Supporter
  • PipPipPipPip
  • 2,106 posts

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.






Page loaded in: 1.176 seconds