Modding:Coding An Item: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 112: Line 112:
==Materials and Texture .lsx==
==Materials and Texture .lsx==
Now, we move on to our materialbank.
Now, we move on to our materialbank.
MySweetMod\Public\MySweetMod\Content\Assets\Characters\[PAK]_Armor


I am not reproducing the entire material here, but should be easy enough to find an item material to copy if you search the SourceFile listed.
I am not reproducing the entire material here, but should be easy enough to find an item material to copy if you search the SourceFile listed.
Line 132: Line 134:
  <children>
  <children>
  <node id="ScalarParameters"> '''x7
  <node id="ScalarParameters"> '''x7
  (Cut for length)'''
  '''(Cut for length)'''


  There should be 4 Texture2DParameters in your material, for BM, NM, PM, and MSK.
  There should be 4 Texture2DParameters in your material, for  
  <node id="Texture2DParameters"> NM cape
  <node id="Texture2DParameters"> NM cape
  <attribute id="Enabled" type="bool" value="True" />
  <attribute id="Enabled" type="bool" value="True" />
  <attribute id="ExportAsPreset" type="bool" value="True" />
  <attribute id="ExportAsPreset" type="bool" value="True" />
  <attribute id="GroupName" type="FixedString" value="01 Texture Map" />
  <attribute id="GroupName" type="FixedString" value="01 Texture Map" />
  <attribute id="ID" type="FixedString" value="00000000000000NM" /> Generate new UUID- this links to texturebank.
  <attribute id="ID" type="FixedString" value="00000000000000NM" /> This links to texturebank.
  <attribute id="ParameterName" type="FixedString" value="normalmap" />
  <attribute id="ParameterName" type="FixedString" value="normalmap" />
  <attribute id="UniformName" type="FixedString" value="Texture2DParameter_normalmap_DefaultWrapSampler" />  These parts tells you what it is.
  <attribute id="UniformName" type="FixedString" value="Texture2DParameter_normalmap_DefaultWrapSampler" />  These parts tells you what it is.
  Look for normalmap, physicalmap, basecolor and MSKColor. We are just going to list the normalmap here.
  Look for normalmap, physicalmap, basecolor and MSKColor. We are just going to list the normalmap here.


  <node id="Vector3Parameters"> '''You can use these to set an inherent colour to your material.'''
  <node id="Vector3Parameters"> '''You can use these to set an inherent colour to your material.'''
  <attribute id="BaseValue" type="fvec3" value="0.7667436 0.7667436 0.7667436" />
  <attribute id="BaseValue" type="fvec3" value="0.7667436 0.7667436 0.7667436" />
Line 152: Line 152:
  <attribute id="GroupName" type="FixedString" value="02 Colour" />
  <attribute id="GroupName" type="FixedString" value="02 Colour" />
  <attribute id="IsColor" type="bool" value="True" />
  <attribute id="IsColor" type="bool" value="True" />
  <attribute id="ParameterName" type="FixedString" value="Metal_Primary" /><attribute id="Value" type="fvec3" value="1 1 1" /> '''The 1 1 1 is the colour code here. You can use [https://www.nexusmods.com/baldursgate3/mods/502 BG3 Minitool] to convert a value.'''
  <attribute id="ParameterName" type="FixedString" value="Metal_Primary" /> This one will affect the primary metal of the armour.
 
<attribute id="Value" type="fvec3" value="1 1 1" /> '''The 1 1 1 is the colour code here. You can use [https://www.nexusmods.com/baldursgate3/mods/502 BG3 Minitool] to convert a value.'''
  </node>
  </node>


Line 168: Line 170:


Materials with _VT at the end are useless to us, as they only work with virtual texture. A virtualtexture is essentially a box for textures that makes it load faster. We don't have any way of packing virtualtextures ourselves, so do not attempt to use those materials.
Materials with _VT at the end are useless to us, as they only work with virtual texture. A virtualtexture is essentially a box for textures that makes it load faster. We don't have any way of packing virtualtextures ourselves, so do not attempt to use those materials.




In order to make, say, pants disappear when boots are put on, you may need to use a _Vertcut Material, such as 'Public/Shared/Assets/Materials/Characters/CHAR_BASE_VertCut.lsf', and ensure VertexMask is set to True in the mesh lsx. (As well as vertex painting the item itself the desired colour)
In order to make, say, pants disappear when boots are put on, you may need to use a _Vertcut Material, such as 'Public/Shared/Assets/Materials/Characters/CHAR_BASE_VertCut.lsf', and ensure VertexMask is set to True in the mesh lsx. (As well as vertex painting the item itself the desired colour)


We now add a texturebank to the same lsx.
We now add a texturebank to the same lsx.
Line 202: Line 204:
==RootTemplate==
==RootTemplate==
Now for the game recognise the circlet as an item, we add it to the root template lsx:
Now for the game recognise the circlet as an item, we add it to the root template lsx:
MySweetMod\Public\MySweetMod\RootTemplates\MySweetMod.lsf.lsx


  <?xml version="1.0" encoding="utf-8"?>
  <?xml version="1.0" encoding="utf-8"?>
Line 265: Line 269:
  <children>
  <children>
  <node id="MaterialPresets" />
  <node id="MaterialPresets" />
   
   
  '''(We can add any colour available to us (cloth, leather, accent) but this circlet is only metal 1 so we only need to list metal 1.)'''
  '''(We can add any colour available to us (cloth, leather, accent) but this circlet is only metal 1 so we only need to list metal 1.)'''
Line 313: Line 316:


==Armor and Passives==
==Armor and Passives==
'''MySweetMod\Public\MySweetMod\Stats\Generated\Data\Armor.txt'''
'''MySweetMod\Public\MySweetMod\Stats\Generated\Data\Passive.txt'''
Meanwhile in your '''Armor.txt''', they link up like this:
Meanwhile in your '''Armor.txt''', they link up like this:


Line 346: Line 353:
==Loca==
==Loca==


Remember to name your localisation file loca.xml so it converts properly.
'''MySweetMod\Localization\English\MySweetMod.loca.xml'''


You can generate a handle by ticking the Handle box next to 'GENERATE' on the Multitool. It is much like an UUID but it starts with an H.
You can generate a handle by ticking the Handle box next to 'GENERATE' on the Multitool. It is much like an UUID but it starts with an H.
Line 360: Line 367:


==TreasureTable==
==TreasureTable==
'''MySweetMod\Public\MySweetMod\Stats\Generated\TreasureTable.txt'''
Now, you need to put it in the treasuretable.
Now, you need to put it in the treasuretable.
Your treasuretable should look like this:
Your treasuretable should look like this:


Line 370: Line 380:
This will make it spawn in the tutorial chest.
This will make it spawn in the tutorial chest.


If something goes wrong, it is recommended to overwrite a custom mesh from someone else's mod. When you know the fault is not with your mesh, you can fix things one step at a time. No one can fix it better than you- sometimes it is best to just leave things a day or two and come back to them with a clear head.
If something goes wrong, it is recommended to overwrite a custom mesh from someone else's mod, or add it to the back of an existing mod. When you know the fault is not with your mesh, you check your materials, and so you can fix things one step at a time.  


{| class="nomobile" style="text-align:center; margin: auto; border:1px solid #785000; font-size:83%; background-color:#1B1B1B; width: 60;" ;
{| class="nomobile" style="text-align:center; margin: auto; border:1px solid #785000; font-size:83%; background-color:#1B1B1B; width: 60;" ;

Navigation menu