Modding:Coding An Item: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 1: Line 1:
<div class="nomobile" column-width: "60em2;>
<div class="nomobile" column-width: "60em2;>
Now, you have made a mesh for a certain race. We are going to add it to the game.
You have made a mesh for a human man, a circlet. We are going to add it to the game.
Remember to check your naming conventions for .lsf.lsx files so the multitool correctly converts them, and keep in mind that some lsx files should not be converted to lsf at all.


Your mod is '''MySweetMod'''
*MySweetMod
** Generated***Public
****MySweetMod
*****Assets <- models and textures
**Localization*** Language <- usually ''English''
**** <code>MySweetMod.loca</code> <- text for items and spells
**Mods
***MySweetMod
****<code>meta.lsx</code> <- See [[Modding:Creating meta.lsx|Creating meta.lsx]] Do not convert to lsf!
**Public
***Game
****Assets
***MySweetMod
****Assets
****Content
******Assets
*******Characters
********[PAK]_Armor <-- material and mesh LSX for custom outfits and weapons
****GUI
*****RootTemplates <--- Your Roottemplate lsx goes here. MySweetMod.Lsx
*****Stats
*******Generated <--- TreasureTable.txt - This tells the game where the item will spawn.
********Data <--- Armor.txt, Object.txt, Passive.txt, Weapon.txt and other TXT files. These contain stats.




First, we add the mesh we created to the  
We export the mesh, '''HUM_M_CLT_Headwear_Circlet_Silver_A''', we created to the MySweetMod/Generated/Public/MySweetMod/'''Assets''' Folder.  
We now open our meshes.lsx which we created in.


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.
First, we add a meshes.lsx.
   <version major="4" minor="0" revision="4" build="602" />
   <version major="4" minor="0" revision="4" build="602" />
   <region id="VisualBank">
   <region id="VisualBank">
Line 23: Line 50:
  <attribute id="ID" type="FixedString" value="00000000000000000000000000001" /> '''(This UUID links up to the Roottemplate)'''
  <attribute id="ID" type="FixedString" value="00000000000000000000000000001" /> '''(This UUID links up to the Roottemplate)'''
  <attribute id="MaterialType" type="uint8" value="0" />
  <attribute id="MaterialType" type="uint8" value="0" />
  <attribute id="Name" type="LSString" value="HUM_M_CLT_MySweetCirclet" /> '''Usually doesn't matter but try to make it unique.'''
  <attribute id="Name" type="LSString" value="HUM_M_CLT_MySweetCirclet" /> '''Referenced nowhere else but try to make it unique so you don't potentially ess up another item's toes.'''
  <attribute id="NeedsSkeletonRemap" type="bool" value="False" />
  <attribute id="NeedsSkeletonRemap" type="bool" value="False" />
  <attribute id="RemapperSlotId" type="FixedString" value="" />
  <attribute id="RemapperSlotId" type="FixedString" value="" />
Line 77: Line 104:
  </save>                           
  </save>                           


An item will begin in the root template lsx. Here is an example for it:
Now, we move on to our mesh.
 
 
Now for the game recognise the item, we add it to the root template lsx:


  <?xml version="1.0" encoding="utf-8"?>
  <?xml version="1.0" encoding="utf-8"?>
