Systems

Night Spawns

Ambient creatures that appear around players at certain in-game hours, capped per player. Used for event wisps and wandering riders. Rules are plain data - no code needed.


Configuration

Add config/nightspawns/*.json to any pack:

{
  "rules": [
    {
      "id": "halloween-wisps",
      "eventId": "halloween",
      "entityCode": "alegacyevents:wisp-*",
      "fromHour": 19, "toHour": 6,
      "maxPerPlayer": 4,
      "intervalSeconds": 6,
      "chance": 0.11,
      "minDistance": 16, "maxDistance": 48,
      "minHeight": 0.5, "maxHeight": 2.5,
      "afkSeconds": 180,
      "capRadius": 128,
      "surge": {
        "chancePerNight": 0.08,
        "multiplier": 1.3,
        "startLangKey": "alegacyevents:wisp-surge-start",
        "endLangKey": "alegacyevents:wisp-surge-end",
        "discordLangKey": "alegacyevents:wisp-surge-discord"
      }
    }
  ]
}
FieldDefaultDescription
idnoneRule id. Required for surge and used in cooldown bookkeeping
eventIdnoneOnly spawn while this seasonal event is active; empty = always
entityCoderequiredEntity code. A trailing * picks among all matching variants, weighted by the entity type's spawnWeight attribute (default 1, 0 excludes the variant)
fromHour, toHour19, 6In-game hours; from > to wraps over midnight
maxPerPlayer3Cap of living creatures from this rule near one player
intervalSeconds20Real seconds between spawn rolls
chance0.5Chance per roll and player
minDistance, maxDistance10, 32Spawn distance from the player in blocks
minHeight, maxHeight1, 3Blocks above the ground
lifetimeHours0Creature dissolves after this many in-game hours (needs the nightonly behavior on the entity)
afkSeconds0No spawns near a player who stood still (3 blocks) for this long. 0 = off
capRadius0Radius counted toward maxPerPlayer; 0 = maxDistance + 16
alsoCount[]Extra entity codes (wildcards ok) that count toward the cap
playerCooldownSeconds0After a spawn near a player, no new one for that player for this long
globalCooldownSeconds0After a spawn anywhere, no new one on the whole server for this long
maxPerNight0Server-wide limit per night; 0 = unlimited
regionMargin32No spawns inside an encounter control block's region or this many blocks around it

Chances and caps are per player, so a busy server gets proportionally more - use globalCooldownSeconds and maxPerNight to keep rare creatures rare.

Surge nights

surge makes a rare night stronger. When a night starts it rolls chancePerNight (default 0.1); on success the spawn chance and the per-player cap are multiplied by multiplier (default 1.3). The start and end are announced in chat through the lang keys; discordLangKey (taken in Russian) also posts to Discord.

Real examples: quests/albase/assets/alegacyevents/config/nightspawns/halloween-wisps.json (a night rule plus a daytime rule with lifetimeHours) and halloween-rider.json.

Press ESC to close