Background for Skyrim SE
Member of the Game script
FormfunctionGetFormFromFile(intaiFormID, stringasFilename)NativeGlobal

Description

Wiki Description

Obtains the form specified by its form ID number which originated in the specified file. The ID for a form changes based on the load order of the file it loaded from. So a form which shows up as 0101ABCD in the editor may show up as 0401ABCD in game depending on how many other files load before it. This function lets you blindly grab a form based on the lower bytes of its ID and the expected file which created the form.

Documentation Comment

Returns the form specified by the ID originating in the given file


Caveats

CK Wiki - Notes

  • If asFilename is not loaded, it will be reported in one's log.
  • Don't forget to cast if setting a property to any given form type with GetFormFromFile.
  • Almost invariably, a plugin will have a form with 0x00000800 or 0x00000D62 as its FormID. The latter for a plugin that is masterless when its first form is created and the former when another plugin is loaded at that time. Checking for both FormIDs in most plugins will suffice to merely determine if asFileName is loaded, but there's always the possibility the first form added gets deleted in which case you'd get a false negative. Whenever possible, use a verified FormID that is likely to remain in asFileName.

Parameters

  1. intaiFormID

    CK Wiki Description

    The form ID number of the form we want. (FormID proceeded by 0x) For example Form ID "0001ABCD" is given as:0x0001ABCD

  2. stringasFilename

    CK Wiki Description

    The name of the file we expect the form to have originated in.


Examples

No human-generated examples found for this function.

Auto-Generated Example

int myInt__aiFormID
string myString__asFilename

Form returnedValue = Game.GetFormFromFile(myInt__aiFormID, myString__asFilename)

Related Pages


Additional References

View this function’s page on the Skyrim Creation Kit Wiki

Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.