FormID

From the Oblivion ConstructionSet Wiki
Revision as of 18:12, 28 July 2012 by imported>QQuix (Added a bunch of stuff.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


A FormID is an 8-digit hexadecimal number used to refer to almost everything from within Oblivion. An object or reference may be referred to by its EditorID within the CS (in scripts and etc.), but you must use the FormID for console commands.


FormID Format[edit | edit source]

The format is always MMOOOOOO.

The first two digits in the FormID are the ModIndex, while the remaining six digits are the ObjectIndex. The ObjectIndex numbers are unique within each mod -- i.e., no two data objects belonging to a mod will have the same ObjectIndex (otherwise, you get bashing error messages).

The ModIndex reflects the load order of the mod in the current context (CS or in-game).

When shown in the CS, the ModIndex reflects only the currently loaded files, typically your mod and its masters. For a typical mod which has only Oblivion.esm as its master, Oblivion.esm will be loaded first at ModIndex 00, while your mod will be loaded second at ModIndex 01. In another example, if a mod had three different masters, those would load as ModIndexes 00, 01 and 02, while your mod would be loaded at ModIndex 03.

In-game, the ModIndex reflects the position of each mod in the active load order. The game always loads Oblivion.esm first, so it will always occupy ModIndex 00. A mod which is the 10th file in the load order (including Oblivion.esm) will have ModIndex 0x09. One which is 37th in the load order will have ModIndex 0x24 (decimal 36), and so on. In this last example, everything from that mod will have FormIDs starting with 0x24 during that game run. Next run, different load order, same objects may have different FormIDs, i.e., FormIDs starting with different ModIndex.

The engine automatically compensates for that, so, except when dealing with hardcoded FormIDs or console usage, you don't have to worry about it.

Before a FormID can be used with a function in the console, its ModIndex must be updated to match the mod's positioning in the load order (see Determining In-Game ModIndex).


Finding the FormID[edit | edit source]

Objects in the Object and Cell View windows[edit | edit source]

File:FormIdColumn.gif
Finding the FormID column
Locating the FormID

The FormID column is located to the right of the EditorID column in the Object Window of the CS, however it is hidden by default.

The double column line in the first image indicates that a column is collapsed. Click and drag on the column heading to expand the column. The expanded column is shown in the second image.

In this case, the FormID for GiantSwordOfPwn is 02000CE8.

The same applies to both panels in the Cell View Window


Objects in windows from the top menu[edit | edit source]

Most lists accessible by the CS menus and buttons, like World>>Climates…, Character>>Eyes… and the Quest button also have a hidden FormID column to the right of the EditorID. Expand the column as explained above to see the FormID.

Some exceptions:

  • Scripts - Script FormIDs can be found by clicking on the 'Open Script' button at the top of the Script Editor Window. The FormID is after the script name in the drop-down list. If you use CSE, the FormID will be on the Script Editor title bar.
  • Idle Animations - Their FormIDs don't show in the CS at all. One way to find them is exporting game data to a text file (Menu>>File>>Export>>Form Component Data for all non-word forms). In the exported text you will find lines like "IDLE DrinkMug (0003EACA)…" where 0003EACA is the FormID of the Idle Animation 'DrinkMug'. Other FormIDs may also be found in the exported text file.


Non-dynamic references[edit | edit source]

Non-dynamic references are references created at CS time, or, in other words, everything you add to a cell in the Render Window by any means available, e.g. drag-and-drop from the Object Window, duplicating an existing reference or duplicating a cell. FormIDs of references in the render window can be found by double-clicking the reference to open the Reference Window. The FormID is at the top-right corner of the Reference Window. Its format follows the same ModIndex+ObjectIndex rules as explained at the beginning of this article.


Dynamic references[edit | edit source]

Dynamic references are references created in-game, on-the-fly, either by script (PlaceAtMe function) or by dropping items from an inventory. When created they get a FormID and when they leave the world (e.g. picked up or by script DeleteReference function), their FormID becomes invalid.

Since they are not directly related to any mod, dynamic references receive the 'generic' ModIndex 0xFF (decimal 255). The ObjectIndex is increased by one each time a new reference is created. If the reference with the highest ObjectIndex is destroyed, that number is reused for the next one created.


Inventory Items[edit | edit source]

Items in inventories don't have a FormID . . . well, not precisely.

  • Non-dynamic references in inventories (typically, picked up items) will keep its CS-given FormID, so when dropped again the FormID will still be the same as before. While they are in inventory, functions that deal with the base object, like SetName, will still work, while functions that deal with the Reference will not work or return wrong data (e.g., GetPos returns the last in-the-world position before picked up).
  • Picked-up dynamic objects - its given FormID will not be valid anymore (or, even, may have been assigned to a completely different item). If dropped, they receive a new FormID.
  • Original inventory items - items placed in containers or NPC inventories at CS time and are still there have never gotten a FormID and will remain without one until dropped.


Inventory References[edit | edit source]

Since items in inventories don't have a FormID and script functions that deal with items work on FormID, there was only so much a script could do with them until OBSE came up with the concept of Inventory References.

Inventory References are temporary references that receive a FormID for a very short while (less than one frame), just enough to let the script access attributes of items in inventories. Check the article for more details.


Console Usage[edit | edit source]

Supposing that our mod was located 15th (0x0F in hexadecimal) in the load order (see below for ways of determining this), we would update the ModIndex of GiantSwordOfPwn to be 0F000CE8. It can now be used with console commands such as:

player.addItem 0F000CE8 1

Determining In-Game ModIndex[edit | edit source]

  1. In the CS, place an item from your mod in an easy to locate area. Then simply find that item in-game, open the console and click on it to see its ModIndex.
  2. Use Wrye Bash
    • Go to the Mods tab, find and activate your mod, and then check the Load Order column for its ModIndex.
    • Alternatively, go to the Saves tab and find a save in which your mod is active and with a purple checkbox (indicating that the save's load order is 100% in-sync with the current load order). Select the save, find your mod under the save's list of masters, and check the MI column.
  3. Use Oblivion Mod Manager
    • Find and activate your mod in the Mod List, then hover the mouse over its name. The ModIndex is listed as "FormID" in the info window which will appear.

Scripting[edit | edit source]

In scripting, the best way to refer to an object is to use the EditorID. FormIDs aren't good for compatibility because if more than one mod is present, it's ModIndex will change according to the load order. This will cause scripts to no longer work, or work incorrectly. This is a common script rookie mistake.

See Also[edit | edit source]