Difference between revisions of "Cell Reset"

8,590 bytes added ,  11:01, 21 September 2016
→‎Exterior Cells: Removed two statements for further analysis.
imported>QQuix
(Pretty much a new page)
imported>QQuix
(→‎Exterior Cells: Removed two statements for further analysis.)
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Unfinished}}
{{Unfinished}}
{{TOCright}}


{{TOCright}}
Cells reset to their original setup after a number of hours after the player leaves them, which means that all objects return to their original places, containers return to their original contents etc.  
Cells reset to their original setup after a number of hours after the player leaves them, which means that all objects return to their original places, containers return to their original contents etc.  


Line 29: Line 27:


==How ?==
==How ?==
When the player leaves a cell, the game saves the game date and time (called Cell Detach Time) and sets the Cell Reset Hours to 72. Every hour, on the hour, the Cell Reset Hours count is reduced by 1. When the count goes from 0 to -1, the information about changes made to that cell are deleted from wherever the engine keeps it. ([[GetCellDetachTime]] and [[GetCellResetHours]] return those values).  
For each cell, the game keeps two important values to control Cell Reset:
 
*The Cell Detach Time stores the timestamp of the moment the player last left the cell. This is an integer calculated by: ( [[Special variables|GameDaysPassed]] * 24 ) +  [[Special variables|GameHour]] (rounded down, only the integer part of GameHour is used). The function [[GetCellDetachTime]] returns this value.
*The Cell Reset Hours stores the number of hours left until the cell will be considered for resetting. When the player leaves the cell, it is set to 72 and is reduced by 1 every hour, on the hour. The function [[GetCellResetHours]] returns this value.
 
 
Since control is done at round hours, the cell becomes subject to reset 72 hours after the next round hour after the player leaves the cell. In other words, after 72 to 73 hours after the player leaves the cell, e.g., it the player leaves a cell at 9:23 AM (or 9:01AM or 9:59AM), cell becomes subject to reset 3 days later, at 10:00 AM.
 


At the beginning of the game, all cells have the Cell Detach Time and the Cell Reset Hours values set to -1. When the player enters a cell, they are set to -1 as well (and will be initialized when the player leaves).
At the beginning of the game, all cells have the Cell Detach Time and the Cell Reset Hours values set to -1. When the player enters a cell, they are set to -1 as well (and will be initialized when the player leaves).




