Jump to content

persistent reference question


icecreamassassin

Recommended Posts

simple question: Do excessive numbers of objects in a cell cause more lag if they are persistent than they do if they are not?

 

I have a cell where there are a few hundred items which are all persistent and the cell lags terribly. Now I do have other cells which have a ton of persistent references as well, but they don't seem to lag as much. The cell in question has two sets of objects which disable/enable with an activator and all are persistent. Would it help to remove the persistence and enable parent on everything?

Edited by icecreamassassin
Link to comment
Share on other sites

Persistence has no more effect on performance (other than if they are all constantly being tracked in scripts) than other objects. The main issue with persistent references is that they are all stored in your saved game, which can cause save games to grow considerably. So yes, use a parent for groups of references wherever possible.
Link to comment
Share on other sites

  • 2 years later...

Bumping this old thread because I have a very relevant (and maybe silly)question.

 

If,with a script,I'll delete some persistent references I don't need,will they still be stored in the save game?

 

By the way,this is me while bumping this thread:

 

http://images.uesp.net/thumb/f/f5/OB-npc-Noveni_Othran.jpg/180px-OB-npc-Noveni_Othran.jpg

 

Link to comment
Share on other sites

It depends how you delete them.

1. If you have a variable "ref" that is allocated to an existing ref (placed by the CSE), if you remove the reference in CSE, the variable ref in the script has a null pointer (nothing happen).

2. If you create a ref dinamically by the placeatme command, you need to disable the ref and then delete the ref otherwise your savegame will bloat (you cannot disable the ref and delete it in the same frame; disable it then wait a frame then delete).

3. If you delete the ref variable in a script...this is a problem....!! You cannot add or remove ref variables (or other variables) in a script when the script is already saved in the savegame. Oblivion doesn't save the variable in the savegame by name, but by an indexed collection; if you change the declaration order or delete one of them, your plugin can crash and/or Oblivion begins to be unstable using that savegame. The best thing is: unload the plugin, make a clean savegame (in this way everything is linked to that plugin in the savegame gets out) and then reload the plugin and load the savegame. In this way you have a clean plugin with a clean savegame.

Link to comment
Share on other sites

Thanks a bunch Alenet!

 

I'm thinking about deleting containers placed in stores by other mods while moving the items in a specific container. That being said,I'm not sure which example matches my own case. Is it No1 or No3?

 

One more Question: What do you suggest? Should I delete them or leave them be? In one hand I'm thinking it would be good to delete them but in the other hand I'm thinking that persistent references in stores don't really seem to add that much of a load anyway.

 

Btw,since it might seem weird that I'm doing it via a script let me explain: I'm making a mod which will have the feature of moving the items. Deleting the old containers isn't necessary so I wouldn't mind leaving them as they are.

Link to comment
Share on other sites

You cannot delete an item ref via script. You can delete it ONLY if you create it by the placeatme command (dinamically). You cannot delete anything via script if the ref is created by the CSE (at design time).

You can only disable the reference.

 

About the way to manage the reference i do an example for the three case of my previous post:

1. A script has:

ref TestRef

set TestRef to ContainerRef (this ref is a ref at design time by CSE)

If you remove the ContainerRef from the CSE, TestRef point at a NULL reference (nothing happen). In the script you can check by if TestRef != 0

 

2. A script has:

ref TestRef

set TestRef to PlaceAtMe Object 1 (Object IS NOT A REF, is an item from the CSE)

To avoid bloating you must do:

TestRef.Disable

Wait one or more frames (if you are in a quest you need to wait a "spin" of the delay time)

TestRef.DeleteReference

 

3. A script has:

ref TestRef

ref TestRef2

float FloatTest

float FloatTest2

You delete from the script TestRef2, so you change the number of the variables or you change in this:

ref TestRef2

ref TestRef

float FloatTest

float FloatTest2

Oblivion loads the savegame with the refs in a wrong way (reversed).

 

Anyway, if you have a ContainerRef builded in CSE (design time) you cannot do: ContainerRef.DeleteReference (it's not permitted by the game engine). You need to do: ContainerRef.Disable. When the savegame is loaded, that ref is loaded too, but it will be "hidden" and Oblivion will not render it.

 

EDIT:

QQuix: you wrote while i'm writing :smile:

 

It's correct, as you wrote and i wrote, there is no way to delete a design-time reference. Only a dynamic reference.

Link to comment
Share on other sites

Thanks guys!

I didn't know if disable would do the job (keeping references from being stored) so I ignored it. :D Since I've used it in the past I'll feel much more at ease by using that.

 

Once again,thanks a lot!

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...