Cell Reset
This article has been marked by editors or authors as incomplete. Please see the Talk page for details. Discussion and collaboration can improve an article and lead to a better Wiki.
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.
The number of hours is determined by the iHoursToRespawnCell setting, which defaults to 72 hours. Since there may be mods that depend on that, and no modder should mess with it, most references to Cell Reset (including the text below) just say that "cells reset after 3 days" or "cells reset after 72 hours" without bothering to mention that it is configurable. Just be aware that, depending on the mods installed, that may not be exactly true.
Why ?
The cell reset concept is a way to keep the savegame file size under control.
When a new game starts, the whole game universe is set as the developers of the vanilla game and the authors of the installed mods designed their respective worldspaces and interiors. As the game develops, the player activities change the environment (pick, drop, bump, kill, etc)
All those changes are saved in the savegame file, so, when a savegame is loaded, the engine loads the original, static setup from the game and mod files (ESPs, ESMs, BSAs, NIFs etc) and, THEN, makes the required changes recorded in the savegame file, rebuilding the changed world as the player left it when the game was saved.
It would be nice if we moved that loaf of bread in the initial prison cell from the table to the floor and, when we returned to that cell hundreds of playing hours later, we found it on the floor as we left it. On the other hand, to do that, the new XYZ positions and angles would have to be kept in the savegame all the time, so whenever the player returned to that that particular, the engine could move the loaf of bread to its new, changed position on the floor.
If the savegame kept all these detailed changes forever, the file size would be too big (who will go back to every cell in the game, anyway? And, if one does, will he remember (or care) exactly how it was left?). So the designers came to a nice compromise: the game will 'remember' those changes for a while (how about 3 days?) and 'forget' them after that.
So, Cell Reset is not putting everything back where they started, but, instead, is a matter of forgetting (deleting) the information about the changes made to that particular cell.
How ?
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: ( GameDaysPassed * 24 ) + 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).
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 as ‘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).
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 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.
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
Actors are automatically removed from a cell by the Oblivion engine when one of two events occur after the 72 hours Cell Reset Timer expires (either naturally or by ResetInterior):
- the game is saved, or
- the player returns to the cell.
In other words, when the game is saved after the 72 hours have passed, some actors are removed and will not be part of the save file. Or, if the player returns to the cell more than 72 hours after he left, some actors are removed from the cell. Which actors are removed in each case will be detailed below.
The event of reentering the cell 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 more than 72 after the player left the cell or any time the game is saved after the ResetInterior function is used (even if before the 72 hours).
- Internal Cell Reset (ICR) – When the player reenters the cell after the 72 hours Cell Reset Timer expired and ResetInterior has not been used
- Internal Cell Reset Extended (ICRx) – When the player reenters the cell after ResetInterior has been used after the last time he left.
Note on ResetInterior – This function sets the Cell Detach Time and the Cell Reset Hours values to -1, so the next time the player enters the cell, the Interior Cell Reset will be executed, as if the Cell Reset Timer has expired.
The following table resumes what happens in each scenario to actors with various combinations of characteristics
CS / Dynamic | Dead | Persistent | Respawn | Not Removed | ECR - External Cell Reset | ICR - Internal Cell Reset | ICRx - Internal Cell Reset Extended |
---|---|---|---|---|---|---|---|
CS | N | Y/N | Y/N | • | |||
CS | Y | Y/N | N | • | • | ||
CS | Y | Y/N | Y | • | |||
DYN | N | N | Y/N | • | • | ||
DYN | N | Y | Y/N | • | |||
DYN | Y | N | N | • | • | • | |
DYN | Y | N | Y | • | • | ||
DYN | Y | Y | N | • | • | ||
DYN | Y | Y | Y | • |
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):
- Quest Item flag - Actors with the “Quest Item” flag checked are never removed, under any circumstance. Period! All considerations below 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.
- Respawn flag
- Dynamic actors with the Respawn flag on are only removed from outside the cell (ECR and ICRx). Otherwise, 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.
- 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” off.
- 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.
- 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.
- Dynamic – Dynamic actors may or may not be removed, depending on the other flags
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.
- 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 )
- If the player never reenters a cell containing dynamic actors, the persistent ones will never be removed. Non-persistent actors are removed by ECR.
- If the player reenters the cell, dynamic dead actors are removed from the game.
- 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.
Cell Reset x Items
?
Cell Reset x Traps
- Traps aren't innately reset. Rather their scripts receive the OnReset event and use that to reset themselves. (Hence the trap could something other than reset itself in response to the OnReset event, e.g. it might enable a second, more difficult trap.)
Cell Reset x Oblivion worlds
CloseCurrentOblivionGate resets the Oblivion world the player is in. Player and other foreign actors are moved outside the gate.