Difference between revisions of "RegisterForModEvent - Form"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>XJDHDR
(→‎Notes: Deregistration also occurs after an event fires.)
imported>Darkconsole
m (Undo revision 52358 - this is very not true. please present your case in the talk section and we'll work through it.)
Line 35: Line 35:
*Aliases and quests will automatically unregister for this event when the quest stops. Active magic effects will automatically unregister when they are removed.
*Aliases and quests will automatically unregister for this event when the quest stops. Active magic effects will automatically unregister when they are removed.
*You must register for ModEvents after every game load!
*You must register for ModEvents after every game load!
*A script is deregistered for a ModEvent after that event occurs.


== See Also ==
== See Also ==

Revision as of 03:54, 26 January 2019

SKSE Member of: ActiveMagicEffect Script, Alias Script, and Form Script

Registers a custom event callback for given event name. Registrations have to be refreshed after each game load.

Syntax

Function RegisterForModEvent(string eventName, string callbackName) native

;The event:
Event callbackName(string eventName, string strArg, float numArg, Form sender)
EndEvent

Parameters

  • callbackName: The name by which you can catch the event.

Examples

; Register to receive the ModEvent:
; named HectorHitMe with the callback of OnHectorHitMe
RegisterForModEvent("HectorHitMe", "OnHectorHitMe")

Event OnHectorHitMe(string eventName, string strArg, float numArg, Form sender)
;Do something
EndEvent

Notes

  • Aliases and quests will automatically unregister for this event when the quest stops. Active magic effects will automatically unregister when they are removed.
  • You must register for ModEvents after every game load!

See Also