Difference between revisions of "Loaded"
imported>Haama (Created) |
imported>UDUN m |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
Oblivion cannot keep track of every single object in the game at all times. Only certain objects are loaded in memory, at any one time. These include | Oblivion cannot keep track of every single object in the game at all times. Only certain objects are loaded in memory, at any one time. These include objects in the player's current cell. It seems to extend beyond it in certain conditions, however there is no guarantee that an object will still be loaded. | ||
This is especially important when dealing with non-persistent objects (such as objects created with PlaceAtMe). A script can interact with a non-persistent object while the player is in the same cell (i.e., grab the reference to the object with '''set Ref to (PlaceAtMe SomeObject)''', and activate it with '''Ref.Activate'''), as if it were a persistent object. You can even walk to a new cell or enter a door from the cell, and everything will still work. However, if you fast-travel, save and reload, or enter too many new cells, the object will no longer be loaded in memory. When the script attempts to call the object, it will either stall or CTD. This is because a new object will be in memory, and that new object will be called instead. | This is especially important when dealing with non-persistent objects (such as objects created with PlaceAtMe). A script can interact with a non-persistent object while the player is in the same cell (i.e., grab the reference to the object with '''''set Ref to (PlaceAtMe SomeObject)''''', and activate it with '''''Ref.Activate'''''), as if it were a persistent object. You can even walk to a new cell or enter a door from the cell, and everything will still work. However, if you fast-travel (a few times - equivalent to entering many new cells), save and reload (not in the same cell), or enter too many new cells, the object will no longer be loaded in memory. When the script attempts to call the object, it will either stall or CTD. This is because a new object will be in memory, and that new object will be called instead. | ||
When not loaded, persistent objects can be activated (and the onActivate block will run) and can have their variables manipulated. However, the GameMode and MenuMode blocks will not continue to run unless the persistent object is in a loaded cell. There is some question about if and when a remote, unloaded persistent object's script will run. One suggestion is that the script runs every 30 seconds. Another is that the script runs whenever the object is manipulated, that is whenever the mod is first loaded, whenever a variable is manipulated on it, and possibly whenever the object is activated (meaning the rest of the script will run when you use onActivate). | |||
Remote inventory items are a little stranger. For [[AddItem]], when the container is in a remote cell, the [[onAdd]] block won't run until the player enters that container's cell, even if the container is moved to the player's cell in the same frame or if the container is persistent. Also, if the player enters the remote cell after saving and loading, the onAdd block won't run. The same probably also applies for similar blocks (i.e., [[OnEquip]], [[OnUnequip]], [[OnDrop]]) and functions (i.e., [[UnequipItem]]). UnequipItem has been somewhat tested, and won't fire unless the container is loaded. | |||
[[Category:Tidbits]] |
Latest revision as of 11:01, 30 May 2010
Oblivion cannot keep track of every single object in the game at all times. Only certain objects are loaded in memory, at any one time. These include objects in the player's current cell. It seems to extend beyond it in certain conditions, however there is no guarantee that an object will still be loaded.
This is especially important when dealing with non-persistent objects (such as objects created with PlaceAtMe). A script can interact with a non-persistent object while the player is in the same cell (i.e., grab the reference to the object with set Ref to (PlaceAtMe SomeObject), and activate it with Ref.Activate), as if it were a persistent object. You can even walk to a new cell or enter a door from the cell, and everything will still work. However, if you fast-travel (a few times - equivalent to entering many new cells), save and reload (not in the same cell), or enter too many new cells, the object will no longer be loaded in memory. When the script attempts to call the object, it will either stall or CTD. This is because a new object will be in memory, and that new object will be called instead.
When not loaded, persistent objects can be activated (and the onActivate block will run) and can have their variables manipulated. However, the GameMode and MenuMode blocks will not continue to run unless the persistent object is in a loaded cell. There is some question about if and when a remote, unloaded persistent object's script will run. One suggestion is that the script runs every 30 seconds. Another is that the script runs whenever the object is manipulated, that is whenever the mod is first loaded, whenever a variable is manipulated on it, and possibly whenever the object is activated (meaning the rest of the script will run when you use onActivate).
Remote inventory items are a little stranger. For AddItem, when the container is in a remote cell, the onAdd block won't run until the player enters that container's cell, even if the container is moved to the player's cell in the same frame or if the container is persistent. Also, if the player enters the remote cell after saving and loading, the onAdd block won't run. The same probably also applies for similar blocks (i.e., OnEquip, OnUnequip, OnDrop) and functions (i.e., UnequipItem). UnequipItem has been somewhat tested, and won't fire unless the container is loaded.