Skip to content
ASArcaneMP Scripting APIScripting reference
GuideMaintainer authored

Map markers

Put markers, search circles and gold routes on the map and minimap, read the player's own waypoint, choose which players get a blip and in what colour, hide or retitle the game's own map icons, and read what the minimap shows.

The game’s map and minimap draw a blip for every other player, and client scripts can add markers and circles of their own and draw the game’s gold route to one. All of this lives on each client, in the Blips global, so the server decides what each player should see and tells their client. The game’s own icons, such as shops and Floo Flames, are in the MapIcons global: see The game’s own icons.

Blips.setMarker(key, x, y, z, icon, label) puts a marker at a world position, in centimetres. Blips.setCircle(key, x, y, z, radius) draws a search circle instead, with its radius in metres, 50 by default.

The key is a name of your choosing. Setting the same key again moves or restyles that blip rather than adding another, so a moving target is a repeated setMarker. Blips.remove(key) takes one away. Leave icon out for the game’s default marker icon.

client/main.js
Blips.setMarker("hunt:clue", 15200, -3400, 250, undefined, "Next clue");
Blips.setCircle("hunt:area", 15200, -3400, 250, 40);
Blips.pulseCircle("hunt:area", true);

Blips.pulseCircle(key, true) makes a circle pulse, and false fades it in instead. Blips.inArea(key, x, y, z) tells you whether a point is inside a circle.

Blips belong to the client, not to the resource that set them. Every resource shares one set of keys, so prefix yours with something your own, and Blips.clear() removes every script blip, whichever resource set it. Stopping your resource leaves its blips on the map; only disconnecting clears them.

Keep the list on the server and send it to clients, including players who join after a blip went up:

server/main.js
const markers = new Map(); // key -> { key, x, y, z, label }
function showMarker(marker) {
markers.set(marker.key, marker);
Events.emitAllClients("marker:set", marker);
}
function hideMarker(key) {
markers.delete(key);
Events.emitAllClients("marker:remove", { key });
}
// A client asks for the whole set once its script is running.
Events.onClient("marker:ready", (player) => {
player.emit("marker:all", JSON.stringify([...markers.values()]));
});
client/main.js
Events.on("marker:set", (m) => Blips.setMarker(m.key, m.x, m.y, m.z, undefined, m.label));
Events.on("marker:remove", (m) => Blips.remove(m.key));
Events.on("marker:all", (list) => {
for (const m of list) Blips.setMarker(m.key, m.x, m.y, m.z, undefined, m.label);
});
Events.emitServer("marker:ready");

A marker the server sends to everyone is on everyone’s map. When a position should stay secret, such as the circle hunters are searching, send it only to the players meant to see it.

Blips.setRoute(target, label) draws the game’s gold mission route on the map and minimap, to a marker or circle by its key, or to another player’s blip by their network id while they have one. It returns false when there is no such blip or the game did not take the route. Each client follows one route, so setting another replaces it:

client/main.js
Blips.setRoute("hunt:area", "Search for the clue");
  • A route to a circle stops at its ring, so the player is led there and then searches inside it.
  • It survives its blip being set again, so moving the circle to the next clue keeps the route on it.
  • While the player has placed a waypoint of their own, their purple line takes over the minimap. The big map keeps drawing your route beside it.

Blips.clearRoute() ends the route, and removing its blip ends it too. Blips.route() returns the key or network id the route leads to, or null.

Players drop a waypoint of their own on the game’s map. It is theirs, not a blip, so the calls above never change it, but Blips.waypoint() reads it, or returns null when they have none:

Field Meaning
x, y, z Where it is, in world centimetres
target The beacon name of the map icon it was dropped on, such as "FT_HW_GreatHall"; null on open ground

Dropped on an icon, the waypoint sits exactly on it. On open ground, z is the height of the map’s model under the cursor: close to the terrain, but not on it. Find the ground under it before you stand someone there.

The waypointChanged event fires with the new waypoint and the previous one each time the player places, moves or removes theirs, and a removal reports null. It only reports changes, so read Blips.waypoint() as your script starts for one placed before. This party shares each member’s waypoint with the others:

client/main.js
Events.on("waypointChanged", (waypoint) => Events.emitServer("party:waypoint", waypoint));
Events.on("party:waypoint", (payload) => {
const key = `party:waypoint:${payload.playerId}`;
const at = payload.waypoint;
if (at) Blips.setMarker(key, at.x, at.y, at.z, undefined, payload.name);
else Blips.remove(key);
});
server/main.js
Events.onClient("party:waypoint", (player, waypoint) => {
const valid = waypoint && [waypoint.x, waypoint.y, waypoint.z].every(Number.isFinite);
const at = valid ? { x: waypoint.x, y: waypoint.y, z: waypoint.z } : null;
const payload = JSON.stringify({ playerId: player.id, name: player.nickname, waypoint: at });
for (const member of partyMembers(player)) {
if (member !== player) member.emit("party:waypoint", payload);
}
});

