XML Injector

Created On
N/A
Updated On
N/A
Total Views
5779
Total Downloads
332
Maintainer
scumbumbo

The XML Injector for The Sims 4 is a mod library to allow mods that would normally require a script for simple changes to instead use a custom snippet. The library provides the scripting, and the modder can release their mod without having to concern themselves with writing, compiling and maintaining a script. Currently the XML Injector snippet handles adding interactions to game objects in a variety
of ways with a simple XML definition.

Version 2 Released

  • Contains new features which may be required by some mods.
  • Don't forget to remove version 1 when you upgrade!

Player Info

If you just play the game then you only need to download and install this library mod if another mod you download tells you that you must have this installed. On it's own this mod does nothing, it works in the background to make other modders able to code their mods more easily.

If another mod does inform you that this mod is required for it to work, then you should proceed to download and install this. You do not need to download the Modder's Documentation file, this contains the technical information for modders to reference.

Modder Info

The primary purpose of this mod is to eliminate the need for modder's to write, compile and maintain their own scripts for the simple tasks of modifying the game's XML tunings (e.g. _super_affordances list). It currently supports:

  • Add interactions to game objects. The game objects can be selected by instance number, an existing interaction (e.g. sink_washHands), or a partial name search.
  • Add interactions to the Sim's object.
  • Add interactions to the relationship panel.
  • Add interactions to the phone panel.
  • Add interactions to AffordanceLists ("Friendly" mixers, etc.)
  • Version 2
    • Test that XML Injector v2 or higher is installed.
    • Test that that the installed version of XML Injector supports your mod.
    • Add loot actions to LootActions and RandomWeightLoot tunings.
    • Add buffs to traits.
    • Add name and object relationship components to game object tunings.
    • Add states and state_triggers to object tunings.

By offloading these tasks to a shared script, controlled by a simple XML snippet that you include in your mod package, this eliminates the need for you to include a script. In addition, if future game updates alter the method that these XML tunings must be modified in a script, this library will be promptly updated with any necessary fixes - and no changes will be required to your mod.

The majority of the documentation for the library is contained in the Modder's Documentation. This contains the following resources:

  • A PDF document with the technical details on creating an XmlInjector snippet tuning, including several examples.
  • The raw XML and STBL files contained in the test package.
  • A tuning description file for the XmlInjector snippet. If you use the TS4 Tuning Description Browser, you can place this file into your snippets folder where you have stored the EA TDesc files to view it within the browser.
  • The script source files for reference. At least one other script modder should acquaint themselves with the code (feel free to ask me any questions on how something works!) in the event that I am unable to update it myself for whatever unplanned and involuntary reason.

Once you've setup your mod to use an XmlInjector snippet, you should inform players who download your mod to obtain and install a copy of the XML Injector from this download page. Do not distribute the library with your own mod. This ensures that players have only one copy of the script installed, and that they can easily determine if they have the latest version installed and know where they can get the most recent updates if required.

The XML Injector can be extended to update other tunings. If you have any ideas, feel free to ask if they can be implemented. Ideal candidates for new features would be common tuning changes that would otherwise create the possibility of mod conflicts without a script. More complex or rare changes would not receive any priority for implementation as the mods that make those complex changes are likely to require a script for other reasons. The main goal is to allow other mods to be implemented and distributed without requiring their own scripts.

If you have any questions or run into technical difficulties, please post here on the mod library's discusion thread. In addition, some alternative methods of contacting me are given in the PDF documentation.

Thank you to all the modders who have tested, and given me ideas and encouragement for implementing this library snippet!

Thank you to Triplis for joining the development team and creating new features for future XML Injector versions!