Difference between revisions of "Talk:PlaceAtMe"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Haama
imported>DragoonWraith
 
(6 intermediate revisions by 4 users not shown)
Line 153: Line 153:


:Just use [[RemoveMe]] when you're done with the item.--[[User:Haama|Haama]] 02:28, 8 May 2008 (EDT)
:Just use [[RemoveMe]] when you're done with the item.--[[User:Haama|Haama]] 02:28, 8 May 2008 (EDT)
:Items in inventories do ''not'' have references (I know, this seems odd, but it's true; ask the OBSE team if you want a detailed description of how it works), so you don't have to worry much about savegame bloat with items in inventories.
:If an item reference (i.e. an item sitting on the ground) is picked up, the reference is removed and the memory is restored appropriately (if Oblivion did not do this, savegames could balloon to massive proportions in a few hours of looting). At this point, it's just another member in a list, which takes exceedingly little memory.
:[[User:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">D</span>ragoon <span style="font-family: Oblivion, Daedric Runes; size=2;">W</span>raith]] [[User_talk:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">TALK</span>]] 03:17, 8 May 2008 (EDT)
::Thanks. That is good news for me.
::But it is really odd, as I did some tests and found that items do keep some degree of individuality, even when they are put together in an inventory. It is a simple test: the script has a count and an onAdd Block that adds 1 to the count and prints it to the console. I picked and dropped several of these items a few times and noticed that they keep separate counts (several copies of the script, I suppose)
::I will try to contact the OBSE Team, but just out of technical curiosity, as you have already answered my main concern. --[[User:QQuix|QQuix]] 17:40, 8 May 2008 (EDT)
:::Yes, items have what is called "Extra Data" associated with them, which allow them from differ from each other while in an inventory. I believe it works something like this: There are two lists, one with the items in the inventory, and the other with the extra data for each item, so that they match up. Or something like that. Presumably Oblivion does this to save memory or improve performance...
:::[[User:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">D</span>ragoon <span style="font-family: Oblivion, Daedric Runes; size=2;">W</span>raith]] [[User_talk:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">TALK</span>]] 07:42, 9 May 2008 (EDT)
== Bloat with creatures/NPCs? ==
If using placeatme to create creatures or NPCs that do not get disabled under normal circumstances, if their corpses are left there to disappear when the cell respawns in three days, do the references remain?  Is the clearing out of corpses when a cell respawns done in-game by disabling them or by some other method inaccessible through the console?
== Cell's reset removes any PlaceAtMe object? ==
Does the cell reset removes any object - actor or anything else - called by this function? I wanted to add a proper sound to the Screaming Maws from SI and I wondered does I can add it via script, without having to add them manually in each location. - [[User:ZuTheSkunk|ZuTheSkunk]] 19:44, 21 December 2010 (EST)
: Hello? - [[User:ZuTheSkunk|ZuTheSkunk]] 07:38, 28 December 2010 (EST)
::I don't know the answer, and not too many people check here anymore... I'd suggest asking on the {{Forums}}.
::[[User:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">D</span>ragoon <span style="font-family: Oblivion, Daedric Runes; size=2;">W</span>raith]] [[User_talk:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">TALK</span>]] 12:43, 28 December 2010 (EST)

Latest revision as of 12:43, 28 December 2010

Using PlaceAtMe to return a reference to a created object does not appear to work...

ref refCreatedObject to refCreatingObject.PlaceAtMe ObjectToCreate, 1, 0, 0

Seems to do nothing. ObjectToCreate is never created, as far as I can determine. Conversely, the following creates ObjectToCreate perfectly fine:

refCreatingObject.PlaceAtMe ObjectToCreate, 1, 0, 0

Some more detail in how this is supposed to be used would be good, maybe? Or this is a bug I guess...

--X-Bahamut 23:34, 8 April 2006 (EDT)

You can't declare and set a variable in the same line. I'll add a section to the article explaining how to use the returned reference. Mrflippy 20:03, 8 April 2006 (EDT)

--Tegid 22:41, 12 April 2006 (EDT) Does PlaceAtMe only succeed at creating a reference if it is called by a Persistent Object or an Actor? More importantly if I have a Foo object can I create another Foo object by calling?

set FooRef2 to FooRef1.PlaceAtMe Foo, 1, 0, 0

--Tegid 09:14, 20 April 2006 (EDT): It turns out the answer to my questions are no, you don't need a persistent reference, and yes, one object can create another of the same type.


PlaceAtMe and Disable[edit source]

-- I noticed something bad about the couple PlaceAtMe / Disable, often used in mods for spell effects. Once the references are placed, there is no way to get rid of them. Although disabled, they are saved with your saved games. In MW there was a way around this, but the command disappeared with TESIV. All I can say is that, unless there is a way around this, modders should strive to avoid use of PlaceAtMe at all cost, and use MoveTo instead on a finite number of references. Gamall 12:23, 18 July 2006 (EDT)

test : 500 references = 76 KB increase of the savegame. Gamall 12:41, 18 July 2006 (EDT)
Dragoon Wraith TALK 13:28, 18 July 2006 (EDT): That's a temporary increase though. Disabled objects are unloaded from memory every so often, automatically.
I heard this rumor a while ago, but I'm still not convinced. "Initially disabled" objects are not removed from the savegame. Objects that exist in an ESP or ESM (persistent or not) are not removed after you disable them, that's a fact that was extensively tested. Objects created by placeatme give you a reference to access them, the game would crash if you do so after the object is removed, and I doubt that Bethsoft made a garbage-collection-routine that just removes disabled objects that were created ingame without storing a reference to them.--JOG 13:40, 18 July 2006 (EDT)

Gamall 14:17, 18 July 2006 (EDT) :

@ DragoonWraith : How often ? Did you test this ? Who provided this information ? I do hope the are unloaded from times to times (or when a limit is reached), but I'm not convinced. It is true that savegames seem to lose about 10 Kb every now and then, but nothing proves it is linked to disabled references being cleaned up.

@ JOG : Try creating a reference with placeatme, use the console to get its reference, see to it that the zone you were in is discharged from memory, save, quit the game, go back to it, go back to the zone, use the reference, it will work. This proves references created with placeatme are saved. That and the significant weight increase in the savegames mentionned earlier.

So whether or not objects placed with placeatme and disabled are stored in the savegame is really not the issue anymore. They are. The issue is whether or not saves are cleaned in the way DragoonWraith said, or any other way. They may be, and they may not be ; either way, I think this issue deserves much more attention than has been given to it this far.

Dragoon Wraith TALK 15:51, 18 July 2006 (EDT): It was mentioned on this Wiki somewhere by a Beth employee... I think it was Ashileedo or Kkulman, I'll look around.
Dragoon Wraith TALK 15:55, 18 July 2006 (EDT): Found it; according to Ashileedo, disabled items will be removed:
The danger is summong 50 iron swords at the wrong time and running out of memory. However, if you disable something that you've placeatme'd, I believe it gets thrown out -- I don't think right away, but our memory management code will clear it out when you hit your next load (though we'd have to check the code to be absolutely sure its at your NEXT load. But I am sure it does get cleared away. It most definitely will go away when the cell you summoned the objects in gets unloaded from memory). But the bigger risk here is if you placeatme something that is too expensive -- especially if player does it over and over and over again consecutively. --Ashileedo 15:08, 7 April 2006 (EDT)
Gamall 16:47, 18 July 2006 (EDT) : That's a bit comforting. However, when I made the test I suggested to JOG, the cell I summoned the objects in was unloaded from memory (I loaded another city to make sure it would be), and I rebooted the game and made my way back there. So according to this quote, the objects should have been destroyed. But they weren't : I had written down a reference to one of them before it was disabled, and after the operation I described, I enabled it via the console.
Ill try to load my savegame over and over again, and see if it looses weigth. On a sidenote, I'd say the dev didn't sound very confident when he wrote what you quoted ;)Plus, I found another quote of the same, about disable : "We don't use it with placeatme very often, I can't think of any example off hand." So it could very well be that they overlooked that possibility a bit, since it was to no extent critical at that time. Anyway, I'll do more tests, and if they are successful, this issue will be buried once and for all.
Dragoon Wraith TALK 16:57, 18 July 2006 (EDT): Hmm... so it seems that we should use MoveTo on a persistant reference rather than PlaceAtMe. Good to know. MoveTo with a persistant reference has another benefit, too - it can tell if the player has changed cells by using GetInSameCell.
Using MoveTo is exactly what I do, and recommand to people patient enough to listen. Most of the time, you can do with MoveTo everything you do with PlaceAtMe, even if it is trickier for complex spell effects.
I have restarted the game about seven time, each time loading new zones and saving again, without any weight loss. I have about 100 Kb of placeatme'd disabled references in my save, btw...
I think someone should edit this article Casting Spells From An Activator,since it uses placeatme, and I am under the impression many people learned how to script spells from this very page, hence the prominence of the use of placeatme in spell effects... I'm a little too fed up with this specific issue to make it right now, having spent my whole day on it, so... If noone else wants to do it, I'll do it tomorrow anyway. Good day/night, depending on the country you're from... Gamall 17:17, 18 July 2006 (EDT)
Dragoon Wraith TALK 17:42, 18 July 2006 (EDT): I may, if I get the chance... can't really right now. But at any rate, for your tests, it generally takes time for things to unload. I think the default is three in-game days. Try "Wait"ing for about 75 hours and see if that changes things (actually, even if it doesn't unload the disabled objects, your savefile should shrink because many things will be unloaded as cells are reset).

