Tricks and Tips

Parent Previous Next



Now that you've completed the Beginner Tutorial successfully, it's time to let you in on some tricks and tips.



Building for the first time step walked you through how to trigger your first SDX build. At first, we didn't enable the Katana mod, so nothing happened, right?


Actually, the SDX Launcher did do something to the Assembly-CSharp.dll even without using any SDX mods, and that was instrumenting it with some handy SDX hooks. The initial hooks that SDX does every time it builds, regardless of mods enabled, is to allow loading the unity3d bundles for adding new blocks and items to the game.


Adding new Resources


With these hooks, it's now possible to just copy the KatanaSample's Resource file, michonnekatana.unity3d, into the "Working\Mods\SDX\Resources\" folder, and reference it in your XML files, adding a new item as you would with traditional XML edits. The property Meshfile is then changed to point to #michonnekatana?katana.  


File: Data\Config\items.xml

       <item id="1466" name="katanamichonne">

               <!-- Extend it from the machete, but add the custom mesh -->

               <property name="Extends" value="machete" />

               <property name="Meshfile" value="#michonnekatana?katana" />

       </item>

                               

When the game starts, the SDX hooks are activated, and as the game parses the XML files, it'll see the special model reference, and look under the Resources folder for a matching model.


#michonnekatana is translated to michonnekatana.unity3d

?katana is translated to look for the katana game object inside of michonnekatana.unity3d.


You can continue to do that, dropping the unity3d bundles into the Resources folder, and making references to the models, without using the SDX Launcher again.


Using Non-Vanilla Files as a Base


For our examples, we have been using the vanilla XML files as a base. This makes a good, consistent starting point to get you comfortable with SDX without getting too overwhelmed.


But that's not the only way you can enjoy SDX mods, nor does it mean you have to piece together a mod yourself. If you have an existing XML mod that you want to use, such as Clockwork Project, or Valmar Overhaul, you can use those mods as a base file.


All you need to do is install the mod, as per the modders instructions, into your Working folder. Verifying the Mod works as-is, and run it through the SDX Launcher. From there, you can copy and paste unity3d files into the Resources folder, and update the XML files to point to the new model.



The Mods/KatanaSample/Config/ Folder


In our examples, we included a Config/Katana.xml


<configs>

       <!--  This tells SDX to add to the Items.xml -->

       <config name="items">        

               <!-- This tells SDX to add the following Items to the bottom of the Items list -->

               <append xpath="/items">        


                       <!-- New item will be Katana -->

                       <item id="" name="katanamichonne">

                               <!-- Extend it from the machete, but add the custom mesh -->

                               <property name="Extends" value="machete"/>

                               <property name="Meshfile" value="#michonnekatana?katana" />

                       </item>

               </append>

       </config>

</configs>


It's actually optional in SDX to need a Config/ folder. Once you add in your SDX hooks, you can edit the XML files as you normally would. Be sure to edit your mod.xml file and comment out the Config line:


       <config_mods>

               <!--import file="Config\Katana.xml" /-->

   </config_mods>


So why we do we start with a Config folder if we don't need it?


The reason to use a Config folder for a SDX mod is ease of maintenance and distribution.


If you code all your XML into the Config folder, using the recommended format, then your XML snippets will be merged into the vanilla files, or into whatever modded files you are using. When a new Alpha release comes out, you'll just need to re-run the SDX Launcher, and merge your changes. With some minor tweaks, which are necessary for each of the Alpha releases, your mod will be ready.



If you are creating a complete SDX overhaul, then you could probably skip the Config folder in your SDX Mod. However, if you are building individual mods to be used by others, then it's best to use the Config folder for your mod.



Created with the Personal Edition of HelpNDoc: Full-featured Documentation generator