Editing Modding:Coding An Item
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 3: | Line 3: | ||
|description=This page is a hub for everything related to Modding Baldur's Gate 3. Check out the following guides to learn how to mod BG3. | |description=This page is a hub for everything related to Modding Baldur's Gate 3. Check out the following guides to learn how to mod BG3. | ||
|image=Modding_resources.webp | |image=Modding_resources.webp | ||
}}{{ | }}{{NavModding}} | ||
<div column-width: "60em2;> | |||
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. | 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. | ||
This guide does not cover adding custom icons. | |||
==File Overview == | |||
==File Overview== | |||
Your mod is '''MySweetMod''' | Your mod is '''MySweetMod''' | ||
*MySweetMod | *MySweetMod | ||
**Generated | **Generated | ||
**Public | |||
****MySweetMod | ****MySweetMod | ||
*****Assets <- models and textures | *****Assets <- models and textures | ||
Line 48: | Line 32: | ||
******Assets | ******Assets | ||
*******Characters | *******Characters | ||
******** [PAK]_Armor <-- material and mesh LSX for custom outfits and weapons | ********[PAK]_Armor <-- material and mesh LSX for custom outfits and weapons | ||
****GUI | **** GUI | ||
*****RootTemplates <--- Your Roottemplate lsx goes here. MySweetMod.Lsx | *****RootTemplates <--- Your Roottemplate lsx goes here. MySweetMod.Lsx | ||
*****Stats | *****Stats | ||
*******Generated <--- TreasureTable.txt - This tells the game where the item will spawn. | *******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. | ********Data <--- Armor.txt, Object.txt, Passive.txt, Weapon.txt and other TXT files. These contain stats. | ||
Line 132: | Line 116: | ||
</save> | </save> | ||
==Materials and Texture .lsx== | ==Materials and Texture .lsx == | ||
Now, we move on to our materialbank. | Now, we move on to our materialbank. | ||
Line 191: | Line 175: | ||
Now the material we have found, SourceFile "Public/Shared/Assets/Materials/Characters/CHAR_BASE.lsf" is a fairly standard shader without transparency or glowing. Materials that can be Transparent have 'Alpha' in the title. For example, "Public/Shared/Assets/Materials/Characters/CHAR_BASE_AlphaTest_2S.lsf" or "CHAR_BASE_AlphaTest_2S_Dither" will enable alpha and make the mesh visible from both sides (turns off backface culling). Underwear needs to have a Dither shader or it won't hide correctly. | Now the material we have found, SourceFile "Public/Shared/Assets/Materials/Characters/CHAR_BASE.lsf" is a fairly standard shader without transparency or glowing. Materials that can be Transparent have 'Alpha' in the title. For example, "Public/Shared/Assets/Materials/Characters/CHAR_BASE_AlphaTest_2S.lsf" or "CHAR_BASE_AlphaTest_2S_Dither" will enable alpha and make the mesh visible from both sides (turns off backface culling). Underwear needs to have a Dither shader or it won't hide correctly. | ||
Materials with _VT at the end are | 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 211: | Line 193: | ||
<attribute id="Depth" type="int32" value="1" /> | <attribute id="Depth" type="int32" value="1" /> | ||
<attribute id="Localized" type="bool" value="False" /> | <attribute id="Localized" type="bool" value="False" /> | ||
<attribute id="SRGB" type="bool" value="False" /> Ensure this is set to False | <attribute id="SRGB" type="bool" value="False" /> Ensure this is set to False- can't remember why but it does need to be. | ||
<attribute id="Streaming" type="bool" value="True" /> | <attribute id="Streaming" type="bool" value="True" /> | ||
<attribute id="Template" type="FixedString" value="" /> | <attribute id="Template" type="FixedString" value="" /> | ||
Line 225: | Line 207: | ||
If there is anything wrong with the material, your item may simply refuse to show up, so it is worth double-checking everything here. | If there is anything wrong with the material, your item may simply refuse to show up, so it is worth double-checking everything here. | ||
==RootTemplate == | ==RootTemplate== | ||
Now for the game to recognise the circlet as an item, we add it to the root template lsx: | Now for the game to recognise the circlet as an item, we add it to the root template lsx: | ||
Line 246: | Line 228: | ||
<attribute id="MapKey" type="FixedString" value="0000000000000000000000000002" /> '''This links up to the armor.txt to form the armor.''' | <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.''' | <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 helm. You should use the right kind for your item to avoid inherited problems. For example a shield will not know it is a shield without this ParentTemplate | <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 helm. You should use the right kind for your item to avoid inherited problems. For example a shield will not know it is a shield without this ParentTemplate.''' | ||
<attribute id="PhysicsTemplate" type="FixedString" value="327039da-0827-811f-24e8-fc57e86c7ba2" /> '''I believe similar to the above, this needs to be roughly the same type as the armour you are adding.''' | <attribute id="PhysicsTemplate" type="FixedString" value="327039da-0827-811f-24e8-fc57e86c7ba2" /> '''I believe similar to the above, this needs to be roughly the same type as the armour you are adding.''' | ||
<attribute id="Type" type="FixedString" value="item" /> | <attribute id="Type" type="FixedString" value="item" /> | ||
Line 253: | Line 235: | ||
<attribute id="_OriginalFileVersion_" type="int64" value="144115207403209032" /> | <attribute id="_OriginalFileVersion_" type="int64" value="144115207403209032" /> | ||
<children> | <children> | ||
<node id="Equipment"> | <node id="Equipment"> | ||
<children> | <children> | ||
Line 294: | Line 244: | ||
<node id="DreadShortHair" /> | <node id="DreadShortHair" /> | ||
<node id="LongHair" /> | <node id="LongHair" /> | ||
<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> | <children> | ||
<node id="Object"> | <node id="Object"> | ||
<attribute id="MapKey" type="guid" value="6503c830-9200-409a-bd26-895738587a4a" /> Tiefling Male | <attribute id="MapKey" type="guid" value="6503c830-9200-409a-bd26-895738587a4a" /> Tiefling Male | ||
<attribute id="MapValue" type="guid" value="00000000-0000-0000-0000-000000000000" /> | <attribute id="MapValue" type="guid" value="00000000-0000-0000-0000-000000000000" /> | ||
</node> | </node> | ||
Line 382: | Line 330: | ||
Armor.txt | Armor.txt | ||
new entry "MY_COOL_NEW_CIRCLET" | new entry "MY_COOL_NEW_CIRCLET" | ||
type "Armor" | type "Armor" | ||
data "ValueOverride" "4000" '''(It's a very cool circlet and we want it to cost a lot!)''' | data "ValueOverride" "4000" '''(It's a very cool circlet and we want it to cost a lot!)''' | ||
data "Weight" "0.01" | data "Weight" "0.01" | ||
using "_Head_Magic_Circlet" '''(This tells it what slot to equip in. Ideally this should match up with the ParentTemplate you set up.)''' | using "_Head_Magic_Circlet" '''(This tells it what slot to equip in. Ideally this should match up with the ParentTemplate you set up.)''' | ||
data "RootTemplate" "0000000000000000000000000002" '''Matches up to the rootemplate Mapkey.''' | data "RootTemplate" "0000000000000000000000000002" '''Matches up to the rootemplate Mapkey.''' | ||
data "Rarity" "Rare" '''This effects what colour it is in your inventory, rarer things get a different colour outline.''' | data "Rarity" "Rare" '''This effects what colour it is in your inventory, rarer things get a different colour outline. Note that if you set things as common they may spawn in generic containers, which is not optimal for clean uninstalling.''' | ||
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.)''' | ||
Line 393: | Line 341: | ||
data "MinAmount" "1" | data "MinAmount" "1" | ||
data "MaxAmount" "1" | data "MaxAmount" "1" | ||
If adding a custom passive, your '''Passive.txt''' will look like this. You don't need a passive.txt at all | If adding a custom passive, your '''Passive.txt''' will look like this. You don't need a passive.txt at all, this is just for the ambitious. | ||
The example passive code is borrowed from Isobel's armor. | The example passive code is borrowed from Isobel's armor. | ||
Line 433: | Line 380: | ||
CanMerge 1 | CanMerge 1 | ||
new subtable "1,1" | new subtable "1,1" | ||
object category "I_MY_COOL_NEW_CIRCLET",1,0,0,0,0,0,0,0 | object category "I_MY_COOL_NEW_CIRCLET",1,0,0,0,0,0,0,0 '''(Do not forget the ''I_'' prefix!)''' | ||
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 | 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. | ||
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. |