EditorIDs in Papyrus

There's one particular difference between Papyrus and the scripting language used for Oblivion and Fallout 3 that's giving a lot of people trouble. Even a fair number of experienced scripters have been tripped up by this.

In the old scripting language, it was possible to use some base form or persistent reference in a script just by using its editorID. However, if you try to do that in a Papyrus script you'll find that it won't compile. What you need to use instead is a property.

The way in which you'll almost always want to declare a property in Papyrus looks like this, using the type "ObjectReference" as an example:

ObjectReference property MyRef auto

Once you've declared a property like this, you then need to associate a value with it. In order to do this, navigate to the object with your script attached to it in the Creation Kit, right click on your script, and select "Edit Properties".

In this window, you can assign values to all of the properties in your script. You'll want to click on your property, and then click on the "Edit Value" button on the right hand side of the window. After you do this, a drop-down menu will appear in which you can select one of any form of the same type as the property you declared. So, for example, if you declared a property of type "Ingredient", the list would contain all ingredients currently loaded by the Creation Kit. In this example, the list will be filled with references.

As an added bonus, if the name of your property is the same as the editorID of the form that you want it to represent, then Creation Kit will be able to figure out what you mean. In this case, the "Auto-Fill" button will select that form automatically, so long as it's of the correct type. If you have a lot of properties like this, there's also an "Auto-Fill All" button at the bottom of the window.

Once you've done this, you'll be able to use your property as though it were the form you've associated with it.

A Bit More Technical

The reason why you can no longer use editorIDs directly in a script is that scripts are no longer included within data files. Instead, Papyrus source files (psc files) and compiled Papyrus scripts (pex files) are stored separately.

As a result of this, the Papyrus compiler does not look inside data files. Everything that links your Papyrus scripts with a data file must be done inside the Creation Kit. These actions include attaching a script to a form, and setting property values.