Difference between revisions of "SKSE Plugin Development/Getting Specific Forms"
Jump to navigation
Jump to search
(Created page with "If you want to retrieve specific Forms from the game, you can do so either by Editor ID (recommended in most cases): <syntaxhighlight lang="c++"> // Note how we can specify w...") |
|||
Line 18: | Line 18: | ||
'''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'''! | '''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'''! | ||
[[Category:SKSE Plugin Development]] |
Latest revision as of 17:46, 10 December 2024
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!