Cell Reset

From the CreationKit Wiki
Revision as of 03:13, 14 November 2014 by imported>ThreeTen (→‎What Resets?)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview[edit | edit source]

Cell Reset is the process through which a dungeon or other location is reset and repopulated. Most of the time, this works without the need for any special setup. But if your level involves a scripted boss battle or puzzle, it may be worth considering how Cell Reset will affect the space on a second or subsequent visit.


When do Cells Reset?[edit | edit source]

Cells reset when:

  • The player leaves a location after clearing it, iHoursToRespawnCellCleared pass (default: 30d), and then the player reenters it.
  • The player leaves a location without clearing it, iHoursToRespawnCell pass (default: 10d), and then the player reenters it.
  • A script calls Reset() on the cell and the player reenters that cell.
    • Note that exterior cells cannot be force-reset through script. There is no way to force-reset them directly, although you can enable a different group of enemies if desired.


Note that cells only reset when the player actually reenters them. Script functions like OnReset will only be called at this time.


Cells will NOT reset if:

  • The cell's Encounter Zone is marked 'Never Resets'
    • Note that this is a property on the Encounter Zone, not the Cell or Location.
    • Note that this property affects everything that starts in any cell with this Encounter Zone. Actors 'carry' their initial Encounter Zone with them if they travel across the map, pursue the player, etc.


When are Locations Cleared?[edit | edit source]

Locations are cleared when:

  • All of their bosses (creatures tagged with the 'Boss' LocRefType) are dead.
  • A script calls 'SetCleared()' on the location.
    • Any script can do this, although some convenient default scripts are:
      • defaultClearLocationOnDeath
      • defaultClearLocationOnDeathRefAlias
      • defaultClearLocationOnActivate


What Resets?[edit | edit source]

All of the following generally reset when a location resets:

  • Creatures respawn.
  • Creatures are reset to their defaults.
    • This includes restoring them to full health and clearing all of their Actor Values
  • Placed items respawn.
  • Doors reset their open state and lock setting.
  • Containers reset their contents, open state, and lock setting.
  • Traps reset to their initial states.
  • Scripts reset to their initial state, clear all of their variables, and re-initialize.


Exceptions / Exclusions:

  • The Enable State of Actors and Objects does not reset. That is, they stay enabled or disabled.
  • Destructible Objects do not reset.
  • Encounter Zone levels do not reset.
    • That is, the Encounter Zone will remain locked in at the level it was at when the player first visited the location.
  • Player-dropped items are not normally cleaned up.
    • They ARE cleaned up by scripted reset calls, but not normal resets.
  • Objects held in a Quest Alias, or created in an alias, are protected from some features of Cell Reset.
    • For example, a Quest Item in an Alias that is placed in a chest will remain in the chest even after the chest resets.
    • For example, items added to a Quest Alias through the Alias' inventory will remain on the actor even after they respawn.
  • Any object flagged to NOT 'Respawn' does not reset. Any scripts on that object will also not reset.
    • 'Respawn' is a flag on actor base objects (default: true) and all references.
    • If something in a level fails to reset, this is the most likely cause. Check the flag!
    • The following creatures and objects intentionally do not reset/respawn:
      • Wispmothers & Wisps
      • Nordic puzzle doors
  • Created refs (i.e. refs placed via PlaceAtMe).


Other Notes:

  • Player-killed corpses are cleaned up as part of a separate code process independent of the Cell Reset system.
  • The order of operations in a Cell Reset process is undefined. For example, the following events might be processed in any order:
    • OnCellLoad for the Cell.
      • Note that OnCellLoad may not fire at all if the area hasn't unloaded yet.
    • OnReset for one object.
    • OnReset for a different object.


How do I Preserve Data Across Resets?[edit | edit source]

If you want to allow a cell to reset, but still preserve some of its state information, you have several options:

  • Use a Quest. Quests and their state information (stage, variables, scripts, etc.) do not reset.
  • Use Enable/Disable States. Remember that the Enable/Disable state of objects do not reset.
  • Preserve data on non-resetting objects. Remember that scripts on objects that do not reset will not get reset, so their state information is safe.
    • On the other hand, they also won't get an OnReset() event, so you can't use that to 'restore' state information on other objects in the level.


Testing Cell Reset[edit | edit source]

To test Cell Reset in a location:

  • Make whatever state changes you want to test (eg. 'KillAll', etc.)
  • coc RiverwoodSleepingGiantInn (or somewhere else with a bed)
  • pcb
  • SetGS iHoursToRespawnCell 1
  • SetGS iHoursToRespawnCellCleared 1
  • Sleep for 2+ hours.
  • coc to any other exterior
  • Return to your location and test the results


Language: English  • русский