Jump to content

Moving objects via script (TranslateTo)


FuryoftheStars

Recommended Posts

Hmm, ok. Still not sure I want to take that approach for this mod for the purpose of relocating items. There are 6-7 items per hf home (x3) and it'd force any other mods touching the same items to create a patch to overwrite the quests from this one if they needed the items to be moved to a different location. I'd rather let load order take care of that.

Link to comment
Share on other sites

Actually, new thought.

 

So the point behind this was for those that are running/adding the mod mid play through, right? I'm already moving the objects in the CK as well, so those on a new play through don't need the scripts to update the object locations. Could I move the scripts into a separate mod (and use the quest idea), one meant purely for those that 1) are installing/running the main mod mid play through, 2) don't have any other mods installed that move these same objects, and 3) want to have their objects moved to the new locations? Players could thus install this optional mod and run the game, causing the quests to trigger and move the objects to their new locations. And then (I'm hoping this next part won't cause any problems), they can save & exit, and uninstall the optional mod. (If that does cause problems, then this idea forces them to use another mod slot... though maybe this optional mod can be made into an esl flagged mod? Sorry, I almost feel like I'm making this up as I type.)

 

Do you think that could work?

Link to comment
Share on other sites

What I would do instead is use a message to ask the user on install if they want to move the items. In the creation kit, make a new message where the body text is something like "Move hearthfire items?". Then have two buttons being No and Yes. Make sure the Messagebox box is ticked. Then in your script you can do this:

 

Scriptname TM_QuestScript extends Quest 

Message Property HFModInstallMsg Auto
ObjectReference Property HorkerHead Auto 
ObjectReference Property AnotherHFRef Auto 

Event OnInit() 
    Utility.Wait(1)
    If HFModInstallMsg.Show() == 1 ;if user chose button 1 "Yes"
        HorkerHead.SetPosition(0, 0, 0)
        AnotherHFRef.SetPosition(0, 0, 0)
    Endif
    
    Utility.Wait(1)
    Self.Stop() ;stop this quest.
EndEvent

I would suggest this because having a whole other esp in your L.O for just this one thing seems like overkill.

Link to comment
Share on other sites

Ok, thanks! I hadnât really thought much about the message box angle cause I havenât done anything with em yet and wasnât sure how itâd work.

 

Will SetPosition or something work if an object hasnât been enabled, yet (if the player hasnât âbuiltâ the object via the hearthfire system)? It would make things easier if I could put everything in the same quest....

 

Also, in the off chance that someone has used the console to disable/markfordelete some of these objects, will this cause errors when I attempt to use SetPosition and is there some kind of check I can make before hand or some other kind of error handling in Papyrus I can use (like ON ERROR GOTO NEXT for vbs)?

 

(Edit: Annnd these forums really do not like the apostrophe from my phone. Sorry about the random stuff it puts in their place. :/ )

Edited by FuryoftheStars
Link to comment
Share on other sites

I think moving items that are disabled should still work. You'd have to test it though. For deleted items you can put a condition in the script, and as you've moved the items directly in the creation kit I think you can use the MoveToMyEditorLocation function for convenience.

 

Message Property HFModInstallMsg Auto
ObjectReference Property HorkerHead Auto 
ObjectReference Property AnotherHFRef Auto 

Event OnInit() 
    Utility.Wait(1)
    If HFModInstallMsg.Show() == 1
        If HorkerHead != None && HorkerHead.IsDeleted() == False
            HorkerHead.MovetoMyEditorLocation()
        Endif 
        
        If AnotherHFRef != None && AnotherHFRef.IsDeleted() == False
            AnotherHFRef.MovetoMyEditorLocation()
        Endif 
    Endif
    
    Utility.Wait(1)
    Self.Stop() ;stop this quest.
EndEvent
Link to comment
Share on other sites

Ok, thanks! I did try MovetoMyEditorLocation previously, but it didn't seem to work (even for the chandeliers, which TranslateTo did work for). I'll give it another go, though. It's possible it just didn't work under the context of the script I was working with?

 

Edit: Oh, as there's a way to tell if the object has been deleted... is there a way to undelete the object? For the horker head and other items by it, it's not a big deal, but I imagine the chandeliers would be.

Edited by FuryoftheStars
Link to comment
Share on other sites

Ok, so I got the quest itself working, dialog message pops and I can confirm that it's running through the pieces to move the object (via Debug.Trace messages)... but the object doesn't move (and I'm running this against one of the chandeliers which did work with the script attached directly to it). I've tried MoveToMyEditorLocation, SetPosition, and TranslateTo. I've also tried enabling the chandelier, first. Do I have to wait until the chandelier is actually loaded? IE, I need to be in the cell so it loads the 3d object?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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