SKSE Plugin Development/Getting Specific Forms
Jump to navigation
Jump to search
If you want to retrieve specific Forms from the game, you can do so either by Editor ID (recommended in most cases):
// Note how we can specify which type the return value should have right here
// ↓
auto *ActorTypeNPC = RE::TESForm::LookupByEditorID<RE::BGSKeyword>("ActorTypeNPC");
// You can also do this:
auto *ActorTypeNPC = RE::TESForm::LookupByEditorID("ActorTypeNPC");
// which will return a TESForm object (usually less helpful)
Or by Form ID:
auto *PlayerRef = RE::TESForm::LookupByID<RE::Actor>(0x14);
Warning: Note that we are using an absolute Form ID! If you want to effectively use this method for anything other than Skyrim.esm, you will have to look up the position of the plugin in the load order first!