Every other player has a blip by default. To show only some of them, turn that off and name the players who keep theirs:

client/main.js
Events.on("party:members", (payload) => {
Blips.trackAllPlayers(false);
Blips.setTrackedPlayers(payload.memberIds);
});

Blips.trackPlayer(networkId, enabled) adds or removes one player, and works before that player has spawned. Blips.trackedPlayers() lists the network ids that have a blip.

Blips.setPlayerColor(networkId, r, g, b, a) colours one player’s blip, with components from 0 to 1. Leave out the colour to go back to their house colour. Blips.setAllPlayerColors(r, g, b, a) colours every blip, and Blips.setBlipScale(scale) sizes them.

Hiding a blip hides an icon, not a player: their position still reaches the client. To keep players apart, use virtual worlds, and to hide one from everyone, player.setVisible(false) on the server, which takes their blip with them.

The game puts icons of its own on the map and the minimap: shops, Floo Flames, collectibles, quests and more. A client script can hide them, by kind or one by one, and put its own title on their tooltips, with the MapIcons global. Blips your scripts set are never touched.

MapIcons.list(category) returns every icon the game has registered, or only one category’s:

Field Meaning
id The game’s name for it, such as "HM_JPippensPotions"
category Its kind, such as "fasttravel" for Floo Flames or "locationshogsmeade" for places in Hogsmeade
state What the game makes of it now, such as "undiscovered", "discovered" or "fast_travel_unlocked"
title Its tooltip title in the game’s language, such as "J. Pippin's Potions"; null when that text is not loaded
titleKey The game’s localization key for the title
label The title setLabel put over it, or null
position Where it is, in world centimetres
hidden Whether the current rules keep it off the map and the minimap

The list grows as the world streams in around the player. It includes icons the player has not discovered yet, which the game only draws once they find them. MapIcons.categories() names every category, and list throws for a category that is not one of them.

MapIcons.setHidden(target, hidden) hides icons on the map and the minimap. target is a category, or else one icon’s id, in any case. Icons the game registers later follow the rule as they arrive. false lifts your rule; for one id, it also shows that icon through a category that is hidden.

  • A rule for an id beats a rule for its category, so a script can hide a category and keep one of its icons.
  • Between resources, hidden wins: an icon one resource hides by its id stays hidden, whatever another does.
  • A name that is not a category counts as an id, so a misspelt category hides nothing.
client/main.js
// This server runs its own travel network, so the game's Floo Flames leave the map.
MapIcons.setHidden("fasttravel", true);

Hiding an icon only hides it. To stop players fast travelling, use player.setFastTravelEnabled(false) on the server.

MapIcons.setLabel(id, title, description) puts your title on an icon’s tooltip on the map. Leave out description, or pass null, to keep the game’s description, or pass "" to show none. Only the tooltip changes: the name stays the game’s everywhere else, such as in quests. When the game will not fast travel to a Floo Flame, its tooltip says so, label or not.

client/main.js
MapIcons.setLabel("HM_JPippensPotions", "The Bubbling Cauldron", "Potions brewed to order.");

The last label set for an id wins, whichever resource set it. MapIcons.clearLabel(id) gives the icon its own tooltip back, and returns false when it had no label.

Unlike blips, hide rules and labels belong to the resource that set them, and go when it stops. MapIcons.reset() drops every rule and label your resource set. Everything goes when the player disconnects. Like blips, they live on each client: a client script that sets them as it starts sets them for every player who runs it, and the server tells a client when one player should see something else.

Minimap.state() reports what the game’s own minimap is drawing:

Field Meaning
map The region on screen: "overland", "hogwarts", "hogsmeade", "dungeon", "tutorial", "sanctuary", "tents", or "none" behind a load screen
floor In Hogwarts, the floor the game picked for the player, counting from 0; null elsewhere
texture In Hogwarts, the floor’s map tile; null elsewhere

The minimapChanged event fires with the new state and the previous one whenever any of them changes. Minimap.floorAt(z) returns the Hogwarts floor the game would pick at a height, for placing other things on floors the way the game places the player.

client/main.js
Events.on("minimapChanged", (state, previous) => {
if (state.map === "hogwarts" && previous.map !== "hogwarts") Game.notify("Welcome back to the castle.");
});