Line 90: Line 120:
  <attribute id="Description" type="TranslatedString" handle="HANDLE2" version="1" /> '''Generate a handle for this in your .loca file.'''
  <attribute id="Description" type="TranslatedString" handle="HANDLE2" version="1" /> '''Generate a handle for this in your .loca file.'''
  <attribute id="DisplayName" type="TranslatedString" handle="HANDLE1" version="1" /> '''Generate a handle for this in your .loca file.'''
  <attribute id="DisplayName" type="TranslatedString" handle="HANDLE1" version="1" /> '''Generate a handle for this in your .loca file.'''
  <attribute id="EquipSound" type="FixedString" value="ea27b98e-5fc0-4b0d-8602-e4a421dd481e" /></code> '''Not necessary but you may wish to specify one or it will use whatever default sound is in the parent template.'''
  <attribute id="EquipSound" type="FixedString" value="ea27b98e-5fc0-4b0d-8602-e4a421dd481e" /> '''Not necessary but you may wish to specify one or it will use whatever default sound is in the parent template.'''
  <attribute id="Icon" type="FixedString" value="Item_Cloth_Headwear_Circlet_Silver_A" /> '''Sets it up to use a base game icon- custom icons  require addition lsx and texture work'''</code>
  <attribute id="Icon" type="FixedString" value="Item_Cloth_Headwear_Circlet_Silver_A" /> '''Sets it up to use a base game icon- custom icons  require addition lsx and texture work'''
  <attribute id="LevelName" type="FixedString" value="" /></code>
  <attribute id="LevelName" type="FixedString" value="" />
  <attribute id="MapKey" type="FixedString" value="0000000000000000000000000002" /> '''This links up to the armor.txt to form the armor.'''</code>
  <attribute id="MapKey" type="FixedString" value="0000000000000000000000000002" /> '''This links up to the armor.txt to form the armor.'''
  <attribute id="Name" type="LSString" value="MY_COOL_NEW_CIRCLET" /> '''This links up to the armor.txt to form the armor.'''</code>
  <attribute id="Name" type="LSString" value="MY_COOL_NEW_CIRCLET" /> '''This links up to the armor.txt to form the armor.'''
  <attribute id="ParentTemplateId" type="FixedString" value="4d2e0931-3a01-4759-834b-8ae36749daab" /> '''This tells the game roughly what kind of item it is, such as in this case a helmet. You should use the right kind for your item to avoid inherited problems.'''</code>
  <attribute id="ParentTemplateId" type="FixedString" value="4d2e0931-3a01-4759-834b-8ae36749daab" /> '''This tells the game roughly what kind of item it is, such as in this case a helmet. You should use the right kind for your item to avoid inherited problems.'''
  <attribute id="PhysicsTemplate" type="FixedString" value="327039da-0827-811f-24e8-fc57e86c7ba2" /></code>
  <attribute id="PhysicsTemplate" type="FixedString" value="327039da-0827-811f-24e8-fc57e86c7ba2" />
  <attribute id="Type" type="FixedString" value="item" /></code>
  <attribute id="Type" type="FixedString" value="item" />
  <attribute id="UnequipSound" type="FixedString" value="f4c24367-83af-484e-bcc5-0438b8e64dec" /></code>  '''Not necessary but you may wish to specify one or it will use whatever default sound is in the parent template.'''
  <attribute id="UnequipSound" type="FixedString" value="f4c24367-83af-484e-bcc5-0438b8e64dec" />  '''Not necessary but you may wish to specify one or it will use whatever default sound is in the parent template.'''
  <attribute id="VisualTemplate" type="FixedString" value="2136f57a-a35f-c2fe-69fb-29afa9ebc8db" /> This is the mesh mapkey to the LOOT model (the one that appears when you examine it, or throw the item. For a weapon, the LOOT model and the item model are the same. </code>
  <attribute id="VisualTemplate" type="FixedString" value="2136f57a-a35f-c2fe-69fb-29afa9ebc8db" /> This is the mesh mapkey to the LOOT model (the one that appears when you examine it, or throw the item. For a weapon, the LOOT model and the item model are the same.  
  <attribute id="_OriginalFileVersion_" type="int64" value="144115207403209032" /></code>
  <attribute id="_OriginalFileVersion_" type="int64" value="144115207403209032" />
  <children></code>
  <children>
  <node id="Equipment"></code>
  <node id="Equipment">
  <children></code>
  <children>
  <node id="AfroLongHair" /></code>
  <node id="AfroLongHair" />
  <node id="AfroShortHair" /></code>
  <node id="AfroShortHair" />
  <node id="CurlyLongHair" /></code>
  <node id="CurlyLongHair" />
  <node id="CurlyShortHair" /></code>
  <node id="CurlyShortHair" />
  <node id="DreadLongHair" /></code>
  <node id="DreadLongHair" />
  <node id="DreadShortHair" /></code>
  <node id="DreadShortHair" />
  <node id="LongHair" /></code>
  <node id="LongHair" />
  <node id="ParentRace"> '''These set the parent races for githyanki, Dragonborn and Tiefling.  Unless this line is specified, they  will use Human Body or Strong Human Body. (Which may be fine for some races such as Tieflings.)'''</code>
  <node id="ParentRace"> '''The parentrace nodes set the item to use race-specific meshes for githyanki, Dragonborn and Tiefling.  Unless this line is added and  specified, they  will use Human Body or Strong Human Body. (Which may be fine for some races such as Tieflings.)'''
  <children></code>
  <children>
  <node id="Object"></code>
  <node id="Object">
  <attribute id="MapKey" type="guid" value="6503c830-9200-409a-bd26-895738587a4a" /></code>
  <attribute id="MapKey" type="guid" value="6503c830-9200-409a-bd26-895738587a4a" /> Tiefling Male
  <attribute id="MapValue" type="guid" value="00000000-0000-0000-0000-000000000000" /></code>
  <attribute id="MapValue" type="guid" value="00000000-0000-0000-0000-000000000000" /> This zeroes it out.
  </node></code>
  </node>
  '''(Removed for length as these all follow the same format)'''</code>
  '''(Removed for length as these all follow the same format)'''
  </children></code>
  </children>
  </node></code>
  </node>
  <node id="ShortHair" /></code>
  <node id="ShortHair" />
  <node id="Slot"></code>
  <node id="Slot">
  <attribute id="Object" type="FixedString" value="Headwear" /></code>
  <attribute id="Object" type="FixedString" value="Headwear" />
  </node></code>
  </node>
  <node id="Slot"></code>
  <node id="Slot">
  <attribute id="Object" type="FixedString" value="Hair" /></code>
  <attribute id="Object" type="FixedString" value="Hair" />
  </node></code>
  </node>
  <node id="VisualSet"></code>
  <node id="VisualSet">
  <attribute id="BodySetVisual" type="FixedString" value="" /></code>
  <attribute id="BodySetVisual" type="FixedString" value="" />
  <attribute id="ShowEquipmentVisuals" type="bool" value="False" /></code>
  <attribute id="ShowEquipmentVisuals" type="bool" value="False" />
  <children></code>
  <children>
  <node id="MaterialOverrides"> Sets colours for this one specific</code>
  <node id="MaterialOverrides"> Sets colours for this one specific
  <attribute id="MaterialResource" type="FixedString" value="" /></code>
  <attribute id="MaterialResource" type="FixedString" value="" />
  <children></code>
  <children>
  <node id="MaterialPresets" /></code>
  <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.)'''</code>
  '''(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.)'''
   
   
  <node id="Vector3Parameters"></code>
  <node id="Vector3Parameters">
  <attribute id="Color" type="bool" value="False" /></code>
  <attribute id="Color" type="bool" value="False" />
  <attribute id="Custom" type="bool" value="True" /></code>
  <attribute id="Custom" type="bool" value="True" />
  <attribute id="Enabled" type="bool" value="False" /></code>
  <attribute id="Enabled" type="bool" value="False" />
  <attribute id="Parameter" type="FixedString" value="Metal_Primary" /></code>
  <attribute id="Parameter" type="FixedString" value="Metal_Primary" />
  <attribute id="Value" type="fvec3" value="0.7667436 0.7667436 0.7667436" /> The colour code in Hex form, you can use [https://www.nexusmods.com/baldursgate3/mods/502 BG3 Minitool] to convert a value.</code>
  <attribute id="Value" type="fvec3" value="0.7667436 0.7667436 0.7667436" /> The colour code in Hex form, you can use [https://www.nexusmods.com/baldursgate3/mods/502 BG3 Minitool] to convert a value.
  </node></code>
  </node>
  </children></code>
  </children>
  </node></code>
  </node>
  <node id="RealMaterialOverrides" /></code>
  <node id="RealMaterialOverrides" />
  </children></code>
  </children>
  </node></code>
  </node>
  <node id="Visuals"></code>
  <node id="Visuals">
  <children></code>
  <children>
   
   
  <node id="Object"></code>
  <node id="Object">
  <attribute id="MapKey" type="guid" value="71180b76-5752-4a97-b71f-911a69197f58" /> Human Male Race IUUD example. [https://bg3.wiki/wiki/Modding:Race_UUID Others Here]</code>
  <attribute id="MapKey" type="guid" value="71180b76-5752-4a97-b71f-911a69197f58" /> Human Male Race IUUD example. [https://bg3.wiki/wiki/Modding:Race_UUID Others Here]
  <children></code>
  <children>
  <node id="MapValue"></code>
  <node id="MapValue">
  <attribute id="Object" type="FixedString" value="00000000000000000000000000001" /> Your Mesh for Human Male</code>
  <attribute id="Object" type="FixedString" value="00000000000000000000000000001" /> Your Mesh for Human Male
  </node></code>
  </node>
  </children></code>
  </children>
  </node></code>
  </node>
  (Removed for length - all the other mapkeys/mapvalues of every race this item is available for)</code>
  (Removed for length - all the other mapkeys/mapvalues of every race this item is available for)
  </children></code>
  </children>
  </node></code>
  </node>
  <node id="WavyLongHair" /></code>
  <node id="WavyLongHair" />
  <node id="WavyShortHair" /></code>
  <node id="WavyShortHair" />
  </children></code>
  </children>
  </node></code>
  </node>
  </children></code>
  </children>
  </node></code>
  </node>
   </node>
   </node>
  '''(END OF ITEM)'''
  '''(END OF ITEM)'''
Line 196: Line 226:
  data "Boosts" "UnlockSpell(Target_MAG_HealingWord);UnlockSpell(Shout_MAG_HealingWord_Mass)" '''This forces it to give us these spells. Note that the character needs spell slots in able to use them! If you want it for everyone you may be better off setting it up as a custom passive'''.
  data "Boosts" "UnlockSpell(Target_MAG_HealingWord);UnlockSpell(Shout_MAG_HealingWord_Mass)" '''This forces it to give us these spells. Note that the character needs spell slots in able to use them! If you want it for everyone you may be better off setting it up as a custom passive'''.
  data "PassivesOnEquip" "MAG_Radiant_Radiating_Helmet_Passive;CUSTOMPASSIVEIMADE" '''(The ; seperates passives.)'''
  data "PassivesOnEquip" "MAG_Radiant_Radiating_Helmet_Passive;CUSTOMPASSIVEIMADE" '''(The ; seperates passives.)'''
  data "Unique" "1"  
  data "Unique" "1" '''(These may cause you a headache if you put it multiple places, as they won't spawn for people who overlooked the first one. So I don't recommend using these!)'''
  data "MinAmount" "1"
  data "MinAmount" "1"
  data "MaxAmount" "1" '''(These may cause you a headache if you put it multiple places, as they won't spawn for people who overlooked the first one. So I don't recommend using these!)'''
  data "MaxAmount" "1"  


If adding a custom passive, your '''Passive.txt''' will look like this.
If adding a custom passive, your '''Passive.txt''' will look like this.
Line 223: Line 252:


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 this, 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.


{| 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