Disabling havok on multiple references

Post » Tue Feb 07, 2017 6:36 pm

I created a bookshelf, in which each book has its place, but if you don't put them all together, then they leave their places and make a mess. I know that adding a script disablehavokonload would stop this problem, but I don't know how to add it to about 350 references. Have you any tips?

User avatar
Meghan Terry
 
Posts: 3414
Joined: Sun Aug 12, 2007 11:53 am

Post » Tue Feb 07, 2017 4:33 pm


There is a way to dynamically add a script to objects, although I would not recommend doing it on books, especially since there are some books and mods that already have scripts on them. But you can research it and decide for yourself:



http://www.creationkit.com/index.php?title=Dynamically_Attaching_Scripts



You may try creating a new instance of the bookshelf activator (don't use the vanilla one to add a script to) and whenever its activated get the book information and set it that way. or whatever activator the books actually go into. I'm not sure how or if the activator keeps track of its contents, but you could look into it and see if you can't manipulate it that way.



On the PlayerBookShelfContainer object, there is a PlayerBookShelfContainerScript.



Within it keeps track of all the books that are linked to the dummy (DefaultBookShelfBookMarker) you set up.



Using that you should be able to set each of the references to do as you want. I don't know where you got DisableHavokOnLoad from, but you should probably use setMotionType(Motion_Keyframed)


http://www.creationkit.com/index.php?title=SetMotionType_-_ObjectReference



You could try doing it in the Event OnCellLoad block but that isn't going to work right. it only calls that event once the cell is loaded initially, that isn't going to help you when you enter a cell and then start putting books into your bookshelf, they will havok, then the next time you come into the cell they will be frozen in their havok'd state, which may cause some issues.



What you want to do is use the Event OnItemAdded and the Function RemoveBooks.



In the OnItemAdded Event,




and finally you MAY have to reset the motiontype whenever you remove a book, so just revert your changes according to the ck.com link i gave you for the static motion type in the removeBook function. Although I don't think you have to because it should'nt be affecting the base item or even the reference to the book directly, only whenever its in the dummy container.

User avatar
Marion Geneste
 
Posts: 3566
Joined: Fri Mar 30, 2007 9:21 pm

Post » Wed Feb 08, 2017 3:50 am

one more thing, if setting the motiontype on the akBaseItem doesn't work for whatever reason, you could try setting the motion type on the BookMarkerXX properties instead within that same IF scope I quoted.

User avatar
Ladymorphine
 
Posts: 3441
Joined: Wed Nov 08, 2006 2:22 pm


Return to V - Skyrim

cron