Table of Contents

Interface IGameEvents

Namespace
SkyrimForge
Assembly
SkyrimForge.dll

The game events the framework exposes to plugins.

public interface IGameEvents

Remarks

A handler runs on the thread that raises its event, before the code that raised it continues. The game's thread runs Start() and raises OnFrame, the SKSE events from OnPostLoad to OnSaveDeleted other than OnDataLoaded, which arrives on another thread, and most events of menus, the crosshair, sleeping, waiting, crafting, and loading cells. Keyboard events arrive mostly on worker threads, and mouse events mostly on the game's thread. The game runs scripts, AI, animation, combat, and quests on worker threads while the game's thread waits for them, and raises most of its other events there. Handlers on different worker threads run at the same time. A handler there that changes the game or calls a member documented as called on the game's thread first awaits WaitForGameThreadAsync(IUtility, CancellationToken) or queues that work through ITaskQueue.

A cell loading raises some events on a thread of its own while the game's thread runs, and a handler there does the same.

Properties

OnAction

Raised on SKSE's ActionEvent.

IGameEvent<ActionEventArgs> OnAction { get; }

Property Value

IGameEvent<ActionEventArgs>

OnActivate

Raised on the game's TESActivateEvent.

IGameEvent<ActivateEventArgs> OnActivate { get; }

Property Value

IGameEvent<ActivateEventArgs>

OnActiveEffectApplyRemove

Raised on the game's TESActiveEffectApplyRemoveEvent.

IGameEvent<ActiveEffectApplyRemoveEventArgs> OnActiveEffectApplyRemove { get; }

Property Value

IGameEvent<ActiveEffectApplyRemoveEventArgs>

OnActorCell

Raised on the game's BGSActorCellEvent.

IGameEvent<ActorCellEventArgs> OnActorCell { get; }

Property Value

IGameEvent<ActorCellEventArgs>

Remarks

The game raises it as the player enters or leaves a cell, and for no other actor.

OnActorDeath

Raised on the game's BGSActorDeathEvent.

IGameEvent<ActorDeathEventArgs> OnActorDeath { get; }

Property Value

IGameEvent<ActorDeathEventArgs>

Remarks

The game raises it as the player dies, and for no other actor. OnDeath is raised for every actor.

OnActorKill

Raised on the game's ActorKill::Event.

IGameEvent<ActorKillEventArgs> OnActorKill { get; }

Property Value

IGameEvent<ActorKillEventArgs>

OnActorLocationChange

Raised on the game's TESActorLocationChangeEvent.

IGameEvent<ActorLocationChangeEventArgs> OnActorLocationChange { get; }

Property Value

IGameEvent<ActorLocationChangeEventArgs>

OnBookRead

Raised on the game's TESBookReadEvent.

IGameEvent<BookReadEventArgs> OnBookRead { get; }

Property Value

IGameEvent<BookReadEventArgs>

OnBooksRead

Raised on the game's BooksRead::Event.

IGameEvent<BooksReadEventArgs> OnBooksRead { get; }

Property Value

IGameEvent<BooksReadEventArgs>

OnCamera

Raised on SKSE's CameraEvent.

IGameEvent<CameraEventArgs> OnCamera { get; }

Property Value

IGameEvent<CameraEventArgs>

OnCellAttachDetach

Raised on the game's TESCellAttachDetachEvent.

IGameEvent<CellAttachDetachEventArgs> OnCellAttachDetach { get; }

Property Value

IGameEvent<CellAttachDetachEventArgs>

OnCellFullyLoaded

Raised on the game's TESCellFullyLoadedEvent.

IGameEvent<CellFullyLoadedEventArgs> OnCellFullyLoaded { get; }

Property Value

IGameEvent<CellFullyLoadedEventArgs>

OnCellReadyToApplyDecals

Raised on the game's TESCellReadyToApplyDecalsEvent.

IGameEvent<CellReadyToApplyDecalsEventArgs> OnCellReadyToApplyDecals { get; }

Property Value

IGameEvent<CellReadyToApplyDecalsEventArgs>

OnChestsLooted

Raised on the game's ChestsLooted::Event.

IGameEvent<ChestsLootedEventArgs> OnChestsLooted { get; }

