Jump to content

Replacing collision in NifSkope (easy way)


kitcat81

Recommended Posts

Guys, I wasted a few hours on trying to find a way to replace a collision box for my scaled nif. It happened so that I just accidentally found a way to copy it really quickly without any need to delete and paste any branches and blocks and I decided that it might be useful to share as it`s really difficult to find any instructions on using NifSkope with FO4 files.

NifSkope: Replacing collision in few clicks.
This is a method of replacing the collision box with the help of NifSkope 2.0.0 - pre alfa 5 (earlier versions might not support this function, I did not test it with other versions).
It shows an easy way to replace the collision box of your object with some vanilla collision box. You can download the latest NifSkope here.

If your object has no collision at all, please scroll down to second part that shows how to add the required blocks.

 

Finding a replacement:
You need to find some in-game object that has close shape and size to your object. It can also be smaller or bigger (depends on your needs). Note that replacing the object`s collision can also change some of it`s qualities. It can make the object movable or unmovable, possibly some other parameters, depends of the data you take from another object.

Open NifSkope : file - browse archive - data - fallout 4 meshes (or another archive that contains the required object). Find the required nif using the search field.

Open the second window with your object( file - new window, choose your nif)
Now we are finally starting to replace the collision.

Copying and Replacing:
In the window with the vanilla object find block named bhkNPCollisionObject, expand this block if it`s not expanded. You should be able now to see the bhkPhysicsSystem block.
This is exactly what we are looking for.
This block contains binary data and a string that shows some number of bytes. Right click the string and choose "export". In the popped up window choose any folder you want, click at free space and create a new txt document. Choose this document and press OK, agree to replace the document.

In the window with your object find the same block (bhkPhysicsSystem). Right click on it`s binary data string, choose "import". In the popped up window find your txt document, select it and press OK. Save your file with another name (it`s always better to have a backup in case you get some unexpected result).

That`s it, we have replaced your collision with the collision of another object.

 

Notes:

* The data in the text file looks unreadable and this is normal. (I wonder if there is a way to turn it into something readable that can be editted manually.)

* When importing binary data the Nifskope can accept a nif file, but it won`t work this way and will crash your game.

 

 

 

Adding a collision block to your object.

I think I should also add some info on how to add a collision block for objects that have no collision at all.

 

Step 1:Creating the required blocks

If the object has no BSXFlags block (that is iusually number 1 and can be found right under the zero NiNode), you need to create this block too.

In Nifskope right click the zero NiNode - Insert - Bethesda - BSXFlags.

Right click the created BSXFlags block, Insert - Havok - bhkNPCollisionObject. Right click the created bhkNPCollisionObject block, Insert - Havok - bhkPhysicsSystem. Be careful when you insert new blocks, there are blocks that have very similar looking names, but they are different.

Check your new blocks, there should be 3 new blocks, each block has a number before its name. These numbers should be like these: 1 for BSXFlags block , 2 for bhkNPCollisionObject and 3 for bhkPhysicsSystem).

We have created the required blocks and now we will change them to make it all work together.

 

Step 2: Adjusting the created blocks

Select the BSXFlags block and look at the Integer Data string. Double click the string to set the number of flags. It`s better to take the number of flags from some similar vanilla object unless you know what number you need. For example, a wood crate has 130 flags in this block and I used this number for my object.

If you click the tiny flag icon next to your value, you can see what this value actually means and what settings it changes. Make sure that havok is checked ( the collision checkbox is used instead of havok in prior nifskope versions). You can use these checkboxes instead of setting the value. In this case the value will be set automatically. Use this way if you know what settings to check.

 

Select the zero NiNode and in the block details find the Num Extra Data List line. Click the line and set the number to 1(if it already has some number , add 1 to it). Press the refreshing sign (green arrows) next to the Extra Data List. Now you can expand the Extra Data List that has "none" data yet. Expand and change the "none" data to the number of your BSXFlags block( 1 in our case).

In the same block (zero NiNode) find the Collision Object line, click it and type your collision block number ( should be 2 in our case).

 

Select your bhkNPCollision block. Find the Target line and type the number of your NiNode(zero in our case).

In the Flags line type some number of flags. You can take the number from some similar vanilla object. Most objects have number 128 in this block, so you can try using 128.

In the Data line type the number of your bhkPhysicsSystem block (3 in our case).

 

Now you can Import binary data to your Physics system block as it was described in the first part of this article.

When you are done with importing the collision, save your .nif file with another name. Test it in game.

Edited by kitcat81
Link to comment
Share on other sites

That's quite useful to know! Thanks for sharing. :smile:

 

Edited April 2018 to add

Info on BSX Flags:

------------------------

I unfortunately don't know all of the settings and when to use them. However I've discovered the following general rules of thumb:

 

Static objects typically have the following checked Bit 1 Havok, Bit 3 Complex, Bit 7 Articulated.

 

Moveable static objects typically have the following checked Bit 1 Havok, Bit 6 Dynamic, Bit 7 Articulated.

 

I believe that Addon refers to Addon nodes that provide effects like smoke, candle light, fire, sparks, etc. I have little to no idea what any other checkboxes are for other than the ones I've mentioned outside of what hints their names give.

 

IMPORTANT: It doesn't matter what sort of collision your object has, no collision will be recognized or work in game if Bit 1 Havok isn't checked. Even Non-collidable collision requires that to be checked.

Link to comment
Share on other sites

That's quite useful to know! Thanks for sharing. :smile:

:smile: Glad to know. I hope people will be able to find it here, was not sure where to add this as I did not want to create a "mod page" just for a short 1 page tutorial.

 

Just found some grammar mistakes in my text lol. I`m not a native English speaker so if something I wrote makes no sence you are all free to point me at it.

Edited by kitcat81
Link to comment
Share on other sites

This is really good information, the way I was doing it before was trying to clean the .nif completely of everything but collision and then copy all the branches in. And that is an extremely imperfect system. Thank you so much for this.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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