Background for Fallout 4
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


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

; Obtain form 0000ABCD we expect to be added by the KillerBees plugin
; Note the top most byte in the given ID is unused so 0000ABCD works as well as 0400ABCD
FormList beekillerlist = Game.GetFormFromFile(0x0000ABCD, "KillerBees.esp") as FormList
; If "KillerBees.esp" is not loaded the form will be NONE. Otherwise, add our weapon to the list.
if ( beekillerlist )
  beekillerlist.AddForm( WeapBeeSlayer )
endif

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 Fallout 4 Creation Kit Wiki

Some data provided by the Fallout 4 Creation Kit Wiki. Licensed under the Creative Commons Attribution-Share Alike 4.0 license.