Property Value

IGameEvent<ChestsLootedEventArgs>

OnCombat

Raised on the game's TESCombatEvent.

IGameEvent<CombatEventArgs> OnCombat { get; }

Property Value

IGameEvent<CombatEventArgs>

Remarks

The state that ends a fight arrives with the target cleared, so an actor fighting the player should be recorded during the fight.

OnContainerChanged

Raised on the game's TESContainerChangedEvent.

IGameEvent<ContainerChangedEventArgs> OnContainerChanged { get; }

Property Value

IGameEvent<ContainerChangedEventArgs>

OnCriticalHit

Raised on the game's CriticalHit::Event.

IGameEvent<CriticalHitEventArgs> OnCriticalHit { get; }

Property Value

IGameEvent<CriticalHitEventArgs>

OnCrosshairRef

Raised on SKSE's CrosshairRefEvent.

IGameEvent<CrosshairRefEventArgs> OnCrosshairRef { get; }

Property Value

IGameEvent<CrosshairRefEventArgs>

OnDataLoaded

Raised once the game has loaded its data files.

IGameEvent<DataLoadedEventArgs> OnDataLoaded { get; }

Property Value

IGameEvent<DataLoadedEventArgs>

Remarks

A form can first be looked up by editor ID here, and the arrays TESDataHandler exposes are populated by now. Neither is available earlier. It is raised once for the run of the process. The save events repeat. A plugin's Start() runs while SKSE is still loading plugins, before this, so a handler subscribed there receives it. Menu, input, and SKSE events can arrive before this. The loading screen shown at startup raises OnMenuOpenClose after OnInputLoaded. The game's events about forms and references, OnInitScript among them, are raised only once the data has loaded.

OnDeath

Raised on the game's TESDeathEvent.

IGameEvent<DeathEventArgs> OnDeath { get; }

Property Value

IGameEvent<DeathEventArgs>

OnDestructionStageChanged

Raised on the game's TESDestructionStageChangedEvent.

IGameEvent<DestructionStageChangedEventArgs> OnDestructionStageChanged { get; }

Property Value

IGameEvent<DestructionStageChangedEventArgs>

OnDisarmed

Raised on the game's DisarmedEvent::Event.

IGameEvent<DisarmedEventArgs> OnDisarmed { get; }

Property Value

IGameEvent<DisarmedEventArgs>

OnDragonSoulsGained

Raised on the game's DragonSoulsGained::Event.

IGameEvent<DragonSoulsGainedEventArgs> OnDragonSoulsGained { get; }

Property Value

IGameEvent<DragonSoulsGainedEventArgs>

OnEnterBleedout

Raised on the game's TESEnterBleedoutEvent.

IGameEvent<EnterBleedoutEventArgs> OnEnterBleedout { get; }

Property Value

IGameEvent<EnterBleedoutEventArgs>

OnEquip

Raised on the game's TESEquipEvent.

IGameEvent<EquipEventArgs> OnEquip { get; }

Property Value

IGameEvent<EquipEventArgs>

OnEventProcessed

Raised on the game's BGSEventProcessedEvent.

IGameEvent<EventProcessedEventArgs> OnEventProcessed { get; }

Property Value

IGameEvent<EventProcessedEventArgs>

OnFormDelete

Raised on the game's TESFormDeleteEvent.

IGameEvent<FormDeleteEventArgs> OnFormDelete { get; }

Property Value

IGameEvent<FormDeleteEventArgs>

OnFrame

Raised once per frame, from the game's startup onward.

IGameEvent<FrameEventArgs> OnFrame { get; }

Property Value

IGameEvent<FrameEventArgs>

Remarks

The event is raised at most once a millisecond. The main menu raised it about 1000 times a second. The game is not fully initialized on early frames. The player exists from around the main menu as the default character in no cell, so a handler that needs the save's player in the world waits for Is3DLoaded.

OnFurniture

Raised on the game's TESFurnitureEvent.

IGameEvent<FurnitureEventArgs> OnFurniture { get; }

Property Value

IGameEvent<FurnitureEventArgs>

OnGrabRelease

Raised on the game's TESGrabReleaseEvent.

