This wiki is a copy of the original Oblivion CS wiki created and maintained by the UESP.net. See CSwiki:Copy Notice for more info.

Difference between revisions of "Script Processing"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Wrye
imported>Wrye
Line 10: Line 10:


On the positive side, this means that it's possible to make a remote reference act as if is in scope for a prolonged period of time -- which is useful for remote containers. On the negative side, always in scope references will of course be a performance drain and should not happen unless necessary.
On the positive side, this means that it's possible to make a remote reference act as if is in scope for a prolonged period of time -- which is useful for remote containers. On the negative side, always in scope references will of course be a performance drain and should not happen unless necessary.
Unanswered Questions:
* Does this work for non-persistent objects? (I think not.)
* Does the heartbeat survive cell transitions and reloads?
** Keep in mind that if the heartbeat doesn't run during a frame (e.g. during menuMode), it should die.


[[Category:Scripting]]
[[Category:Scripting]]

Revision as of 18:30, 7 March 2009

How Often are Scripts Processed?

Actors (Creatures and NPCs)
Processed every time the actor's AI is processed. In high process (the loaded area around the player), this is every frame. When the actor is not in high, this is much less often (down to once every 15 minutes of game time at the lowest process level). But these are still the only scripts (aside from quest scripts) that are processed when the player is not around.
Doors
A bit of a special case, these scripts are processed like other scripts on references (every frame when loaded), but they will also be processed once any time an actor activates the door.
Objects in Containers
Processed when the container's script is processed -- so, items on actors are processed when the actor is processed; items in other containers are processed every frame when the cell is loaded.
Quests
Processed every 5 seconds (by default) when the quest is running. You can change how often quest scripts are processed by changing a default variable in the quest's script.
References
Processed every frame when its cell is loaded, not at all when the cell is not loaded. So these scripts run only when the player is nearby (which means these are often a good place to put relatively expensive scripts, doing things like distance checks).

Remote Ref Heartbeat

Whenever a local variable on a persistent ref is set, the script of that reference will run for at least one frame after the setting. This means that if, in that one frame, the reference script again sets a variable, then the process is self continuing.

On the positive side, this means that it's possible to make a remote reference act as if is in scope for a prolonged period of time -- which is useful for remote containers. On the negative side, always in scope references will of course be a performance drain and should not happen unless necessary.

Unanswered Questions:

  • Does this work for non-persistent objects? (I think not.)
  • Does the heartbeat survive cell transitions and reloads?
    • Keep in mind that if the heartbeat doesn't run during a frame (e.g. during menuMode), it should die.