Difference between revisions of "PlaceAtMe"
Jump to navigation
Jump to search
→Warning: Repeated Use Causes Save-Game Bloat
imported>Thalassicus |
imported>Thalassicus |
||
Line 20: | Line 20: | ||
==Warning: Repeated Use Causes Save-Game Bloat== | ==Warning: Repeated Use Causes Save-Game Bloat== | ||
Objects created with '''PlaceAtMe''' become part of the savegame file and | Objects created with '''PlaceAtMe''' are not automatically deleted by the game. (Calling the Disable function only hides the object, but does not delete it.) As a result, they become part of the savegame file and increase its size. | ||
Use the [http://obse.silverlock.org/obse_command_doc.html#Reference DeleteReference] function to delete non-actor objects created with PlaceAtMe. This requires running the CS with [[Oblivion Script Extender]] version 18 or later. | |||
To delete an actor, you can [[MoveTo|move them to]] an interior cell the player is not in, [[kill]] them and [[ResetInterior|reset]] the cell. When the player next enters the cell, all dead actors in the cell are deleted. Note this requires the player to actually enter the cell before actors in it will be deleted, which can restrict usefulness. [[Talk:Common_Mistakes|recent tests]] seem to show that living actors are removed as well. | |||
Objects frequently created with '''PlaceAtMe''' and never deleted can result in huge savegame files. Once the savegame file is around 10 megs problems start to arise, including extended load times, game instability and crashes, and at extreme levels, considerable performance loss and an inability to load the game. | |||
As a rule of thumb, it's OK to use '''PlaceAtMe''' a finite number of times (i.e., a quest script that runs once and creates 20 '''PlaceAtMe''' objects). It's not OK if your script can potentially use '''PlaceAtMe''' an infinite number of times (i.e., a Summon spell that creates a new creature with '''PlaceAtMe''', an activator/button that creates a new sword). | As a rule of thumb, it's OK to use '''PlaceAtMe''' a finite number of times (i.e., a quest script that runs once and creates 20 '''PlaceAtMe''' objects). It's not OK if your script can potentially use '''PlaceAtMe''' an infinite number of times (i.e., a Summon spell that creates a new creature with '''PlaceAtMe''', an activator/button that creates a new sword). | ||
When possible, use different functions to avoid these problems. For instance, for summonings you can create a persistent creature, place it in a remote cell in the CS, and when the spell is cast use '''''CreatureRef.[[MoveTo]] player''''' (note that there's more to summoning, but that avoids the '''PlaceAtMe''' problems). If you need an object to appear, create and place it in the CS, make sure it's "Persistent" and "Initially Disabled", and use '''''ObjectRef.[[Enable]]'''''. | |||
If you really ''need'' to use PlaceAtMe in your mod, it would be fair to indicate that fact in your mod's Readme file. | If you really ''need'' to use PlaceAtMe in your mod, it would be fair to indicate that fact in your mod's Readme file. | ||
==Getting the Created Object's Reference== | ==Getting the Created Object's Reference== |