Camps
constCamps:object
Defined in: server/api.d.ts:3572
Enemy camps under World.setEncounterPolicy(“server”): each is a native trigger and its roster, spawned as hostile NPCs when a player comes near. The catalog covers the base game; camps a client’s game places beyond it (modded levels) are learned from that client’s report. Events: campActivated(campId), campCleared(campId).
Type Declaration
Section titled “Type Declaration”respawnSeconds
Section titled “respawnSeconds”
readonlyrespawnSeconds:number
Seconds after a camp’s last death before its dead return, once nobody is near it. Default 900.
get(
id): {active:boolean;activeFrom:number;activeTo:number;cullRadius:number;dead:number;id:string;npcs:NPC[];rolled:number;source:"catalog"|"harvested";triggerRadius:number;x:number;y:number;z:number; } |null
One camp, or null for an unknown id.
Parameters
Section titled “Parameters”string
A camp id from getAll, “
Returns
Section titled “Returns”{ active: boolean; activeFrom: number; activeTo: number; cullRadius: number; dead: number; id: string; npcs: NPC[]; rolled: number; source: "catalog" | "harvested"; triggerRadius: number; x: number; y: number; z: number; } | null
getAll()
Section titled “getAll()”getAll():
object[]
Every camp: the catalog’s, then any a client reported that the catalog lacks (source “harvested”: a modded level’s). activeFrom..activeTo are the server-clock hours it may start in (0..24 all day; 21..5 a night camp). rolled is how many enemies its current roster has (0 until a player first comes near), dead how many of them have died since it last revived, and npcs its live NPCs.
Returns
Section titled “Returns”object[]
getRewardPolicy()
Section titled “getRewardPolicy()”getRewardPolicy(
campId?): {experience:number;gameReward:boolean;loot:object[] |null;lootDelivery:"drop"|"inventory";lootMode:"each"|"shared";radius:number;recipients:"killer"|"damagers"|"nearby"; } |null
What a camp’s enemies pay, with the server default and built-in values filled in. Null for an unknown camp id.
Parameters
Section titled “Parameters”campId?
Section titled “campId?”string
One camp; the camps-wide policy when left out.
Returns
Section titled “Returns”{ experience: number; gameReward: boolean; loot: object[] | null; lootDelivery: "drop" | "inventory"; lootMode: "each" | "shared"; radius: number; recipients: "killer" | "damagers" | "nearby"; } | null
revive()
Section titled “revive()”revive(
id):boolean
Despawns the camp and brings its dead back; the next player to come near spawns a fresh roster.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
False for an unknown id.
setRespawnSeconds()
Section titled “setRespawnSeconds()”setRespawnSeconds(
seconds):boolean
Sets how long a camp’s dead stay dead.
Parameters
Section titled “Parameters”seconds
Section titled “seconds”number
0 to a week.
Returns
Section titled “Returns”boolean
False for a value out of range.
setRewardPolicy()
Section titled “setRewardPolicy()”setRewardPolicy(
policy,campId?):boolean
Sets what the camps’ enemies pay when they die (see NPC.setRewardPolicy), on their live NPCs and on every one they spawn. False for an unknown camp id; throws a TypeError or RangeError for a malformed policy.
Parameters
Section titled “Parameters”policy
Section titled “policy”{ experience?: number; gameReward?: boolean; loot?: object[] | null; lootDelivery?: "drop" | "inventory"; lootMode?: "each" | "shared"; radius?: number; recipients?: "killer" | "damagers" | "nearby"; } | null
Fields a camp’s own policy leaves out come from the camps-wide one, then NPC.setDefaultRewardPolicy; null clears this level.
campId?
Section titled “campId?”string
One camp; every camp when left out.
Returns
Section titled “Returns”boolean