Custom Modifiers

From Soldat2 Wiki
Revision as of 11:46, 10 June 2023 by Nerf cardboard (talk | contribs) (add to Category:Modding)
Jump to navigation Jump to search

Modifiers are snippets of configuration that partially override the default game config, which makes for some nice match variation in servers.

Check the default configuration file Modifiers/_default.json (contains anything not related to game modes: eg weapons, player movement, ...) as a reference of available parameters. Follow the exact same structure as in this file - ie. all parameters are within the "Objects" key.

To customize game mode configuration, there is the special namespace "Objects.Rules". This also allows to load custom scripts, by naming it.

Some more hints:

  • You only need to specify the parameter you want to change. Due to some bugs, this does not work for some objects (eg MeleeWeapon).
  • Its possible to add or remove elements from lists, instead of replacing the whole default list. To do this, prefix the parameter name with + or - (eg "-PrimaryWeapons": ["Minigun"]). This improves composability of multiple Modifiers. On non-lists, a --prefix removes the whole element.
  • Changes are applied whenever the file is saved. This works for most parameters, but not all.
  • The JSON parser understands JSON2, so trailing commas and comments are allowed.

Example

Example:

{
  "Objects": {
    "Rules": {
      // customizing game rules parameters
      "StandardGameplay": {
        "DamageModifier": 2
      },
      "-RandomDrops": {}
      // loading a custom script
      "MyCustomScript": {
        "SomeScriptParameter": 1.0
      }
    },
    "Gostek": {
      "PhysicsObject": {
        "Mass": 0.65, // faster movement by making players lighter
      }
    }
  },
  "Meta": {
    "Description": "this text shows up as a tooltip in the lobby",
    "Author": "",
    "Version": "1.0",
    "Game": "Soldat2",
    "GameVersion": "0.8.67"
  }
}