Difference between revisions of "PlaceAtMe"

546 bytes added ,  23:12, 23 March 2008
note about getting rid of placeAtMe refs
imported>Haama
imported>Scruggs
(note about getting rid of placeAtMe refs)
Line 24: Line 24:
With some careful planning, you can use different functions and 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]]'''''.
With some careful planning, you can use different functions and 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.
Objects spawned with PlaceAtMe can be deleted if they are inventory items. Create a persistent NPC reference somewhere in the gameworld (most likely in a hidden cell). To get rid of a reference after calling PlaceAtMe, have the reference [[Activate]] your persistent NPC to transfer itself to his inventory. Calling [[RemoveAllItems]] on the NPC will then remove the savegame bloat. So, if you must use PlaceAtMe, consider defining your object as an inventory item to take advantage of this trick.
 
If you really ''need'' to use PlaceAtMe in your mod and cannot avoid the associated savegame bloat, 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==
Anonymous user