Difference between revisions of "Talk:PlaceAtMe"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Guidobot
m
imported>Mr. V
(Placeatme in scripts)
Line 100: Line 100:


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. [[User:Guidobot|Guidobot]] 13:58, 12 April 2007 (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. [[User:Guidobot|Guidobot]] 13:58, 12 April 2007 (EDT)
== Placeatme in scripts ==
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)

Revision as of 21:07, 16 January 2008

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

-- 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

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)