Jump to content

Moving objects via script (TranslateTo)


FuryoftheStars

Recommended Posts

So, in helping someone else update a mod for the hearthfire homes they converted from LE to SE, I'm trying to find a way to move vanilla objects via script to just simply move them to new locations. Because of the way these things get baked into save files, the original author just added new items and instructed folks to not build the vanilla ones, or, if they already had, to use the console to disable them.

 

I've found that with the TranslateTo command via script, I'm actually able to move some of the vanilla objects to the new locations the original mod author put new items at, thus eliminating the need for the player to actually remember/do anything other than play the game as they normally would. However, this only seems to be working with some objects.

 

It works with the 3 chandeliers in the main hall.

It doesn't work with the mounted horker head, or the night stand and book directly under the horker head, also in the main hall.

 

I've also tried using the SetPosition command to no avail.

 

Any insight into why this is happening and what can be done to fix it would be greatly appreciated.

 

Thanks!

Link to comment
Share on other sites

Thanks for the suggestions, though they don't seem to be working. I did some additional testing throwing some Debug.Trace commands in there and I've found something interesting. I'm using the OnLoad event to initiate the move, but what I'm finding is that while OnLoad does fire for the chandeliers, it's not for the others (or at least not for the wall mounted horker head).

 

Is there a better, more reliable/consistent event I could be using?

Link to comment
Share on other sites

Thanks, and sorry, I haven't had a chance to try this yet.

 

(Just as a side note, while I know you were helping me previously in understanding the quest method of doing things, I haven't done that with this other mod I'm helping on. I guess the reasoning in my head at the moment is that if another mod needs to be able to update these same objects' positions (which I actually do know of one), I'd rather them have the ability to overwrite rather than needing to make a patch to overwrite/delete the quest items from this one.)

Edited by FuryoftheStars
Link to comment
Share on other sites

Yes, the original mod author (and myself) both did that, but for those installing the mod in an active play through were not seeing these objects move to the updated positions. Hence why the original mod author just threw in new replacement objects and put instructions in the mod description to then not build the originals. The originals were getting their locations baked into the save (and it seemed like it was happening even before building the house. I tested going all the way back to just after purchase of the house and yet everything tried staying in their original place). Edited by FuryoftheStars
Link to comment
Share on other sites

Ok, so OnInit does run for the wall mounted horker head (EDIT: Nope, it doesn't... whoops!), but I'm still unable to get it to move. TranslateTo and MoveTo both fail to actually move it. I even tried disabling it first, ran the move operation, then re-enabled it. OnInit also seems to run before actually enabling it through the build system (so I don't know if that makes a difference).

 

It seems like it should be moveable, though. I've successfully used the Decorator Helper mod to move it in game and, as near as I can tell, they only use the TranslateTo command throughout their scripts to accomplish this.

Edited by FuryoftheStars
Link to comment
Share on other sites

Whoops! Nope, OnInit does NOT run for the horker head, either. I thought it did, but was accidentally picking up entries in the log from other items I had the script attached to.

 

At this point, I'm starting to try different random events to see if I can find one that actually fires for it.

 

EDIT: Welp, I've gone through all events listed here (https://www.creationkit.com/index.php?title=ObjectReference_Script#Events) that are available to ObjectReferences and none of them trigger for the wall mounted horker head when enabled via the hearthfire's building system.

Ah, to heck with it. I guess I'll just have leave those 3 objects in the corner that don't seem to be working as just moved in the CK. Those that start a fresh game will see them moved. Those that don't will still have to use the console and/or another mod like the Decorator Helper mod.

Edited by FuryoftheStars
Link to comment
Share on other sites

That's why I suggested you use a new quest that's start game enabled with the OnInit() Event. That way you don't have to rely on the objectreferences events. Example:

Scriptname TM_QuestScript extends Quest 

ObjectReference Property HorkerHead Auto 
ObjectReference Property AnotherHFRef Auto 

Event OnInit() 
    Utility.Wait(1)
    HorkerHead.SetPosition(0, 0, 0)
    AnotherHFRef.SetPosition(0, 0, 0)
    Utility.Wait(1)
    Self.Stop() ;stop this quest.
EndEvent
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...