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"
}
}
]
}| Field | Default | Description |
|---|---|---|
id | none | Rule id. Required for surge and used in cooldown bookkeeping |
eventId | none | Only spawn while this seasonal event is active; empty = always |
entityCode | required | Entity code. A trailing * picks among all matching variants, weighted by the entity type's spawnWeight attribute (default 1, 0 excludes the variant) |
fromHour, toHour | 19, 6 | In-game hours; from > to wraps over midnight |
maxPerPlayer | 3 | Cap of living creatures from this rule near one player |
intervalSeconds | 20 | Real seconds between spawn rolls |
chance | 0.5 | Chance per roll and player |
minDistance, maxDistance | 10, 32 | Spawn distance from the player in blocks |
minHeight, maxHeight | 1, 3 | Blocks above the ground |
lifetimeHours | 0 | Creature dissolves after this many in-game hours (needs the nightonly behavior on the entity) |
afkSeconds | 0 | No spawns near a player who stood still (3 blocks) for this long. 0 = off |
capRadius | 0 | Radius counted toward maxPerPlayer; 0 = maxDistance + 16 |
alsoCount | [] | Extra entity codes (wildcards ok) that count toward the cap |
playerCooldownSeconds | 0 | After a spawn near a player, no new one for that player for this long |
globalCooldownSeconds | 0 | After a spawn anywhere, no new one on the whole server for this long |
maxPerNight | 0 | Server-wide limit per night; 0 = unlimited |
regionMargin | 32 | No 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.