Modding:Coding An Item: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 8: Line 8:
Your mod is '''MySweetMod'''
Your mod is '''MySweetMod'''
*MySweetMod
*MySweetMod
** Generated***Public
**Generated
**Public
****MySweetMod
****MySweetMod
*****Assets <- models and textures
*****Assets <- models and textures
Line 36: Line 37:


We now create 2 lsf.lsx for our MySweetMod\Public\MySweetMod\Content\Assets\Characters\'''[PAK]_Armor'''.
We now create 2 lsf.lsx for our MySweetMod\Public\MySweetMod\Content\Assets\Characters\'''[PAK]_Armor'''.
In these will be a visualbank (meshes),a materialbank (material) and a texturebank(textures). You can split them into or combine them all, when the multitool converts them they will all get merged together anyway. This seperation is for viewere ease as they can become very long. For our needs we are putting them into 2, a meshes and a texture/material one.
In these will be a visualbank (meshes),a materialbank (material) and a texturebank(textures). You can split them into or combine them all, when the multitool converts them they will all get merged together anyway. This seperation is for viewer ease as they can become very long. For our needs we are putting them into 2, a meshes and a texture/material one.
First, we add a meshes.lsx.
First, we add a meshes.lsx.
   <version major="4" minor="0" revision="4" build="602" />
   <version major="4" minor="0" revision="4" build="602" />
Line 108: Line 109:
  </save>                           
  </save>                           


Now, we move on to our mesh.
Now, we move on to our materialbank.
 
<?xml version="1.0" encoding="utf-8"?>
 
  <save>
 
  <version major="4" minor="0" revision="4" build="602" />
  '''(Beginning of materialbank)'''
  <region id="MaterialBank">
    <node id="MaterialBank">
    <children>
'''(BEGINNING OF MATERIAL)'''
<node id="Resource">
<attribute id="DiffusionProfileUUID" type="FixedString" value="" />
<attribute id="ID" type="FixedString" value="00000000000000000000004" /> ID links up to Meshes visualbank.
<attribute id="MaterialType" type="uint8" value="13" />
<attribute id="Name" type="LSString" value="CircletMaterialName" /> Again this is never referenced anywhere else, but it is best to keep it as unique as you can to prevent clashes.
<attribute id="SourceFile" type="LSString" value="Public/Shared/Assets/Materials/Characters/CHAR_BASE.lsf" /> This is a fairly standard material without transparency or glow. Transparent materials have 'alpha' in the title.
<children>
<node id="ScalarParameters"> x7
(Cut for length)
There should be 4 Texture2DParameters in your material, for
<node id="Texture2DParameters"> NM cape
<attribute id="Enabled" type="bool" value="True" />
<attribute id="ExportAsPreset" type="bool" value="True" />
<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="ParameterName" type="FixedString" value="normalmap" />
<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.
<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="Enabled" type="bool" value="True" />
<attribute id="ExportAsPreset" type="bool" value="True" />
<attribute id="GroupName" type="FixedString" value="02 Colour" />
<attribute id="IsColor" type="bool" value="True" />
<attribute id="ParameterName" type="FixedString" value="Metal_Primary" /><attribute id="Value" type="fvec3" value="1 1 1" />
</node>
(Cut for length)
</node>
</children>
</node>
'''(End of material)'''
</children>
</node>
</region>
(End of MaterialBank)
We now add a texturebank to the same lsx.
    <region id="TextureBank">
    <node id="TextureBank">
    <children>
    '''(texture begins here)'''
    <node id="Resource">
    <attribute id="Name" type="LSString" value="Generated/Public/MySweetMod/Assets/MSW_CoolCirclet_NM" /> The name is never referenced anywhere else but try to keep it unique.
    <attribute id="ID" type="FixedString" value="00000000000000NM" /> This
    <attribute id="SourceFile" type="LSString" value="Generated/Public/LathanderArmory/Assets/MSW_CoolCirclet_NM.DDS" /> Capitalisation is IMPORTANT. Make sure your is not named MSW_CoolCirclet_NM.dds or it won't load.
    <attribute id="Format" type="uint32" value="64" />
    <attribute id="Width" type="int32" value="1024" /> These dimensions don't need to be exact. I believe if it is smaller than listed, the texture will tile.
    <attribute id="Height" type="int32" value="1024" />
    <attribute id="Depth" type="int32" value="1" />
    <attribute id="Localized" type="bool" value="False" />
    <attribute id="SRGB" type="bool" value="False" /> This does things. I am not sure what.
    <attribute id="Streaming" type="bool" value="True" />
    <attribute id="Template" type="FixedString" value="" />
    <attribute id="Type" type="int32" value="1" />
    </node>
    '''(texture ends here)'''
    </children>
            </node>
            </region>
            </save>


If there is anything wrong, your item may simply refuse to show up, so it is worth double checking everything here.


==RootTemplate==
==RootTemplate==
Now for the game recognise the 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:


  <?xml version="1.0" encoding="utf-8"?>
  <?xml version="1.0" encoding="utf-8"?>

Navigation menu