Interface IGameEvents
- Namespace
- SkyrimForge.Events
- 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 raises OnFrame, the SKSE events from OnPostLoad to OnSaveDeleted other than OnDataLoaded, mouse events mostly, and most events of menus, the crosshair, sleeping, waiting, crafting, and loading cells. Most other events arrive on worker threads, or on a cell-loading thread. Handlers on different worker threads run at the same time. In a handler on any of those threads, await WaitForGameThreadAsync(IUtility, CancellationToken) before changing the game or calling a member documented as called on the game's thread, or queue that work through ITaskQueue.
Properties
OnAction
Raised on SKSE's ActionEvent.
IGameEvent<ActionEventArgs> OnAction { get; }
Property Value
Remarks
Corresponds to Papyrus's OnActorAction.
OnActivate
Raised on the game's TESActivateEvent.
IGameEvent<ActivateEventArgs> OnActivate { get; }
Property Value
OnActiveEffectApplyRemove
Raised on the game's TESActiveEffectApplyRemoveEvent.
IGameEvent<ActiveEffectApplyRemoveEventArgs> OnActiveEffectApplyRemove { get; }
Property Value
OnActorCell
Raised on the game's BGSActorCellEvent.
IGameEvent<ActorCellEventArgs> OnActorCell { get; }
Property Value
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
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
OnActorLocationChange
Raised on the game's TESActorLocationChangeEvent.
IGameEvent<ActorLocationChangeEventArgs> OnActorLocationChange { get; }
Property Value
Remarks
Corresponds to Papyrus's OnLocationChange.
OnBookRead
Raised on the game's TESBookReadEvent.
IGameEvent<BookReadEventArgs> OnBookRead { get; }
Property Value
Remarks
Corresponds to Papyrus's OnRead.
OnBooksRead
Raised on the game's BooksRead::Event.
IGameEvent<BooksReadEventArgs> OnBooksRead { get; }
Property Value
OnCamera
Raised on SKSE's CameraEvent.
IGameEvent<CameraEventArgs> OnCamera { get; }
Property Value
Remarks
Corresponds to Papyrus's OnPlayerCameraState.
OnCellAttachDetach
Raised on the game's TESCellAttachDetachEvent.
IGameEvent<CellAttachDetachEventArgs> OnCellAttachDetach { get; }
Property Value
Remarks
Corresponds to Papyrus's OnCellAttach and OnCellDetach.
OnCellFullyLoaded
Raised on the game's TESCellFullyLoadedEvent.
IGameEvent<CellFullyLoadedEventArgs> OnCellFullyLoaded { get; }
Property Value
Remarks
Corresponds to Papyrus's OnCellLoad, but is raised for the cell rather than for each object in it.
OnCellReadyToApplyDecals
Raised on the game's TESCellReadyToApplyDecalsEvent.
IGameEvent<CellReadyToApplyDecalsEventArgs> OnCellReadyToApplyDecals { get; }
Property Value
OnChestsLooted
Raised on the game's ChestsLooted::Event.
IGameEvent<ChestsLootedEventArgs> OnChestsLooted { get; }
Property Value
OnCombat
Raised on the game's TESCombatEvent.
IGameEvent<CombatEventArgs> OnCombat { get; }
Property Value
Remarks
Corresponds to Papyrus's OnCombatStateChanged. The state that ends a fight has no target, so record an actor fighting the player during the fight.
OnContainerChanged
Raised on the game's TESContainerChangedEvent.
IGameEvent<ContainerChangedEventArgs> OnContainerChanged { get; }
Property Value
Remarks
Corresponds to Papyrus's OnItemAdded, OnItemRemoved, and OnContainerChanged.
OnCriticalHit
Raised on the game's CriticalHit::Event.
IGameEvent<CriticalHitEventArgs> OnCriticalHit { get; }
Property Value
OnCrosshairReference
Raised on SKSE's CrosshairRefEvent.
IGameEvent<CrosshairReferenceEventArgs> OnCrosshairReference { get; }
Property Value
Remarks
Corresponds to Papyrus's OnCrosshairRefChange.
OnDataLoaded
Raised once the game has loaded its data files.
IGameEvent<DataLoadedEventArgs> OnDataLoaded { get; }
Property Value
Remarks
A form can first be looked up by editor ID here, and the arrays TESDataHandler exposes are populated only by now.
Raised once per process. A handler subscribed in Start() receives it.
Menu, input, and SKSE events can arrive before this. The game's events about forms and references, OnInitScript among them, arrive only after it.
OnDeath
Raised on the game's TESDeathEvent.
IGameEvent<DeathEventArgs> OnDeath { get; }
Property Value
Remarks
Raised with Dead false as the actor starts dying, as Papyrus's OnDying is, and true once dead, as Papyrus's OnDeath is.
OnDestructionStageChanged
Raised on the game's TESDestructionStageChangedEvent.
IGameEvent<DestructionStageChangedEventArgs> OnDestructionStageChanged { get; }
Property Value
OnDisarmed
Raised on the game's DisarmedEvent::Event.
IGameEvent<DisarmedEventArgs> OnDisarmed { get; }
Property Value
OnDragonSoulsGained
Raised on the game's DragonSoulsGained::Event.
IGameEvent<DragonSoulsGainedEventArgs> OnDragonSoulsGained { get; }
Property Value
OnEnterBleedout
Raised on the game's TESEnterBleedoutEvent.
IGameEvent<EnterBleedoutEventArgs> OnEnterBleedout { get; }
Property Value
OnEquip
Raised on the game's TESEquipEvent.
IGameEvent<EquipEventArgs> OnEquip { get; }
Property Value
Remarks
Corresponds to Papyrus's OnObjectEquipped, OnObjectUnequipped, OnEquipped, and OnUnequipped.
OnEventProcessed
Raised on the game's BGSEventProcessedEvent.
IGameEvent<EventProcessedEventArgs> OnEventProcessed { get; }
Property Value
OnFormDelete
Raised on the game's TESFormDeleteEvent.
IGameEvent<FormDeleteEventArgs> OnFormDelete { get; }
Property Value
OnFrame
Raised once per frame, from the game's startup onward.
IGameEvent<FrameEventArgs> OnFrame { get; }
Property Value
Remarks
The game is not fully initialized on early frames, and the save's player is in the world only once the player's 3D has loaded.
ObjectReference.Is3DLoaded tests that, and ObjectReference.WaitFor3DLoadAsync waits for it.
OnFurniture
Raised on the game's TESFurnitureEvent.
IGameEvent<FurnitureEventArgs> OnFurniture { get; }
Property Value
Remarks
Corresponds to Papyrus's OnSit and OnGetUp.
OnGrabRelease
Raised on the game's TESGrabReleaseEvent.
IGameEvent<GrabReleaseEventArgs> OnGrabRelease { get; }
Property Value
Remarks
Corresponds to Papyrus's OnGrab and OnRelease.
OnHit
Raised on the game's TESHitEvent.
IGameEvent<HitEventArgs> OnHit { get; }
Property Value
OnInitScript
Raised on the game's TESInitScriptEvent.
IGameEvent<InitScriptEventArgs> OnInitScript { get; }
Property Value
OnInput
Raised on the game's InputEvent.
IGameEvent<InputEventArgs> OnInput { get; }
Property Value
OnInputLoaded
Raised once the game has loaded its input, before OnDataLoaded. On Skyrim VR, this is the first event raised.
IGameEvent<InputLoadedEventArgs> OnInputLoaded { get; }
Property Value
OnInventory
Raised on the game's Inventory::Event.
IGameEvent<InventoryEventArgs> OnInventory { get; }
Property Value
OnItemCrafted
Raised on the game's ItemCrafted::Event.
IGameEvent<ItemCraftedEventArgs> OnItemCrafted { get; }
Property Value
OnItemHarvested
Raised on the game's TESHarvestedEvent::ItemHarvested.
IGameEvent<ItemHarvestedEventArgs> OnItemHarvested { get; }
Property Value
OnItemsPickpocketed
Raised on the game's ItemsPickpocketed::Event.
IGameEvent<ItemsPickpocketedEventArgs> OnItemsPickpocketed { get; }
Property Value
OnLevelIncrease
Raised on the game's LevelIncrease::Event.
IGameEvent<LevelIncreaseEventArgs> OnLevelIncrease { get; }
Property Value
OnLoadGame
Raised on the game's TESLoadGameEvent.
IGameEvent<LoadGameEventArgs> OnLoadGame { get; }
Property Value
Remarks
OnSaveLoaded is raised before this for the same load. Corresponds to Papyrus's OnPlayerLoadGame.
OnLocationCleared
Raised on the game's LocationCleared::Event.
IGameEvent<LocationClearedEventArgs> OnLocationCleared { get; }
Property Value
OnLocationDiscovery
Raised on the game's LocationDiscovery::Event.
IGameEvent<LocationDiscoveryEventArgs> OnLocationDiscovery { get; }
Property Value
OnLockChanged
Raised on the game's TESLockChangedEvent.
IGameEvent<LockChangedEventArgs> OnLockChanged { get; }
Property Value
Remarks
Corresponds to Papyrus's OnLockStateChanged.
OnMagicEffectApply
Raised on the game's TESMagicEffectApplyEvent.
IGameEvent<MagicEffectApplyEventArgs> OnMagicEffectApply { get; }
Property Value
OnMagicWardHit
Raised on the game's TESMagicWardHitEvent.
IGameEvent<MagicWardHitEventArgs> OnMagicWardHit { get; }
Property Value
OnMenuModeChange
Raised on the game's MenuModeChangeEvent.
IGameEvent<MenuModeChangeEventArgs> OnMenuModeChange { get; }
Property Value
OnMenuOpenClose
Raised on the game's MenuOpenCloseEvent.
IGameEvent<MenuOpenCloseEventArgs> OnMenuOpenClose { get; }
Property Value
Remarks
Corresponds to Papyrus's OnMenuOpen and OnMenuClose.
OnModCallback
Raised on SKSE's ModCallbackEvent.
IGameEvent<ModCallbackEventArgs> OnModCallback { get; }
Property Value
Remarks
Papyrus's SendModEvent and Send(string, string, float, IForm?) raise it, on the thread that sends the mod event.
OnMoveAttachDetach
Raised on the game's TESMoveAttachDetachEvent.
IGameEvent<MoveAttachDetachEventArgs> OnMoveAttachDetach { get; }
Property Value
Remarks
Corresponds to Papyrus's OnAttachedToCell and OnDetachedFromCell.
OnNewGame
Raised once a new character has been made, before the game has loaded them.
IGameEvent<NewGameEventArgs> OnNewGame { get; }
Property Value
Remarks
A new game reads no save, so the game's own load event does not report it.
OnNewGameOrSaveLoaded
Raised as a new game starts, after OnNewGame, and once a save finishes loading, after OnSaveLoaded.
IGameEvent<NewGameOrSaveLoadedEventArgs> OnNewGameOrSaveLoaded { get; }
Property Value
Remarks
For a new game it is raised before the game has loaded the character, as OnNewGame is.
OnNewGameOrSaveLoading
Raised as a new game starts or a save starts loading, before OnNewGame or OnSaveLoading.
IGameEvent<NewGameOrSaveLoadingEventArgs> OnNewGameOrSaveLoading { get; }
Property Value
Remarks
NewGameOrSaveLoading is canceled on this event.
OnNiNodeUpdate
Raised on SKSE's NiNodeUpdateEvent.
IGameEvent<NiNodeUpdateEventArgs> OnNiNodeUpdate { get; }
Property Value
OnObjectLoaded
Raised on the game's TESObjectLoadedEvent.
IGameEvent<ObjectLoadedEventArgs> OnObjectLoaded { get; }
Property Value
Remarks
Corresponds to Papyrus's OnLoad and OnUnload.
OnObjectREFRTranslation
Raised on the game's TESObjectREFRTranslationEvent.
IGameEvent<ObjectREFRTranslationEventArgs> OnObjectREFRTranslation { get; }
Property Value
OnObjectiveState
Raised on the game's ObjectiveState::Event.
IGameEvent<ObjectiveStateEventArgs> OnObjectiveState { get; }
Property Value
OnOpenClose
Raised on the game's TESOpenCloseEvent.
IGameEvent<OpenCloseEventArgs> OnOpenClose { get; }
Property Value
Remarks
Corresponds to Papyrus's OnOpen and OnClose.
OnPackage
Raised on the game's TESPackageEvent.
IGameEvent<PackageEventArgs> OnPackage { get; }
Property Value
OnPapyrusLog
Raised on the game's LogEvent.
IGameEvent<PapyrusLogEventArgs> OnPapyrusLog { get; }
Property Value
OnPapyrusStats
Raised on the game's StatsEvent.
IGameEvent<PapyrusStatsEventArgs> OnPapyrusStats { get; }
Property Value
OnPerkEntryRun
Raised on the game's TESPerkEntryRunEvent.
IGameEvent<PerkEntryRunEventArgs> OnPerkEntryRun { get; }
Property Value
OnPlayerBowShot
Raised on the game's TESPlayerBowShotEvent.
IGameEvent<PlayerBowShotEventArgs> OnPlayerBowShot { get; }
Property Value
OnPositionPlayer
Raised on the game's PositionPlayerEvent.
IGameEvent<PositionPlayerEventArgs> OnPositionPlayer { get; }
Property Value
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
Remarks
Start() runs while SKSE is still loading plugins, so test here whether another 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
OnQuestInit
Raised on the game's TESQuestInitEvent.
IGameEvent<QuestInitEventArgs> OnQuestInit { get; }
Property Value
OnQuestStage
Raised on the game's TESQuestStageEvent.
IGameEvent<QuestStageEventArgs> OnQuestStage { get; }
Property Value
OnQuestStageItemDone
Raised on the game's TESQuestStageItemDoneEvent.
IGameEvent<QuestStageItemDoneEventArgs> OnQuestStageItemDone { get; }
Property Value
OnQuestStartStop
Raised on the game's TESQuestStartStopEvent.
IGameEvent<QuestStartStopEventArgs> OnQuestStartStop { get; }
Property Value
OnQuestStatus
Raised on the game's QuestStatus::Event.
IGameEvent<QuestStatusEventArgs> OnQuestStatus { get; }
Property Value
OnReset
Raised on the game's TESResetEvent.
IGameEvent<ResetEventArgs> OnReset { get; }
Property Value
OnResolveNPCTemplates
Raised on the game's TESResolveNPCTemplatesEvent.
IGameEvent<ResolveNPCTemplatesEventArgs> OnResolveNPCTemplates { get; }
Property Value
OnSaveDeleted
Raised as a save file is deleted.
IGameEvent<SaveEventArgs> OnSaveDeleted { get; }
Property Value
Remarks
The state a plugin stored in that save's co-save is deleted with it.
OnSaveLoaded
Raised once the game has finished trying to read a save file.
IGameEvent<SaveLoadedEventArgs> OnSaveLoaded { get; }
Property Value
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 views into the current world are still valid.
IGameEvent<SaveEventArgs> OnSaveLoading { get; }
Property Value
Remarks
Release every view on this event. Loading rebuilds the game's memory, and reading a retained view returns plausible values rather than failing. A form ID remains valid across the load, so look the form up again afterward.
OnSaveWriting
Raised as the game begins writing a save file.
IGameEvent<SaveEventArgs> OnSaveWriting { get; }
Property Value
Remarks
IPerPluginSavedState writes co-save state without this event, which serves state a plugin stores elsewhere. The save file and the co-save are still being written, so neither can be read from here.
OnScene
Raised on the game's TESSceneEvent.
IGameEvent<SceneEventArgs> OnScene { get; }
Property Value
OnSceneAction
Raised on the game's TESSceneActionEvent.
IGameEvent<SceneActionEventArgs> OnSceneAction { get; }
Property Value
OnScenePhase
Raised on the game's TESScenePhaseEvent.
IGameEvent<ScenePhaseEventArgs> OnScenePhase { get; }
Property Value
OnSell
Raised on the game's TESSellEvent.
IGameEvent<SellEventArgs> OnSell { get; }
Property Value
OnShoutAttack
Raised on the game's ShoutAttack::Event.
IGameEvent<ShoutAttackEventArgs> OnShoutAttack { get; }
Property Value
OnSkillIncrease
Raised on the game's SkillIncrease::Event.
IGameEvent<SkillIncreaseEventArgs> OnSkillIncrease { get; }
Property Value
OnSleepStart
Raised on the game's TESSleepStartEvent.
IGameEvent<SleepStartEventArgs> OnSleepStart { get; }
Property Value
OnSleepStop
Raised on the game's TESSleepStopEvent.
IGameEvent<SleepStopEventArgs> OnSleepStop { get; }
Property Value
OnSoulsTrapped
Raised on the game's SoulsTrapped::Event.
IGameEvent<SoulsTrappedEventArgs> OnSoulsTrapped { get; }
Property Value
OnSpellCast
Raised on the game's TESSpellCastEvent.
IGameEvent<SpellCastEventArgs> OnSpellCast { get; }
Property Value
OnSpellsLearned
Raised on the game's SpellsLearned::Event.
IGameEvent<SpellsLearnedEventArgs> OnSpellsLearned { get; }
Property Value
OnSwitchRaceComplete
Raised on the game's TESSwitchRaceCompleteEvent.
IGameEvent<SwitchRaceCompleteEventArgs> OnSwitchRaceComplete { get; }
Property Value
Remarks
Corresponds to Papyrus's OnRaceSwitchComplete.
OnTopicInfo
Raised on the game's TESTopicInfoEvent.
IGameEvent<TopicInfoEventArgs> OnTopicInfo { get; }
Property Value
OnTrackedStats
Raised on the game's TESTrackedStatsEvent.
IGameEvent<TrackedStatsEventArgs> OnTrackedStats { get; }
Property Value
Remarks
Corresponds to Papyrus's OnTrackedStatsEvent.
OnTrapHit
Raised on the game's TESTrapHitEvent.
IGameEvent<TrapHitEventArgs> OnTrapHit { get; }
Property Value
OnTrigger
Raised on the game's TESTriggerEvent.
IGameEvent<TriggerEventArgs> OnTrigger { get; }
Property Value
OnTriggerEnter
Raised on the game's TESTriggerEnterEvent.
IGameEvent<TriggerEnterEventArgs> OnTriggerEnter { get; }
Property Value
OnTriggerLeave
Raised on the game's TESTriggerLeaveEvent.
IGameEvent<TriggerLeaveEventArgs> OnTriggerLeave { get; }
Property Value
OnUniqueIDChange
Raised on the game's TESUniqueIDChangeEvent.
IGameEvent<UniqueIDChangeEventArgs> OnUniqueIDChange { get; }
Property Value
OnUserEventEnabled
Raised on the game's UserEventEnabled.
IGameEvent<UserEventEnabledEventArgs> OnUserEventEnabled { get; }
Property Value
OnWaitStart
Raised on the game's TESWaitStartEvent.
IGameEvent<WaitStartEventArgs> OnWaitStart { get; }
Property Value
OnWaitStop
Raised on the game's TESWaitStopEvent.
IGameEvent<WaitStopEventArgs> OnWaitStop { get; }
Property Value
Methods
OnKeyDown(Key, ModifierKeys)
Returns an event raised once as key goes down while the modifier keys modifiers are down,
unless a combination subscribed for key has more modifier keys and all of them are down.
IGameEvent<InputEventArgs> OnKeyDown(BSKeyboardDevice.Keys.Key key, ModifierKeys modifiers)
Parameters
keyBSKeyboardDevice.Keys.KeymodifiersModifierKeys
Returns
Remarks
That comparison includes the combinations other plugins subscribed. Raised mostly on a worker thread. In a handler, await WaitForGameThreadAsync(IUtility, CancellationToken) before changing the game or calling a member documented as called on the game's thread.
Exceptions
- ArgumentOutOfRangeException
modifiersincludes a value ModifierKeys does not define.