IGameEvent<GrabReleaseEventArgs> OnGrabRelease { get; }

Property Value

IGameEvent<GrabReleaseEventArgs>

OnHit

Raised on the game's TESHitEvent.

IGameEvent<HitEventArgs> OnHit { get; }

Property Value

IGameEvent<HitEventArgs>

OnInitScript

Raised on the game's TESInitScriptEvent.

IGameEvent<InitScriptEventArgs> OnInitScript { get; }

Property Value

IGameEvent<InitScriptEventArgs>

OnInput

Raised on the game's InputEvent.

IGameEvent<InputEventArgs> OnInput { get; }

Property Value

IGameEvent<InputEventArgs>

OnInputLoaded

Raised once the game has loaded its input.

IGameEvent<InputLoadedEventArgs> OnInputLoaded { get; }

Property Value

IGameEvent<InputLoadedEventArgs>

Remarks

This arrives before OnDataLoaded, read from a run rather than declared by SKSE, whose header states no order between them. On Skyrim VR, this is the first event raised.

OnInventory

Raised on the game's Inventory::Event.

IGameEvent<InventoryEventArgs> OnInventory { get; }

Property Value

IGameEvent<InventoryEventArgs>

OnItemCrafted

Raised on the game's ItemCrafted::Event.

IGameEvent<ItemCraftedEventArgs> OnItemCrafted { get; }

Property Value

IGameEvent<ItemCraftedEventArgs>

OnItemHarvested

Raised on the game's TESHarvestedEvent::ItemHarvested.

IGameEvent<ItemHarvestedEventArgs> OnItemHarvested { get; }

Property Value

IGameEvent<ItemHarvestedEventArgs>

OnItemsPickpocketed

Raised on the game's ItemsPickpocketed::Event.

IGameEvent<ItemsPickpocketedEventArgs> OnItemsPickpocketed { get; }

Property Value

IGameEvent<ItemsPickpocketedEventArgs>

OnLevelIncrease

Raised on the game's LevelIncrease::Event.

IGameEvent<LevelIncreaseEventArgs> OnLevelIncrease { get; }

Property Value

IGameEvent<LevelIncreaseEventArgs>

OnLoadGame

Raised on the game's TESLoadGameEvent.

IGameEvent<LoadGameEventArgs> OnLoadGame { get; }

Property Value

IGameEvent<LoadGameEventArgs>

Remarks

OnSaveLoaded is raised before this for the same load.

OnLocationCleared

Raised on the game's LocationCleared::Event.

IGameEvent<LocationClearedEventArgs> OnLocationCleared { get; }

Property Value

IGameEvent<LocationClearedEventArgs>

OnLocationDiscovery

Raised on the game's LocationDiscovery::Event.

IGameEvent<LocationDiscoveryEventArgs> OnLocationDiscovery { get; }

Property Value

IGameEvent<LocationDiscoveryEventArgs>

OnLockChanged

Raised on the game's TESLockChangedEvent.

IGameEvent<LockChangedEventArgs> OnLockChanged { get; }

Property Value

IGameEvent<LockChangedEventArgs>

OnMagicEffectApply

Raised on the game's TESMagicEffectApplyEvent.

IGameEvent<MagicEffectApplyEventArgs> OnMagicEffectApply { get; }

Property Value

IGameEvent<MagicEffectApplyEventArgs>

OnMagicWardHit

Raised on the game's TESMagicWardHitEvent.

IGameEvent<MagicWardHitEventArgs> OnMagicWardHit { get; }

Property Value

IGameEvent<MagicWardHitEventArgs>

OnMenuModeChange

Raised on the game's MenuModeChangeEvent.

IGameEvent<MenuModeChangeEventArgs> OnMenuModeChange { get; }

Property Value

IGameEvent<MenuModeChangeEventArgs>

OnMenuOpenClose

Raised on the game's MenuOpenCloseEvent.

IGameEvent<MenuOpenCloseEventArgs> OnMenuOpenClose { get; }

Property Value

IGameEvent<MenuOpenCloseEventArgs>

OnModCallback

Raised on SKSE's ModCallbackEvent.

IGameEvent<ModCallbackEventArgs> OnModCallback { get; }

