1. Making Collision Objects
First thing you need to do is making collision objects for your shield.
There are currently two ways to do that: Using 3ds max 2013 (classic, textbook way) and using nifskope 2.0 dev10
If you have 3ds max 2013 with BGS official nif exporter installed on it, I recommend going with it since it allows you to make more accurate collision objects.
But I know it's hard to get it since it's a very old version, so I'm gonna explain both ways anyway.
For weapons, you need nifs with different settings.
Just follow the guides below and make one for the ground model.
It will be used when you drop the shield on the ground.
If you're making an armor, then you don't need one for the ground.
When you're making collision objects, make sure they have unique names since they will be used in the JSON data.
The name of NiNode or trishape that has a collision object attached will be used to determine if it's a shield or not.
1-1. 3ds Max 2013
Watch the guide by Trophi Hunter
To make the collision object for the actual shield, you don't even need to make proxy boxes like that guide.
You can simply copy the mesh, make it a bit larger and use it as a proxy.
Follow the guide above from 11:00, but change the Shape Type to Mesh.
Also, don't set anything on Rigid Body. You can skip that.
When you assign a collision group, don't use custom material just pick something like ActorMetal, or even Metal is fine.
For object type, choose Anim Static. Hit apply to selected.
Export it and process it with Elrich.
1-2. Nifskope 2.0 dev 10 and above
Watch the guide by Jonathan Ostrus
One cool feature added in the recent version of Nifskope is that you can create a convex hull collision object with a single click.
The collision object for the shield shouldn't be movable so skip the mass setting and stuff at 4:30.
Click bhkRigidBody and change Layer to FO4_ANIMSTATIC.
Expand Rigid Body Info and change Layer under that to FO4_ANIMSTATIC as well.
Scroll down and you'll see various settings for the rigid body.
Set Solver Deactivation to SOLVER_DEACTIVATION_LOW
Collision Response to RESPONSE_SIMPLE_CONTACT
Quality Type to MO_QUAL_BULLET
Follow the rest of the guide and process it with Elrich.
2. ESP works
2-1. Weapon
For weapons, like the one included in the mod, you need to create two OMODs.
One is for the actual shield, and another is automatically swapped when you drop the weapon on the ground so it can have a dynamic collision object.
Create an attach point for the shield and create two OMODs.
You'll have to add the attach point to the weapon itself or the receiver omod, either way is fine.
Don't forget to setup the attach parent on the nif as well so the OMOD nif can show up in-game.
Make both OMODs use the added attach point and link the nifs: one with the anim static, and one with the dynamic collision object
The one with anim static will be Main, and the other will be Ground in the JSON data.
That's all for the ESP.
2-2. Armor
Armors are kinda tricky. If the armor is not skinned and it has only one armor addon, like it's a whole mesh with only one bone, then it's easy.
You can just delete BSSkin::Instance and add NiStringExtraData with Name Prn and the name of bone in Data.
That will make the mesh attached to that bone, but you'll have to translate the mesh into the bone's local space.
If you don't know how to do that, scroll down and follow the guide for skinned meshes.
a) NiStringExtraData - Prn
You need to setup an attach point keyword and add it to attach parents list of Armor record.
Create an empty OMOD that uses the attach point and add it to the armor.
Link the shield nif and it's done.
b) Skinned Mesh
For skinned meshes, you need a separate armor addon and a nif that only contains the collision object.
Delete trishapes from the nif you've created and save it as a separate file.
Before we go further, you need to understand how armors in Fallout 4 works.
The armor gets slots assigned on them, and you specify armor addons that the armor can potentially have on it.
Each armor addon should have at least one slot that overlaps with the main armor to work correctly.
The default value of armor index is 1, and all armor addons with the same armor index will be shown at once.
That being said, since we need to create a separate armor addon and make it shown with other armor addons, you might need to re-organize slots a bit.
You might need more slots assigned on the main armor, but you might also be able to fit it in.
For example, let's say we have a helmet with 30, 46 assigned on the armor.
AA1 (armor addon 1) uses 30, 31 and AA2 uses 46.
If we want to add our AA3 here, we need to add 31 to the helmet, remove 31 from AA1 and make AA3 use 31.
It sounds hard, I know, but whatever. Add an armor addon and link it to our "collision" nif.
If the armor has multiple armor addons with different armor indices, then you'll have to add it several times with different armor indices as well.
Now, setup an attach point keyword and add it to attach parents list of Armor record.
Create an empty OMOD that uses the attach point and add it to the armor.
Link the "collision" nif again, and it's done.
3. JSON Data
The weapon or armor can take hits, but it won't block the incoming damage.
You need to tell that specific collision object is a shield through JSON data.
Create F4SE\Plugins\ShieldFramework\ShieldData folder and create a new .json file.
Use JSON Editor Online for easier edits.
3-1. Weapon
The basic structure looks like below.{
"ShieldFramework.esm|0x800": {
"OMODs": {
"MW19RiotShield": {
"MainOMOD": "ShieldFramework.esm|0x801",
"GroundOMOD": "ShieldFramework.esm|0x802",
"Parts": {
"ShieldFramework_Metal": {
"MaterialType": "RiotShieldMetal",
"IMOD": "ShieldFramework.esm|0xFAA",
"DamageThreshold": 300,
"ShakeDuration": 0.5,
"ShakeStrength": 0.2
},
"ShieldFramework_Glass": {
"MaterialType": "RiotShieldGlass",
"IMOD": "ShieldFramework.esm|0xFAA",
"DamageThreshold": 240,
"ShakeDuration": 0.5,
"ShakeStrength": 0.1
}
}
}
}
}
}
The first key specifies "the name of esp/esl/esm|Form ID of the weapon".
Next key should be OMODs, and MW19RiotShield is just a unique name to separate each data.
MainOMOD should point to your Main OMOD, the one with anim static collision object.
GroundOMOD should point to your Ground OMOD, the one with dynamic collision object.
Now we start defining parts by using Parts key.
Each key in the Parts should be the name of collision objects.
Parts can have several properties. They are all optional, so add the ones you need.
Refer to 3-3 for the properties.
3-2. Armor
The basic structure looks like below.{
"[XHX] EFT Gear.esp|0x895": {
"Parts": {
"Altyn": {
"MaterialType": "RiotShieldMetal",
"IMOD": "ShieldFramework.esm|0xFAA",
"DamageThreshold": 100,
"ShakeDuration": 0.7,
"ShakeStrength": 0.3
}
}
}
}
Mostly same as the weapon, but it doesn't have OMODs data.
The first key specifies "the name of esp/esl/esm|Form ID of the armor".
Then, just start specifying parts with Parts key.
Altyn in the example is the name of collision object.
Parts can have several properties. They are all optional, so add the ones you need.
Refer to 3-3 for the properties.
3-3. Part properties
MaterialType: The name of material type. You can find it under Material Type in the esp. MNAM - Material Name should be used.
IMOD: Image Space Adapter that will be applied to the player on impact.
DamageThreshold: Maximum damage that the shield can block.
ShakeDuration: The duration of camera shake applied to the player on impact.
ShakeStrength: The strength of camera shake applied to the player on impact.
Spells should be in a form of "the name of esp/esl/esm|Form ID of the spell"
SpellShielder: The spell that gets applied to the shield holder on unblocked attack
SpellAttacker: The spell that gets applied to the attacker on unblocked attack
SpellShielderOnBlock: The spell that gets applied to the shield holder on blocked attack
SpellAttackerOnBlock: The spell that gets applied to the attacker on blocked attack
11 comments
But after "Create Convex Shape". I'm getting a bit lost.
Nifskope is showing the collision mesh is on the ground instead of around the original model
and I can't change bhkrigidbody to FO4_Animstatic because it's stuck to Skyrim versions (SKYL_ANIMSTATIC)
EDIT:
I knew I was missing something. I forgot to install the nif.XML file
EDIT2:
Now I'm lost. I can't find Elrich. I have creation kit installed but I see no sign of Elrich...
EDIT3:
I found it... for some reason it was hidden. Search function found the folder but I still no idea where it actually is. Oh well.
EDIT4:
Managed to convert the file on Elrich... now I'm not sure what to do onwards or if I've actually done what I did so far correctly lol.
Gonna need some help. I'm not quite sure if the collision vertices being on the ground, away from the actual floating model would be fine
I wanted to put the collision mesh on the visor only but following the tutorial only makes it appear on the ground like this.
My files
Thanks
When the game attaches the OMOD nif, the scene root gets deleted so "ATCShield_OBJImport" does not exist anymore.
It can be fixed by attaching the collision object on BSTriShape and renaming it to "ATCShield_OBJImport".
You'll need to change the name of scene root NiNode to something else since there can't be multiple objects with same name.
Here's the fixed nif.
My incompetence knows no bounds! I had no idea this would happen. Thanks for taking the time to clean up my mess, you're the goat jarari
Extra NiNodes are not essential tho. They were added by the exporter when I exported the mesh with 3ds max 2013.