Modding:Coding An Item: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
<div class="nomobile" column-width: "60em2;> | <div class="nomobile" column-width: "60em2;> | ||
Your root template lsx may look something like this: | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<save> | |||
<version major="4" minor="0" revision="6" build="5" /> | |||
<region id="Templates"> | |||
<node id="Templates"> | |||
<children> | |||
(START OF ITEM) | |||
<code> | |||
<node id="GameObjects"> Circlet </code> | |||
<attribute id="Description" type="TranslatedString" handle="HANDLE2" version="1" /> Generate a handle for this in your .loca file.</code> | |||
<attribute id="DisplayName" type="TranslatedString" handle="HANDLE1" version="1" /> Generate a handle for this in your .loca file.</code> | |||
<attribute id="EquipSound" type="FixedString" value="ea27b98e-5fc0-4b0d-8602-e4a421dd481e" /></code> | |||
<attribute id="Icon" type="FixedString" value="Item_Cloth_Headwear_Circlet_Silver_A" /> Sets up icon</code> | |||
<attribute id="LevelName" type="FixedString" value="" /></code> | |||
<attribute id="MapKey" type="FixedString" value="0000000000000000000000000002" /> 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.</code> | |||
<attribute id="ParentTemplateId" type="FixedString" value="4d2e0931-3a01-4759-834b-8ae36749daab" /> This tells the game roughly what kind of item- you should use the right kind for your item to avoid problems.</code> | |||
<attribute id="PhysicsTemplate" type="FixedString" value="327039da-0827-811f-24e8-fc57e86c7ba2" /></code> | |||
<attribute id="Type" type="FixedString" value="item" /></code> | |||
<attribute id="UnequipSound" type="FixedString" value="f4c24367-83af-484e-bcc5-0438b8e64dec" /></code> | |||
<attribute id="VisualTemplate" type="FixedString" value="2136f57a-a35f-c2fe-69fb-29afa9ebc8db" /> This sets the LOOT model (the one that appears when you examine it, or throw the item.</code> | |||
<attribute id="_OriginalFileVersion_" type="int64" value="144115207403209032" /></code> | |||
<children></code> | |||
<node id="Equipment"></code> | |||
<children></code> | |||
<node id="AfroLongHair" /></code> | |||
<node id="AfroShortHair" /></code> | |||
<node id="CurlyLongHair" /></code> | |||
<node id="CurlyShortHair" /></code> | |||
<node id="DreadLongHair" /></code> | |||
<node id="DreadShortHair" /></code> | |||
<node id="LongHair" /></code> | |||
<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> | |||
<children></code> | |||
<node id="Object"></code> | |||
<attribute id="MapKey" type="guid" value="6503c830-9200-409a-bd26-895738587a4a" /></code> | |||
<attribute id="MapValue" type="guid" value="00000000-0000-0000-0000-000000000000" /></code> | |||
</node></code> | |||
(Removed for length as these all follow the same format)</code> | |||
</children></code> | |||
</node></code> | |||
<node id="ShortHair" /></code> | |||
<node id="Slot"></code> | |||
<attribute id="Object" type="FixedString" value="Headwear" /></code> | |||
</node></code> | |||
<node id="Slot"></code> | |||
<attribute id="Object" type="FixedString" value="Hair" /></code> | |||
</node></code> | |||
<node id="VisualSet"></code> | |||
<attribute id="BodySetVisual" type="FixedString" value="" /></code> | |||
<attribute id="ShowEquipmentVisuals" type="bool" value="False" /></code> | |||
<children></code> | |||
<node id="MaterialOverrides"> Sets colours for this one specific</code> | |||
<attribute id="MaterialResource" type="FixedString" value="" /></code> | |||
<children></code> | |||
<node id="MaterialPresets" /></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.)</code> | |||
<node id="Vector3Parameters"></code> | |||
<attribute id="Color" type="bool" value="False" /></code> | |||
<attribute id="Custom" type="bool" value="True" /></code> | |||
<attribute id="Enabled" type="bool" value="False" /></code> | |||
<attribute id="Parameter" type="FixedString" value="Metal_Primary" /></code> | |||
<attribute id="Value" type="fvec3" value="0.7667436 0.7667436 0.7667436" /> You can get a line of </code> | |||
</node></code> | |||
</children></code> | |||
</node></code> | |||
<node id="RealMaterialOverrides" /></code> | |||
</children></code> | |||
</node></code> | |||
<node id="Visuals"></code> | |||
<children></code> | |||
<node id="Object"></code> | |||
<attribute id="MapKey" type="guid" value="71180b76-5752-4a97-b71f-911a69197f58" /> Human Male Race IUUD example</code> | |||
<children></code> | |||
<node id="MapValue"></code> | |||
<attribute id="Object" type="FixedString" value="00000000000000000000000000001" /> Your Mesh for Human Male</code> | |||
</node></code> | |||
</children></code> | |||
</node></code> | |||
(Removed for length - all the other mapkeys/mapvalues of every race this item is available for)</code> | |||
</children></code> | |||
</node></code> | |||
<node id="WavyLongHair" /></code> | |||
<node id="WavyShortHair" /></code> | |||
</children></code> | |||
</node></code> | |||
</children></code> | |||
</node></code> | |||
</node> | |||
(END OF ITEM) | |||
</children> | |||
</node> | |||
</region> | |||
</save> | |||
Meanwhile in your '''Armor.txt''', they link up like this: | Meanwhile in your '''Armor.txt''', they link up like this: |
Revision as of 11:10, 19 December 2023
Your root template lsx may look something like this:
<?xml version="1.0" encoding="utf-8"?> <save>
<version major="4" minor="0" revision="6" build="5" /> <region id="Templates"> <node id="Templates"> <children>
(START OF ITEM)
<node id="GameObjects"> Circlet
<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="EquipSound" type="FixedString" value="ea27b98e-5fc0-4b0d-8602-e4a421dd481e" />
<attribute id="Icon" type="FixedString" value="Item_Cloth_Headwear_Circlet_Silver_A" /> Sets up icon
<attribute id="LevelName" type="FixedString" value="" />
<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="ParentTemplateId" type="FixedString" value="4d2e0931-3a01-4759-834b-8ae36749daab" /> This tells the game roughly what kind of item- you should use the right kind for your item to avoid problems.
<attribute id="PhysicsTemplate" type="FixedString" value="327039da-0827-811f-24e8-fc57e86c7ba2" />
<attribute id="Type" type="FixedString" value="item" />
<attribute id="UnequipSound" type="FixedString" value="f4c24367-83af-484e-bcc5-0438b8e64dec" />
<attribute id="VisualTemplate" type="FixedString" value="2136f57a-a35f-c2fe-69fb-29afa9ebc8db" /> This sets the LOOT model (the one that appears when you examine it, or throw the item.
<attribute id="_OriginalFileVersion_" type="int64" value="144115207403209032" /> <children> <node id="Equipment"> <children> <node id="AfroLongHair" /> <node id="AfroShortHair" /> <node id="CurlyLongHair" /> <node id="CurlyShortHair" /> <node id="DreadLongHair" /> <node id="DreadShortHair" /> <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.)
<children> <node id="Object"> <attribute id="MapKey" type="guid" value="6503c830-9200-409a-bd26-895738587a4a" /> <attribute id="MapValue" type="guid" value="00000000-0000-0000-0000-000000000000" /> </node>
(Removed for length as these all follow the same format)
</children> </node> <node id="ShortHair" /> <node id="Slot"> <attribute id="Object" type="FixedString" value="Headwear" /> </node> <node id="Slot"> <attribute id="Object" type="FixedString" value="Hair" /> </node> <node id="VisualSet"> <attribute id="BodySetVisual" type="FixedString" value="" /> <attribute id="ShowEquipmentVisuals" type="bool" value="False" /> <children>
<node id="MaterialOverrides"> Sets colours for this one specific <attribute id="MaterialResource" type="FixedString" value="" /> <children> <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.)
<node id="Vector3Parameters">
<attribute id="Color" type="bool" value="False" /> <attribute id="Custom" type="bool" value="True" /> <attribute id="Enabled" type="bool" value="False" /> <attribute id="Parameter" type="FixedString" value="Metal_Primary" /> <attribute id="Value" type="fvec3" value="0.7667436 0.7667436 0.7667436" /> You can get a line of
</node>
</children>
</node>
<node id="RealMaterialOverrides" />
</children>
</node>
<node id="Visuals">
<children>
<node id="Object"> <attribute id="MapKey" type="guid" value="71180b76-5752-4a97-b71f-911a69197f58" /> Human Male Race IUUD example <children> <node id="MapValue"> <attribute id="Object" type="FixedString" value="00000000000000000000000000001" /> Your Mesh for Human Male </node> </children> </node> (Removed for length - all the other mapkeys/mapvalues of every race this item is available for)
</children> </node> <node id="WavyLongHair" /> <node id="WavyShortHair" />
</children> </node> </children> </node> </node>
(END OF ITEM)
</children> </node> </region>
</save>
Meanwhile in your Armor.txt, they link up like this:
Armor.txt new entry "MY_COOL_NEW_CIRCLET" type "Armor" using "_Head_Magic_Circlet" data "RootTemplate" "0000000000000000000000000002" data "Rarity" "Rare" data "PassivesOnEquip" "MAG_Radiant_Radiating_Helmet_Passive;CUSTOMPASSIVEIMADE" (The ; seperates passives.)
If adding a custom passive, your Passive.txt will look like this.
The example passive code is borrowed from Isobel's armor.
new entry "CUSTOMPASSIVEIMADE" type "PassiveData" data "DisplayName" "PASSIVEHANDLE1;1" (Generate a handle for this in your .loca file.) data "Description" "PASSIVEHANDLE2;1" Generate a handle for this in your .loca file.) data "Icon" "CUSTOMPASSIVEICON" (we can set this up in the same way an item icon is set up) data "DescriptionParams" "DealDamage(1d4, Radiant)" data "StatsFunctorContext" "OnAttacked" data "StatsFunctors" "IF(context.HasContextFlag(StatsFunctorContext.OnAttacked) and HasStatus('MAGE_ARMOR') and IsLastConditionRollSuccess(ConditionRollType.ConditionSavingThrow) and not Self() and IsSavingThrow()):DealDamage(SWAP, 1d4, Radiant,Magical)"
Now, you need to put it in the treasuretable. Your treasuretable should look like this:
new treasuretable "TUT_Chest_Potions" CanMerge 1 new subtable "1,1" 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.
Modding guides | |
Modding resources |