Property Value

IGameEvent<ModCallbackEventArgs>

OnMoveAttachDetach

Raised on the game's TESMoveAttachDetachEvent.

IGameEvent<MoveAttachDetachEventArgs> OnMoveAttachDetach { get; }

Property Value

IGameEvent<MoveAttachDetachEventArgs>

OnNewGame

Raised once a new character has been made, before the game has loaded them.

IGameEvent<NewGameEventArgs> OnNewGame { get; }

Property Value

IGameEvent<NewGameEventArgs>

Remarks

SKSE reports this, not the game. The game's own load event reports a save being read, and a new game reads none, so this is the only place to set up what a plugin stores per character.

OnNewGameOrSaveLoading

Raised as a new game starts or a save starts loading, before OnNewGame or OnSaveLoading.

IGameEvent<NewGameOrSaveLoadingEventArgs> OnNewGameOrSaveLoading { get; }

Property Value

IGameEvent<NewGameOrSaveLoadingEventArgs>

Remarks

NewGameOrSaveLoading is canceled on this event.

OnNiNodeUpdate

Raised on SKSE's NiNodeUpdateEvent.

IGameEvent<NiNodeUpdateEventArgs> OnNiNodeUpdate { get; }

Property Value

IGameEvent<NiNodeUpdateEventArgs>

OnObjectLoaded

Raised on the game's TESObjectLoadedEvent.

IGameEvent<ObjectLoadedEventArgs> OnObjectLoaded { get; }

Property Value

IGameEvent<ObjectLoadedEventArgs>

OnObjectREFRTranslation

Raised on the game's TESObjectREFRTranslationEvent.

IGameEvent<ObjectREFRTranslationEventArgs> OnObjectREFRTranslation { get; }

Property Value

IGameEvent<ObjectREFRTranslationEventArgs>

OnObjectiveState

Raised on the game's ObjectiveState::Event.

IGameEvent<ObjectiveStateEventArgs> OnObjectiveState { get; }

Property Value

IGameEvent<ObjectiveStateEventArgs>

OnOpenClose

Raised on the game's TESOpenCloseEvent.

IGameEvent<OpenCloseEventArgs> OnOpenClose { get; }

Property Value

IGameEvent<OpenCloseEventArgs>

OnPackage

Raised on the game's TESPackageEvent.

IGameEvent<PackageEventArgs> OnPackage { get; }

Property Value

IGameEvent<PackageEventArgs>

OnPapyrusLog

Raised on the game's LogEvent.

IGameEvent<PapyrusLogEventArgs> OnPapyrusLog { get; }

Property Value

IGameEvent<PapyrusLogEventArgs>

OnPapyrusStats

Raised on the game's StatsEvent.

IGameEvent<PapyrusStatsEventArgs> OnPapyrusStats { get; }

Property Value

IGameEvent<PapyrusStatsEventArgs>

OnPerkEntryRun

Raised on the game's TESPerkEntryRunEvent.

IGameEvent<PerkEntryRunEventArgs> OnPerkEntryRun { get; }

Property Value

IGameEvent<PerkEntryRunEventArgs>

OnPlayerBowShot

Raised on the game's TESPlayerBowShotEvent.

IGameEvent<PlayerBowShotEventArgs> OnPlayerBowShot { get; }

Property Value

IGameEvent<PlayerBowShotEventArgs>

OnPositionPlayer

Raised on the game's PositionPlayerEvent.

IGameEvent<PositionPlayerEventArgs> OnPositionPlayer { get; }

Property Value

IGameEvent<PositionPlayerEventArgs>

OnPostLoad

Raised once every SKSE plugin has been loaded. Never raised on Skyrim VR, whose first event is OnInputLoaded.

IGameEvent<PostLoadEventArgs> OnPostLoad { get; }

Property Value

IGameEvent<PostLoadEventArgs>

Remarks

Start() runs while SKSE is still loading plugins. By this event every plugin library is in the process, so a module-handle lookup here determines whether a given plugin loaded.

OnPostPostLoad

Raised once every SKSE plugin has received OnPostLoad. Never raised on Skyrim VR, whose first event is OnInputLoaded.