Gamall 18:15, 18 July 2006 (EDT) : I waited for a week, and the save did shrink. Of about 35 Kb. Since the "placeatme obesity" was of about 100 Kb, it tends to confirm the problem. I created the references in a matter of seconds, so I cannot think of any reason why waiting would destroy some of them and leave others.

I'll edit the main article, since the issue seems about settled.

Oh, and does anyone remember the name of the function Morrowind used to discharge disabled placeatpc'd objects ? I must say throughout this discussion I hoped someone would come and save the day by pulling an "Oblivioned" version of this function out of their hat. Trouble is I can't remember this function's name in the first place...

Dragoon Wraith TALK 18:22, 18 July 2006 (EDT): SetDelete. You had to Disable an object before you could delete it though, or the game would crash. Like this:
if ( GetDisabled == 1 )
  SetDelete 1
endif

Disable
And it has been confirmed that Oblivion has no such function, although some have claimed that you can use DeleteFullActorCopy - but that would surprise me greately if it really worked.
Gamall 18:42, 18 July 2006 (EDT): Thanks. I'd be quite taken aback if DeleteFullActorCopy worked that way, but it is more than worth a try in my opinion. PlaceAtMe is quite convenient, so any easy way to get around its shortcomings would be really great. I'll run some more tests immediately. Like they say : "Il faut battre le fer pendant qu'il est chaud" (I've no idea how to give a good translation of that, sorry...).
I've tested this myself, and Gamall is right - objects created using placeAtMe are not cleaned out of the savegame, whether disabled or not. It doesn't seem to matter how long you wait, or how much traveling you do. For the record, deleteFullActorCopy has no effect on normal objects. I'm not sure why anyone would expect it to. Scruggs 18:44, 18 July 2006 (EDT)
I've tested deleteFullActorCopy nevertheless. As expected, it does not seem to have any significant effect. So I'm afraid we'll have to stick with MoveTo...Gamall 19:24, 18 July 2006 (EDT)
Dragoon Wraith TALK 20:11, 18 July 2006 (EDT): I've updated Disable and Modding Etiquette accordingly.
ShadowDancer 22:19, 18 July 2006 (EDT): What about SetDestroyed? Does anyone know if a destroyed and disabled object still remains in existance forever? I am thinking it probably does but it might be worth looking into just to make sure.
Dragoon Wraith TALK 22:33, 18 July 2006 (EDT): If SetDestroyed removes the object from memory, it won't do what it's supposed to do (make a door non-functional), and therefore it can't possibly do that.
At least, assuming it does what is said there, which is a safe assumption since it was written by Bethesda employees.
ShadowDancer 22:59, 18 July 2006 (EDT): I figured as much, but thought it might be worth a shot.

JOG 10:34, 19 July 2006 (EDT): Setdelete in Morrowind also didn't exist before Tribunal. As of Ashileedo's quote, I think he refers to RAM not to the ingame world/cell "memory" that is stored in the savegame. The disabled object (model and texture) will not be loaded into ram when you enter the cell with it. But it's reference will continue to exist in the savegame, and when you later decide to re-enable it, it will show up again.

Gamall 10:39, 19 July 2006 (EDT) : @ ShadowDancer : It was. Everything is. Alas, it seems to have no significant effect whatsoever. My guess is Beth plain forgot to add the setdelete function, since they had no use for it and other things in mind.
*dreaming eyes* Maybe if someone asks nicely for it, they will ship it in the next patch ?
@ JOG : I didn't remember that about setdelete in MW. Well let's hope they'll do the same for Oblivion.
ShadowDancer 17:52, 19 July 2006 (EDT): Has anyone tried the supposed solution of Kill/Disable/DeleteFullActorCopy that was suggested on Ashileedo's talk page? Once again, I doubt it will work, but its worth a try.
The assertion on that page that "I always use Kill, Disable, then DeleteFullActorCopy as a safety. A wise person once told me that's what Bethseda does for items" makes me very doubtful. Bethesda only used DeleteFullActorCopy once, to get rid of an actor created in the script for the Skull of Corruption. They never used it for anything else. Scruggs 18:50, 19 July 2006 (EDT)

So this is still a little confusing. Is this saying PlaceAtMe items never get removed from a save game ever? This would probably mean that the regular spawn operations did something different to PlaceAtMe (which I doubt) or otherwise the game wouldn't ever delete anything. DeleteFullActorCopy neither deletes the reference or the created base object? (I dont think so.) What about PlaceAtMe statics vs. item/creatures, etc? (I think it more likely that statics never get deleted, e.g. most doors, containers, etc. in the game are never marked as persistant but they always are.) Also, this whole confusion over references vs. the objects themselves: a reference (variable) is just an pointer. It doesn't know whether the object associated with it exists or not. Hence trying to use it on an object that is lost or currently not loaded will either do nothing or cause a CTD. Additionally, SetDestroyed has nothing to do with object persistance. Guidobot 13:58, 12 April 2007 (EDT)

Placeatme in scripts[edit source]

I am currently working on a script for a sword that turns someone into a cheese wheel. This is my Script.

Begin ScriptEffectStart
  PlaceAtMe CheeseWheel 1 0 0
  Disable
End

Unfortunately, when the cheese appears and the target disappears, the cheese has collision lock on and is sometimes stuck beneath the ground. Could someone tell me whats wrong?(This is my first official script)-Mr. V 21:08, 16 January 2008 (EST)

First of all, you probably don't want to be using the normal CheeseWheel - since this is a food object, the player may pick it up, and that may cause serious problems (unless this is what you intend). Instead, create a new Activator that uses the CheeseWheel model (you may have to get the model out of the BSA - I recommend OBMM for that), and use that.
The "spawn point" for PlaceAtMe is wherever "Me"'s XYZ coordinates are. For NPCs, this is in between their feet. And since the cheesewheel's XYZ refer to its center, half of the wheel would be lodged in the ground.
You could try this:
ref CheeseRef
float z

Begin ScriptEffectStart
  set CheeseRef to PlaceAtMe ActivCheeseWheel 1 0 0
  set z to ( CheeseRef.GetPos Z ) + 64
  CheeseRef.SetPos Z z
  Disable
End
However, you should note that this is going to cause savegame bloat. The cheesewheel is going to be added to the savegame every time this happens, and eventually that's going to harm players' savegames. This is considered very poor modder etiquette.
If you can limit the number of cheesewheels possible at one time, you could use Persistent References and MoveTo instead, to avoid this problem.
Alternatively, you could make the effect timed, and make sure you have enough wheels that it's unlikely for the player to hit more people than you have wheels.
Perhaps the ultimate compromise would be to keep old wheels somewhere, and re-use them - this was you could create as many as you need, without creating infinite. This would require fairly complicated scripting, however.
Ironically, the cheesewheel that you can pick up may be able to avoid these problems by being picked up - I think that removes the reference and cleans the savegame. You'll need to look into that, assuming the thing being pick-up-able is OK. If you do this, make sure that you still make a new object for it.
If picking up the cheesewheel works to prevent bloat, but you don't want the player to pick it up, you might use a script on it that has an OnActivate block that prevents it from being picked up, except by your special "cleaning crew" container. I can help with that script, but like I said, I don't know if the picking up thing works, so you'll have to figure that out first - I'd suggest asking on the Elder Scrolls Forums.
Dragoon Wraith TALK 01:28, 17 January 2008 (EST)

Thank you! and I took your tip with the activator, so now it places an activator at the target that when activated, disables itself and gives the player a cheese wheel.-Mr. V 08:49, 17 January 2008 (EST)

Question on using RemoveAllItems to prevent savegame bloats[edit source]

About the trick mentioned in the PlaceAtMe page ( the one that says that moving items created with PlaceAtMe to an NPC and then using RemoveAllItems will prevent savegame bloats)

Would it work also with items created with AddItem? And if it is a container (like a chest) instead of an NPC? Does it work?

In other words: if I use AddItem to create an item in a chest, use it as needed and, at the end, move it back to the chest and use RemoveAllItems on the chest (and do it over and over again): Would I be causing savegame bloats? Or the RemoveAllItems prevents it in this scenario also?

Thanks in advance. --QQuix 00:40, 8 May 2008 (EDT)

Just use RemoveMe when you're done with the item.--Haama 02:28, 8 May 2008 (EDT)
Items in inventories do not have references (I know, this seems odd, but it's true; ask the OBSE team if you want a detailed description of how it works), so you don't have to worry much about savegame bloat with items in inventories.
If an item reference (i.e. an item sitting on the ground) is picked up, the reference is removed and the memory is restored appropriately (if Oblivion did not do this, savegames could balloon to massive proportions in a few hours of looting). At this point, it's just another member in a list, which takes exceedingly little memory.
Dragoon Wraith TALK 03:17, 8 May 2008 (EDT)
Thanks. That is good news for me.
But it is really odd, as I did some tests and found that items do keep some degree of individuality, even when they are put together in an inventory. It is a simple test: the script has a count and an onAdd Block that adds 1 to the count and prints it to the console. I picked and dropped several of these items a few times and noticed that they keep separate counts (several copies of the script, I suppose)
I will try to contact the OBSE Team, but just out of technical curiosity, as you have already answered my main concern. --QQuix 17:40, 8 May 2008 (EDT)
Yes, items have what is called "Extra Data" associated with them, which allow them from differ from each other while in an inventory. I believe it works something like this: There are two lists, one with the items in the inventory, and the other with the extra data for each item, so that they match up. Or something like that. Presumably Oblivion does this to save memory or improve performance...
Dragoon Wraith TALK 07:42, 9 May 2008 (EDT)

Bloat with creatures/NPCs?[edit source]

If using placeatme to create creatures or NPCs that do not get disabled under normal circumstances, if their corpses are left there to disappear when the cell respawns in three days, do the references remain? Is the clearing out of corpses when a cell respawns done in-game by disabling them or by some other method inaccessible through the console?

Cell's reset removes any PlaceAtMe object?[edit source]

Does the cell reset removes any object - actor or anything else - called by this function? I wanted to add a proper sound to the Screaming Maws from SI and I wondered does I can add it via script, without having to add them manually in each location. - ZuTheSkunk 19:44, 21 December 2010 (EST)

Hello? - ZuTheSkunk 07:38, 28 December 2010 (EST)
I don't know the answer, and not too many people check here anymore... I'd suggest asking on the Forums.
Dragoon Wraith TALK 12:43, 28 December 2010 (EST)