Since cell reset is done at round hours, it happens 72 hours after the next round hour after the player leaves the cell. In other words, cell reset happens from 72 to 73 hours after the player leaves the cell, e.g., it the player leaves a cell at 9:23 AM (or 9:01AM or 9:59AM), cell reset will happen 3 days later, at 10:00 AM.
The expiration of the cell reset timer, per se, does not trigger any immediate action, but will be used afterward by the actual Cell Reset mechanism.
 
 
Considering the term ‘Cell Reset’ as the act of removing references from the game, there are actually two ‘Cell Resets`, which we may call ‘External’ and ‘Internal’.
 
*The External Cell Reset (ECR) occurs when the game is saved after the Cell Reset Hours has expired. At this save, certain references are removed from the game and are not saved in the savegame file. It is called ‘external’ because it is done without the player returning to the cell. Vanilla Leveled List Creatures are examples of references removed by ECR.
 
*The Internal Cell Reset (ICR) occurs when the player reenters the cell after the Cell Reset Hours has expired. At this moment, certain references are removed from the game, are not loaded in the cell and, of course, will not be part of the next savegame file. Dead bodies are examples of references removed by ICR.
 
 
Which references are removed in each event depends on the type of object and some of its characteristics (Persistence, Respawn, etc). Actor’s behavior has been mapped and is reported below. Other types still need some research.
 
 
[[ResetInterior]] also plays a part in this game: it sets the Cell Reset Hours to zero, forcing it to expire, so the next time one of the Cell Resets occur (ECR or ICR), references will be deleted as if the 72 hours have passed. Besides, if the player enters the cell after [[ResetInterior]] is used (ICR), some additional references are deleted (which would not be deleted if [[ResetInterior]] were not used). But this is only true for cells that have been visited at least once.  For hidden cells, see the proper section further down.
 
==Cell Reset and Actors==
 
===Visited Interior Cells===
 
Considering the two events mentioned above, the ICR event splits into two scenarios, depending on the use of [[ResetInterior]], so there are three distinct scenarios when actors are removed:
*External Cell Reset (ECR) – When the game is saved after the cell expires (either naturally or by [[ResetInterior]]).
*Internal Cell Reset (ICR) – When the player reenters the cell after it expired and [[ResetInterior]] has not been used
*Internal Cell Reset Extended (ICRx) – When the player reenters the cell after [[ResetInterior]] has been used.




When the count runs out, the next time the game is saved, those changes are not saved.
The following table resumes what happens in each scenario to actors with various combinations of characteristics
{|border="1" cellpadding="5" cellspacing="0" style="text-align: center;"
|-
! scope="col" style="width: 80px; background:#efefef;" |CS / Dynamic
! scope="col" style="width: 80px; background:#efefef;" |Dead
! scope="col" style="width: 80px; background:#efefef;" | Persistent
! scope="col" style="width: 80px; background:#efefef;" |Respawn
! scope="col" style="width: 60px; background:#efefff;" |Not Removed
! scope="col" style="width: 60px; background:#efefef;" |ECR - External Cell Reset
! scope="col" style="width: 60px; background:#efefef;" |ICR - Internal Cell Reset
! scope="col" style="width: 60px; background:#efefef;" |ICRx - Internal Cell Reset Extended
|-
! style="font-size: 110%;" |CS
! style="font-size: 110%;" |N
! style="font-size: 85%;" |Y/N
! style="font-size: 85%;" |Y/N
! style="font-size: 110%;" |•
! style="font-size: 110%;" |
! style="font-size: 110%;" |
! style="font-size: 110%;" |
|-
! style="font-size: 110%;" |CS
! style="font-size: 110%;" |Y
! style="font-size: 85%;" |Y/N
! style="font-size: 110%;" |N
! style="font-size: 85%;" |
! style="font-size: 85%;" |
! style="font-size: 110%;" |•
! style="font-size: 110%;" |•
|-
! style="font-size: 110%;" |CS
! style="font-size: 110%;" |Y
! style="font-size: 85%;" |Y/N
! style="font-size: 110%;" |Y
! style="font-size: 110%;" |•
! style="font-size: 110%;" |
! style="font-size: 110%;" |
! style="font-size: 110%;" |
|-
! style="font-size: 110%;" |DYN
! style="font-size: 110%;" |N
! style="font-size: 110%;" |N
! style="font-size: 85%;" |Y/N
! style="font-size: 110%;" |
! style="font-size: 110%;" |•
! style="font-size: 110%;" |
! style="font-size: 110%;" |•
|-
! style="font-size: 110%;" |DYN
! style="font-size: 110%;" |N
! style="font-size: 110%;" |Y
! style="font-size: 85%;" |Y/N
! style="font-size: 110%;" |
! style="font-size: 110%;" |
! style="font-size: 110%;" |
! style="font-size: 110%;" |•
|-
! style="font-size: 110%;" |DYN
! style="font-size: 110%;" |Y
! style="font-size: 110%;" |N
! style="font-size: 110%;" |N
! style="font-size: 110%;" |
! style="font-size: 110%;" |•
! style="font-size: 110%;" |•
! style="font-size: 110%;" |•
|-
! style="font-size: 110%;" |DYN
! style="font-size: 110%;" |Y
! style="font-size: 110%;" |N
! style="font-size: 110%;" |Y
! style="font-size: 110%;" |
! style="font-size: 110%;" |•
! style="font-size: 110%;" |
! style="font-size: 110%;" |•
|-
! style="font-size: 110%;" |DYN
! style="font-size: 110%;" |Y
! style="font-size: 110%;" |Y
! style="font-size: 110%;" |N
! style="font-size: 110%;" |
! style="font-size: 110%;" |
! style="font-size: 110%;" |•
! style="font-size: 110%;" |•
|-
! style="font-size: 110%;" |DYN
! style="font-size: 110%;" |Y
! style="font-size: 110%;" |Y
! style="font-size: 110%;" |Y
! style="font-size: 110%;" |
! style="font-size: 110%;" |
! style="font-size: 110%;" |
! style="font-size: 110%;" |•
|}


And the next time the cell is loaded into memory, those changes are not applied.
Sort of obvious note: actors that may be removed by more than one event, are removed by the event that occurs first.


As seen in the table, actor characteristics/flags, directly or indirectly, affects the Cell Reset behavior.
These are the general rules, which may be overruled depending on the combinations (discussed later on):


Note the wording on the previous sentence: it does not say "the next time the player enters the cell". There is a subtle difference here.
*Quest Item flag - Actors with the “Quest Item” flag checked are never removed from visited interior cells, under any circumstance. Period!  All considerations in this section refer to non-Quest-Item actors.


*Essential flag – The Essential flag affects Cell Reset only indirectly: since they do not die, all considerations about dead actors do not apply to Essential actors.


Remember: as the player goes from cell to cell, the engine keeps the most recently visited cells in memory so it does not have to 'rebuild' them if the player goes back, which is wise, as it is not that unusual to go backtrack and because rebuilding a cell does take a while (that is when the engine shows us the load screen . . . from the time we spend looking at load screens, we can guess that loading (rebuilding) a cell is not a trivial task).
*Respawn flag
**Dynamic actors with the Respawn flag on are only removed by ECR and ICRx. For ‘normal’ cell entries (no [[ResetInterior]]), they are still valid when the player reenters the cell and are not removed with their non-respawn counterparts.
**If not removed, Respawn actors continue in the cell with most of their values unchanged. Scripted actors keep running their scripts with the vars preserved.
**The only noticed difference is that dead actors resurrect (standing up and [[GetDead]] returns false), although their Health remains zero.


The number of cells that remain loaded depends on the INI settings "uInterior Cell Buffer" and "uExterior Cell Buffer", but is also limited by available memory. On low memory PCs, it can go as low as no buffer at all (so you will get a load screen even if you go back immediately) .
*Persistent –
**Dynamic, persistent actors are only removed with ICRx.
**Persistence on non-dynamic actors, of course, depends on how the “Persistent reference” flag is set when the actor is created in the Construction Set.
**Persistent, dynamic actors are created when a reference is dynamically created based on a Base Object with the “No low level processing” off.  
**Non-persistent, dynamic actors are created when a reference is dynamically created based on a Base Object with the “No low level processing” on.  


*Dead –
**Dead actors are removed when the player reenters the cell.
**Dead bodies of non-dynamic actors are removed from view when the cell is reset. The game keeps the information, so those actors can be resurrected, if needed. If a script resurrects that actor while the player is the same cell, the actor will not show up automatically. Reset3DState does not help here. To show the resurrected actor either (1) move it somewhere else and back (can be done in the same frame, one MoveTo after another) or (2) the player must leave and reenter the cell.


If the cell is not loaded when the player goes in, the engine loads it from the game/mod files and applies the known changes. Since after 72 hours those changes are deleted, there will be no changes to apply, so . . . Bingo! . . Cell Reset!
*[[FormID#Non-dynamic references|non-dynamic]] –
**Cell Reset does not remove information about non-dynamic actors in the cell, dead or alive, scripted or not scripted, persistent or not. (which makes sense, as NPCs go all over the place and would be bad if they were reset back to their editor location because the cell they happen to be at the moment got reset)
**In a few cases, Cell Reset may flag their FormIDs as Deleted (see [[IsRefDeleted]]), but does not remove the FormID from the game. The actor himself does disappear, thou.


*[[FormID#Dynamic references|Dynamic]] – Dynamic actors may or may not be removed, depending on the other flags


But if the cell is still in the cell buffer, it is not rebuilt, therefore the changes are not reapplied, therefore the cell is not reset, therefore the changes remain. (but, as you can figure out, this is a rare scenario).


Some other ways of reading the table:
*ECR removes all dynamic, non-persistent actors, regardless of the other flags.
*ICRx removes all dynamic actors, regardless of the other flags.
*ICRx is the only way of removing persistent, dynamic actors
*ICR and ICRx remove all dead, non-respawn actors, including the non-dynamic ones.


All of the above applies also to [[ResetInterior]]: most likely, it just deletes those change info, as the cell reset process does, so, if the cell is already loaded, it does not 'reset' it.
*The only non-dynamic actors removed are the dead, non-respawn actors. As mentioned, they are not actually removed. Their FormIDs are flagged as Deleted ([[IsRefDeleted]] returns true), but are not removed from the game and remains valid ([[IsFormValid]] returns true])


*Dynamic, non-persistent actors are removed by ECR. Since, sooner or later, everybody saves the game, these actors do not bloat the savegame file (all vanilla leveled list creatures are in this category, as they have the “No low level processing” flag checked and, therefore, spawn as non-persistent )


[[PurgeCellBuffers]], of course, clears the cell buffer and forces all new cells to be loaded (rebuilt).
*If the player never reenters a cell containing dynamic actors, the persistent ones will never be removed. Non-persistent actors are removed by ECR.  


====Notes====
*If the player reenters the cell, dynamic dead actors are removed from the game.
*There are many texts (including the OBSE doc) that mention that the cell is reset only when the player reenters it after 72 hours. Maybe there are situations (to be determined) when this is true, but it does not make much sense. If this were true, all of us would carry in our savegames all changes we made to the prison cell and all other cells we ever visited. Since these changes would be deleted the moment we went back, what is the point of keeping then all that time?
*There are texts that mention that the time is counted from the moment the player enters the cell. This is certainly not true. The reset time starts counting the moment the player leaves the cell, as can be tested using [[GetCellDetachTime]] and [[GetCellResetHours]].


*Respawn actors removed by ECR do not respawn because the removal is done before the player enters the cell, so when the player enters, the references to those actors are already gone.


==Known exceptions==
*[[FormID#Non-dynamic references|Non-dynamic]] actors are not removed.


===Hidden Cells===
Hidden cells (aka Dummy Cells) are cells created without a way to go in, where mods keep their things that are not used and should not be available all the time. Mod authors may create them in the CS, place them on hidden cells and move them in and out of the game as needed. Sometimes this is not possible, so mod authors create them dynamically and get rid of them when not needed anymore.


==Cell Reset x Hidden Cells==
Hidden cells (aka Dummy Cells) are cells created without a way to go in, where mods keep their things that are not used, and should not be available, all the time. If the reference must be persistent or [[FormID#Non-dynamic references|non-dynamic]], modders create them in the CS, place them on hidden cells and move them in and out of the game as needed. Otherwise, modders use [[PlaceAtMe]] to create them dynamically and get rid of them when not needed anymore.


Except for actors, all kinds of [[PlaceAtMe]]'d references can be removed from the game with [[DeleteReference]]. To get rid of [[PlaceAtMe]]'d actors, many modders kill them and move them to hidden cells in the hope that the engine will get rid of them sooner or later.
Except for actors, all kinds of [[PlaceAtMe]]'d references can be removed from the game with [[DeleteReference]]. To get rid of [[PlaceAtMe]]'d actors, many modders kill them and move them to hidden cells in the hope that the engine will get rid of them sooner or later.


As explained above, the Cell Reset clock is triggered when the player leaves a cell. What may not be so obvious is that hidden cells will never reset, because the player never goes there in the first place and, therefore, never triggers its clock.
As explained above, the Cell Reset clock is triggered when the player leaves a cell. What may not be so obvious is that hidden cells will never reset, because the player never goes there in the first place and, therefore, never triggers its clock.


One alternative that works fine is to use [[ResetInterior]] on the hidden cell just after moving the disposable actor there.


== Cell Reset x Actors==
One alternative that has been mentioned in some texts is the use of [[ResetInterior]] on the hidden cell after moving the disposable actor there. This forces the cell to expire and next time the game is saved (ECR), dynamic, non-persistent actors are removed. Problem is that those are exactly the actors that are removed from ANY cell at ECR, so this technique does not help in any way (does not hurt, either, thou).
Cell Reset does not remove information about [[FormID#Non-dynamic references|non-dynamic]] actors in the cell, dead or alive, scripted or not scripted, persistent or not. (which makes sense, as NPCs go all over the place and would be bad if they were reset back to their editor location because the cell they happen to be at the moment got reset)
 
 
Dynamic, non-persistent actors are created when the Base Object has the “No low level processing” flag checked. Since these actors do not run [[Script Processing|low level processing]], there is no need to keep then in memory all the time, so the spawn mechanism (PlaceAtMe of Leveled Creature) do not mark then as Persistent.
 
 
On the other hand, actors with the “No low level processing” not checked must be in memory all the time, so, when dynamically created, they are flagged as persistent. And they are hard to get rid of.
 
 
As seen on the table above, these dynamic, persistent actors are removed only when the player enters an expired cell (ICR). If dead, the normal ICR takes care of it, if not dead, only if [[ResetInterior]] has been used on the cell.
 
 
Since the player never enters a hidden cell, it is better not to spawn persistent actors by checking the “No low level processing” flag on actors that will be [[PlaceAtMe]]'d or are in a leveled list. However, if you have to spawn persistent actors, it seems that the only way to get rid of them is to kill them and move them to a cell that the player may enter in the future.
 
 
If the hidden cell has no doors, enabled quest item actors are removed with their non-Quest Item counterparts (disabled quest items are not removed).


[[FormID#Dynamic references|Dynamic]] actors are removed, dead or alive, scripted or not scripted.


===Exterior Cells===
Cell Reset for exterior cells removes actors with the same rules above with the following differences:
*Ignores Quest Item flag, so quest item actors are removed with their non-Quest Item counterparts.


==Cell Reset x Items==
==Cell Reset x Items==
Anonymous user