IGameEvent<PostPostLoadEventArgs> OnPostPostLoad { get; }

Property Value

IGameEvent<PostPostLoadEventArgs>

Remarks

Work that depends on what other plugins did during OnPostLoad belongs here.

OnQuestInit

Raised on the game's TESQuestInitEvent.

IGameEvent<QuestInitEventArgs> OnQuestInit { get; }

Property Value

IGameEvent<QuestInitEventArgs>

OnQuestStage

Raised on the game's TESQuestStageEvent.

IGameEvent<QuestStageEventArgs> OnQuestStage { get; }

Property Value

IGameEvent<QuestStageEventArgs>

OnQuestStageItemDone

Raised on the game's TESQuestStageItemDoneEvent.

IGameEvent<QuestStageItemDoneEventArgs> OnQuestStageItemDone { get; }

Property Value

IGameEvent<QuestStageItemDoneEventArgs>

OnQuestStartStop

Raised on the game's TESQuestStartStopEvent.

IGameEvent<QuestStartStopEventArgs> OnQuestStartStop { get; }

Property Value

IGameEvent<QuestStartStopEventArgs>

OnQuestStatus

Raised on the game's QuestStatus::Event.

IGameEvent<QuestStatusEventArgs> OnQuestStatus { get; }

Property Value

IGameEvent<QuestStatusEventArgs>

OnReset

Raised on the game's TESResetEvent.

IGameEvent<ResetEventArgs> OnReset { get; }

Property Value

IGameEvent<ResetEventArgs>

OnResolveNPCTemplates

Raised on the game's TESResolveNPCTemplatesEvent.

IGameEvent<ResolveNPCTemplatesEventArgs> OnResolveNPCTemplates { get; }

Property Value

IGameEvent<ResolveNPCTemplatesEventArgs>

OnSaveDeleted

Raised as a save file is deleted, naming it.

IGameEvent<SaveEventArgs> OnSaveDeleted { get; }

Property Value

IGameEvent<SaveEventArgs>

Remarks

The state a plugin stored in that save's co-save is deleted with it. A plugin that also stored state elsewhere under the same save should delete that itself, on this event.

OnSaveLoaded

Raised once the game has finished reading a save file. A plugin looks up again what it released on OnSaveLoading.

IGameEvent<SaveLoadedEventArgs> OnSaveLoaded { get; }

Property Value

IGameEvent<SaveLoadedEventArgs>

Remarks

OnLoadGame, the game's own event, is raised after this for the same load.

OnSaveLoading

Raised before the game reads a save file, while the world loaded before it is still in memory, so views into it are still valid.

IGameEvent<SaveEventArgs> OnSaveLoading { get; }

Property Value

IGameEvent<SaveEventArgs>

Remarks

Release every view on this event. A view is a pointer into the game's memory, and loading rebuilds that memory. A view retained across a load points at whatever occupies that address afterward, which is a different object or nothing at all, and reading through it returns plausible values rather than failing. A form ID is a number and survives, to be looked up again on the other side.

OnSaveWriting

Raised as the game begins writing a save file, naming it.

IGameEvent<SaveEventArgs> OnSaveWriting { get; }

Property Value

IGameEvent<SaveEventArgs>

Remarks

State a plugin writes to the co-save needs nothing here, IPerPluginSavedState writing it as part of the save itself. This is for state a plugin stores elsewhere under the same save. OnSaveDeleted is the other half of that pair.

A run showed this arriving before the co-save and before the save file, both still being written when the handler ran, so neither can be read from here. The name came without the extension a read includes. Whether a name always comes is not stated in SKSE's header, so FileName is nullable here as on the other two.

OnScene

Raised on the game's TESSceneEvent.

IGameEvent<SceneEventArgs> OnScene { get; }

Property Value

IGameEvent<SceneEventArgs>

OnSceneAction

Raised on the game's TESSceneActionEvent.

IGameEvent<SceneActionEventArgs> OnSceneAction { get; }

Property Value

IGameEvent<SceneActionEventArgs>

OnScenePhase

Raised on the game's TESScenePhaseEvent.

IGameEvent<ScenePhaseEventArgs> OnScenePhase { get; }

Property Value

IGameEvent<ScenePhaseEventArgs>

