Difference between revisions of "OnReset - ObjectReference"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Arthmoor
(Corrected the contradictory information regarding Quests and Aliases since OnReset is NOT a member of either of these.)
m (→‎Notes: Fires after OnCellAttach)
 
(One intermediate revision by one other user not shown)
Line 2: Line 2:
[[Category:Papyrus]]
[[Category:Papyrus]]
[[Category:Events]]
[[Category:Events]]
'''Member of:''' [[ObjectReference Script]]
'''Member of:''' [[ObjectReference Script]], [[ReferenceAlias Script]], [[ActiveMagicEffect Script]]


Event called when the object is reset.
Event called when the object is reset.
Line 27: Line 27:
* This event does not block other events, functions, or properties from running (unlike OnInit).
* This event does not block other events, functions, or properties from running (unlike OnInit).
* Created refs never reset (i.e. refs placed via [[PlaceAtMe_-_ObjectReference|PlaceAtMe]])
* Created refs never reset (i.e. refs placed via [[PlaceAtMe_-_ObjectReference|PlaceAtMe]])
* This event '''does not''' fire for ''Quests'' that have been reset, and does not seem to be related to the quest Reset() function. (This event is only defined within the script objects listed in the "Member Of" line at the top of this page. But, see these pages for more discussion: [[Talk:Reset_-_Quest|Talk:Reset]], [[Talk:OnReset_-_ObjectReference|Talk:OnReset]])
* This event will fire after [[OnCellAttach - ObjectReference]].


== See Also ==
== See Also ==
*[[ObjectReference Script]]
*[[ObjectReference Script]]

Latest revision as of 09:10, 2 June 2023

Member of: ObjectReference Script, ReferenceAlias Script, ActiveMagicEffect Script

Event called when the object is reset.

Syntax[edit | edit source]

Event OnReset()

Parameters[edit | edit source]

None.

Examples[edit | edit source]

Event OnReset()
  Debug.Trace("This object was reset")
endEvent

Notes[edit | edit source]

  • Your script's data has already been reset by the time you receive this event (and your OnInit has been run), so if you need to retain any information between Resets, you need to store the information somewhere else.
  • Aliases receive this event since it targets the ObjectReference a ReferenceAlias points to.
  • Any event registrations that have been done before the object was reset (and before OnInit would have been called) will have been cleared.
  • This event does not block other events, functions, or properties from running (unlike OnInit).
  • Created refs never reset (i.e. refs placed via PlaceAtMe)
  • This event does not fire for Quests that have been reset, and does not seem to be related to the quest Reset() function. (This event is only defined within the script objects listed in the "Member Of" line at the top of this page. But, see these pages for more discussion: Talk:Reset, Talk:OnReset)
  • This event will fire after OnCellAttach - ObjectReference.

See Also[edit | edit source]