Skip to content

Custom Invasions

Pychnight edited this page Feb 8, 2018 · 3 revisions

Invasions

Creating your own custom invasion is quite easy. Create a file in the npcs directory titled invasions.json. You should then copy and paste the following:

[
  {
    "Name": "slime",
    "ScriptPath": null,
    "NpcPointValues": {
      "-3": 1,
      "1": 2,
      "-8": 3,
      "-7": 4,
      "-9": 5,
      "example": 10,
      "50": 50
    },
    "CompletedMessage": "The slime invasion has ended!",
    "AtSpawnOnly": false,
    "ScaleByPlayers": false,
    "Waves": [
      {
        "NpcWeights": {
          "-3": 10,
          "example": 1,
        },
        "PointsRequired": 20,
        "MaxSpawns": 20,
        "SpawnRate": 10,
        "StartMessage": "Wave 1: Green Slimes",
        "Miniboss": "example"
      },
      {
        "NpcWeights": {
          "-3": 2,
          "1": 1
        },
        "PointsRequired": 50,
        "MaxSpawns": 20,
        "SpawnRate": 10,
        "StartMessage": "Wave 2: Green & Blue Slimes",
        "Miniboss": "example"
      },
      {
        "NpcWeights": {
          "-3": 2,
          "1": 2,
          "-8": 1
        },
        "PointsRequired": 100,
        "MaxSpawns": 20,
        "SpawnRate": 10,
        "StartMessage": "Wave 3: Green, Blue & Red Slimes",
        "Miniboss": "example"
      },
      {
        "NpcWeights": {
          "-3": 1,
          "1": 2,
          "-8": 2,
          "-7": 1
        },
        "PointsRequired": 150,
        "MaxSpawns": 20,
        "SpawnRate": 10,
        "StartMessage": "Wave 4: Green, Blue, Red & Purple Slimes",
        "Miniboss": "example"
      },
      {
        "NpcWeights": {
          "-3": 1,
          "1": 3,
          "-8": 3,
          "-7": 3,
          "-9": 2
        },
        "PointsRequired": 200,
        "MaxSpawns": 20,
        "SpawnRate": 10,
        "StartMessage": "Wave 5: Green, Blue, Red, Purple & Yellow Slimes",
        "Miniboss": "example"
      },
      {
        "NpcWeights": {
          "50": 1
        },
        "PointsRequired": 500,
        "MaxSpawns": 20,
        "SpawnRate": 10,
        "StartMessage": "Final Wave: King Slimes",
        "Miniboss": null
      }
    ]
  }
]

To add more invasions, all you have to do is add another JSON entry like that. We'll go over all the fields:

  • Name: The internal name of the invasion. This is what you use if you want to start the invasion with /cinvade, or if you want to start the invasion with code.
  • ScriptPath: An optional path to a Script file that provides extra functionality to the invasion. This is not necessary.
  • NpcPointValues: A dictionary that maps NPCs to point values. The keys are strings, and are either IDs, which means it is a normal NPC, or an internal name of a custom NPC. Point values indicate how long the invasion goes on.
  • CompletedMessage: A message that is shown when the invasion is completed.
  • AtSpawnOnly: true to have the invasion at spawn only (like the goblin invasion), otherwise false.
  • ScaleByPlayers: true to scale the number of points by the number of active players, otherwise false.
  • Waves: A list of wave definitions:
    • NpcWeights: A dictionary that maps NPCs to spawning weights. The keys are strings, and are either IDs, which means it is a normal NPC, or an internal name of a custom NPC. Normal spawning mechanics will be ignored.
    • PointsRequired: The number of points required to advance the wave.
    • MaxSpawns: The number of maximum spawns allowed for the wave. NOTE: Overrides any sort of maximum spawns outside of the invasion.
    • SpawnRate: The spawn rate for the wave. NOTE: Overrides any sort of spawn rate outside of the invasion.
    • StartMessage: A message to show when the wave starts.
    • Miniboss: The miniboss of the wave, optional. It is a string, and is either an ID, which means it is a normal NPC, or an internal name of a custom NPC. Once the wave is completed, the miniboss will be spawned exactly once, and if it despawns, then the miniboss will be re-spawned. When the miniboss is died, the waves will advance.

Clone this wiki locally