OnSell

Raised on the game's TESSellEvent.

IGameEvent<SellEventArgs> OnSell { get; }

Property Value

IGameEvent<SellEventArgs>

OnShoutAttack

Raised on the game's ShoutAttack::Event.

IGameEvent<ShoutAttackEventArgs> OnShoutAttack { get; }

Property Value

IGameEvent<ShoutAttackEventArgs>

OnSkillIncrease

Raised on the game's SkillIncrease::Event.

IGameEvent<SkillIncreaseEventArgs> OnSkillIncrease { get; }

Property Value

IGameEvent<SkillIncreaseEventArgs>

OnSleepStart

Raised on the game's TESSleepStartEvent.

IGameEvent<SleepStartEventArgs> OnSleepStart { get; }

Property Value

IGameEvent<SleepStartEventArgs>

OnSleepStop

Raised on the game's TESSleepStopEvent.

IGameEvent<SleepStopEventArgs> OnSleepStop { get; }

Property Value

IGameEvent<SleepStopEventArgs>

OnSoulsTrapped

Raised on the game's SoulsTrapped::Event.

IGameEvent<SoulsTrappedEventArgs> OnSoulsTrapped { get; }

Property Value

IGameEvent<SoulsTrappedEventArgs>

OnSpellCast

Raised on the game's TESSpellCastEvent.

IGameEvent<SpellCastEventArgs> OnSpellCast { get; }

Property Value

IGameEvent<SpellCastEventArgs>

OnSpellsLearned

Raised on the game's SpellsLearned::Event.

IGameEvent<SpellsLearnedEventArgs> OnSpellsLearned { get; }

Property Value

IGameEvent<SpellsLearnedEventArgs>

OnSwitchRaceComplete

Raised on the game's TESSwitchRaceCompleteEvent.

IGameEvent<SwitchRaceCompleteEventArgs> OnSwitchRaceComplete { get; }

Property Value

IGameEvent<SwitchRaceCompleteEventArgs>

OnTopicInfo

Raised on the game's TESTopicInfoEvent.

IGameEvent<TopicInfoEventArgs> OnTopicInfo { get; }

Property Value

IGameEvent<TopicInfoEventArgs>

OnTrackedStats

Raised on the game's TESTrackedStatsEvent.

IGameEvent<TrackedStatsEventArgs> OnTrackedStats { get; }

Property Value

IGameEvent<TrackedStatsEventArgs>

OnTrapHit

Raised on the game's TESTrapHitEvent.

IGameEvent<TrapHitEventArgs> OnTrapHit { get; }

Property Value

IGameEvent<TrapHitEventArgs>

OnTrigger

Raised on the game's TESTriggerEvent.

IGameEvent<TriggerEventArgs> OnTrigger { get; }

Property Value

IGameEvent<TriggerEventArgs>

OnTriggerEnter

Raised on the game's TESTriggerEnterEvent.

IGameEvent<TriggerEnterEventArgs> OnTriggerEnter { get; }

Property Value

IGameEvent<TriggerEnterEventArgs>

OnTriggerLeave

Raised on the game's TESTriggerLeaveEvent.

IGameEvent<TriggerLeaveEventArgs> OnTriggerLeave { get; }

Property Value

IGameEvent<TriggerLeaveEventArgs>

OnUniqueIDChange

Raised on the game's TESUniqueIDChangeEvent.

IGameEvent<UniqueIDChangeEventArgs> OnUniqueIDChange { get; }

Property Value

IGameEvent<UniqueIDChangeEventArgs>

OnUserEventEnabled

Raised on the game's UserEventEnabled.

IGameEvent<UserEventEnabledEventArgs> OnUserEventEnabled { get; }

Property Value

IGameEvent<UserEventEnabledEventArgs>

OnWaitStart

Raised on the game's TESWaitStartEvent.

IGameEvent<WaitStartEventArgs> OnWaitStart { get; }

Property Value

IGameEvent<WaitStartEventArgs>

OnWaitStop

Raised on the game's TESWaitStopEvent.

IGameEvent<WaitStopEventArgs> OnWaitStop { get; }

Property Value

IGameEvent<WaitStopEventArgs>