Talk:PlaceActorAtMe - ObjectReference
I have come across some info about this function at a site that I cannot link due to the sites "theme"(lovers lab).
It seems PlaceActorAtMe has the persistent flag set to true by default, though obviously this cannot be changed, unlike PlaceAtMe.
This carries a serious problem if this is indeed true, as it means calling Delete() on actors created with this function does not delete them. This could also make this function useless. I haven't used it myself, but I thought I should put this warning here as a heads up. --Terra Nova2 (talk) 2014-10-23T15:22:04 (EDT)
Best alternative then, would be to do something like:
; ...
Actor actorRef = someRef.PlaceAtMe(actorBase as Form) as Actor
; ...
It might be silly to point it out, but while working on my first mod I didn't figure out how to apply the proper casts. I didn't test this yet, but I'd assume that with this you'd have the actor non-persistent. --Darkitow (talk) 2015-02-25T22:19:20 (EST)
- Well don't worry about it. Already had at least one person confirm that it doesn't persist, and I trust his word more because he's been around the modding block a few times lol.--Terra Nova2 (talk) 2015-02-28T04:56:56 (EST)
- It's confirmed it PlaceActorAtMe() spawns non-persistant actors. --Terra Nova2 (talk) 2015-03-02T08:16:50 (EST)
Potential to cause CTDs?[edit source]
In one of my mods, I had a quest that was Start Game Enabled. An OnInit function on this quest used PlayerRef.PlaceActorAtMe and stored the result in a property. That mod would CTD every time the Chargen quest tried to autosave (at the end of the cart ride to Helgen, or after character creation if you're using Alternate Start LAL). Removing that entire script solved the problem completely.
However, I was curious, so I looked a little deeper.
One of the exception addresses (uncovered by Crash Fixes) was in a part of the game engine related to saving data; Skyrim was attempting to operate on a reference's parent cell/world when it had no parent cell/world. This led me to speculate that Skyrim was actually running that OnInit function before the player was moved to where they should be (possibly even before the player was spawned in the game world); how else could you have a reference that... just... isn't anywhere?
Where it gets weird, however, is here: when I used the console to move the placed actor to the player and then triggered the autosave, I got a crash at a completely different part of the game -- one trying to act on an object related to player movement, when that object did not exist. So, uh,... yeah...
The moral of the story is, be careful about calling this function from OnInit on a Start Game Enabled quest. DavidJCobb (talk) 2017-03-08T07:45:33 (EST)