Difference between revisions of "Cell Attachment Analysis"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Rasikko
imported>Rasikko
 
Line 9: Line 9:
Player leaves the reference's parent Cell: '''[OnCellDetach]'''<br>
Player leaves the reference's parent Cell: '''[OnCellDetach]'''<br>
<br>
<br>
Scenario 2
Scenario 2<br>
Player is in the reference's parent cell:  '''[OnCellAttach]'''<br>
Player is in the reference's parent cell:  '''[OnCellAttach]'''<br>
Reference moves to another cell:   '''[OnDetachedFromCell]'''<br>
Reference moves to another cell:   '''[OnDetachedFromCell]'''<br>
Line 31: Line 31:
Player is in the cell that the reference just left from scenario 5: --<br>
Player is in the cell that the reference just left from scenario 5: --<br>
Player moves back to the previous cell where the reference is: '''[OnCellAttach]'''<br>
Player moves back to the previous cell where the reference is: '''[OnCellAttach]'''<br>
Player leaves the reference's parent cell: '''[OnCellDetach]'''<br><br>
Scenario 7<br>
Player is in the reference's parent cell: '''[OnCellAttach]'''<br>
Player leaves the reference's parent cell: '''[OnCellDetach]'''<br>
Player leaves the reference's parent cell: '''[OnCellDetach]'''<br>
Reference moves to the player's cell: '''[OnAttachedToCell]'''<br><br>
Scenario 8<br>
Player leaves the reference's new parent cell from scenario 7: '''[OnCellDetach]'''<br>
Reference moves to the player's new cell: '''[OnAttachedToCell]'''<br>
Player leaves the reference's newly attached cell: '''[OnCellDetach]'''<br>


--[[User:Rasikko|Rasikko]] ([[User talk:Rasikko|talk]]) 2021-10-15T15:30:21 (EDT)
--[[User:Rasikko|Rasikko]] ([[User talk:Rasikko|talk]]) 2021-10-20T00:02:13 (EDT)

Latest revision as of 23:02, 19 October 2021

This more of a self reminder for myself but I hope it proves useful to others.

It's been proven that cell attachment/detachment is the result of the engine checking a bool on the objectreference as to whether or not its cell is/was attached/detached. See OnCellAttach - ObjectReference talk page.

However, I'm going to extend the basic info about these two things a bit by breaking it down into 6 scenarios.

Scenario 1
Player is in the reference's parent Cell: [OnCellAttach]
Player leaves the reference's parent Cell: [OnCellDetach]

Scenario 2
Player is in the reference's parent cell: [OnCellAttach]
Reference moves to another cell: [OnDetachedFromCell]
-Because the reference has moved from its previously attached cell, to a cell that is currently not attached.

Scenario 3
Player is in the reference's parent cell: [OnCellAttach]
Player leaves the reference's parent cell: [OnCellDetach]
Reference moves to another cell: [OnAttachedToCell]
-Because the reference and the player both moved to the same cell and in the case of the reference, this new cell became attached.

Scenario 4
Player leaves the reference's newly attached parent cell: [OnCellDetach]

Scenario 5
Player is in the reference's parent cell from scenario 3: --
Reference moves back to the previous cell: [OnDetachedFromCell]
-Because the reference has moved from currently attached parent cell to the previous cell which was detached.

Scenario 6
Player is in the cell that the reference just left from scenario 5: --
Player moves back to the previous cell where the reference is: [OnCellAttach]
Player leaves the reference's parent cell: [OnCellDetach]

Scenario 7
Player is in the reference's parent cell: [OnCellAttach]
Player leaves the reference's parent cell: [OnCellDetach]
Reference moves to the player's cell: [OnAttachedToCell]

Scenario 8
Player leaves the reference's new parent cell from scenario 7: [OnCellDetach]
Reference moves to the player's new cell: [OnAttachedToCell]
Player leaves the reference's newly attached cell: [OnCellDetach]

--Rasikko (talk) 2021-10-20T00:02:13 (EDT)