Difference between revisions of "OnCellDetach - ObjectReference"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>DayDreamer
(→‎Notes: warning added)
imported>Rasikko
 
(One intermediate revision by the same user not shown)
Line 25: Line 25:


(For notes on the meaning of attachment, see the [[Talk:OnCellAttach_-_ObjectReference|talk]] page).
(For notes on the meaning of attachment, see the [[Talk:OnCellAttach_-_ObjectReference|talk]] page).
* If the reference is moved from its current cell to another, an object also leaving this reference's current cell will still trigger this event, while the reference being moved will trigger [[OnAttachedToCell - ObjectReference]]. In other words, these two events can fire at the same time.
* [[GetParentCell - ObjectReference]] will return the cell that will attach if the reference is being moved from this cell to an attached one. You can also store the parent cell before this event is ran if you want to know what cell is being detached.


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

Latest revision as of 09:28, 27 October 2021

Member of: ObjectReference Script

Event called when this reference's parent cell is detached.

Syntax[edit | edit source]

Event OnCellDetach()

Parameters[edit | edit source]

None.

Examples[edit | edit source]

Event OnCellDetach()
  Debug.Trace("Our parent cell has detached")
endEvent

Notes[edit | edit source]

Achtung.png This event is not reliably called between multiple intervening OnCellAttach - ObjectReference. This event may be called crossing cell boundaries even though very close to the player: as a follower, or as a cart driver.

(For notes on the meaning of attachment, see the talk page).

  • If the reference is moved from its current cell to another, an object also leaving this reference's current cell will still trigger this event, while the reference being moved will trigger OnAttachedToCell - ObjectReference. In other words, these two events can fire at the same time.
  • GetParentCell - ObjectReference will return the cell that will attach if the reference is being moved from this cell to an attached one. You can also store the parent cell before this event is ran if you want to know what cell is being detached.

See Also[edit | edit source]