Markers and blips

  • A marker is something drawn in the world, such as a decal or shape on the ground. It can also tell you when players walk in or out.
  • A blip is an icon on the compass and map.

The server stores both and tells each player's game when to show, change or hide them.

const { Marker, Blip } = kcds.world;
const { Vector3 } = kcds.math;
const { Events, Chat } = kcds.core;

const shopSpot = new Vector3(100, 200, 10);

const ring = Marker.place('materials/decals/ring', shopSpot, {
  shape: 'cylinder',
  size: 3,
  color: 0x00ff00ff,
  trigger: true,
});

Blip.create({ position: shopSpot, type: 'Shop', label: 'Shop' });

Events.on('markerEnter', (marker, player) => {
  if (marker.id === ring.id) {
    Chat.sendToAll(`${player.nickname} walked in`);
  }
});

Marker

Marker.place(material, position, options?, dimension?). The material name has 1 to 256 characters.

OptionAccepted valuesDefault
shape'decal', 'cylinder', 'sphere', 'chevron', 'cube', 'plane''decal'
rotationa unit quaternion or angles
size0.25 to 64 (values outside are limited to this range)2
height0.25 to 642
spin-720 to 7200
bob0 to 40
coloran integer 0xRRGGBBAA0
triggertrue fires markerEnter and markerExitfalse

Read only: id, exists, material, group, shape, dimension.

Read and write: size, height, spin, bob, color, trigger, position, rotation.

Methods: setDimension(dimension), destroy(), and showOnlyTo(target) with a player, a list of players, or null for everyone.

Static: Marker.all(dimension?), Marker.getById(id), Marker.removeAll(dimension?).

Events: markerPlace(marker), markerRemove(marker), markerEnter(marker, player), markerExit(marker, player).

The trigger area is an upright cylinder as wide as the marker. It runs from 1 m below the marker to its height, or to 2 m for a decal or plane. If the marker is removed or trigger is switched off, no exit event fires.

Blip

Blip.create(options)

OptionAccepted valuesDefault
positionrequired
typea name from Blip.types()'GeneralPoi'
markStatean integer0
labelup to 64 bytes of UTF-8; longer text is cut
compassshow on the compasstrue
mapshow on the maptrue
dimensionthe blip's dimension
playera player or list of players who see iteveryone

Read only: id, exists.

Read and write: type, markState, label, compass, map, position.

Also: dimension, setDimension(dimension), showOnlyTo(target), destroy().

Static: Blip.all(dimension?), Blip.getById(id), Blip.removeAll(dimension?), and Blip.types(), which lists icon names such as Shop, Home, Pub, Camp and FastTravel.

A blip reaches all its players, however far away they are.

Reference: Marker, Blip.