Text, HUD & pause menu
Platform notes for drawing text and for the parts of the HUD that SYNC MP controls. The full reference is in mp.game.graphics.drawText.
mp.game.graphics.drawText
mp.game.graphics.drawText(text, position, { font, color, scale, outline, centre });
position | Draws |
|---|---|
[x, y] | 2D text on screen. x, y are 0.0 .. 1.0 |
[x, y, z] or mp.Vector3 | 3D text over that world point, centred by default |
Call it every frame from the render event:
mp.events.add('render', () => {
// on screen
mp.game.graphics.drawText('Hello', [0.5, 0.05], { font: 4, scale: [0.5, 0.5], color: [255, 255, 255, 255], outline: true, centre: true });
// over every streamed-in player
mp.players.forEachInStreamRange((p) => {
if (p === mp.players.local) return;
const pos = p.position;
mp.game.graphics.drawText(`${p.name} (${p.remoteId})`, [pos.x, pos.y, pos.z + 1.0], {
font: 4, scale: [0.3, 0.3], color: [255, 255, 255, 220], outline: true,
});
});
});
scaleis[sx, sy]; a single number is also accepted.coloris[r, g, b, a].- 3D text is centred on its point. Pass
centre: falseto align it left. - Text longer than 99 characters is drawn whole. Use
\nfor line breaks. - 3D text behind the camera is not drawn.
Pause menu header
The pause menu (Esc) shows Map and Settings. Its header shows the text you set with the label
PM_PAUSE_HDR, as on RAGE:MP:
mp.game.gxt.set('PM_PAUSE_HDR', 'SAPPHIRE ROLEPLAY');
mp.game.gxt.reset() restores the default. The header follows the label live, so you can change it
at any time.
HUD
- Health and armour are shown under the minimap. The yellow special-ability bar from story mode is hidden.
mp.game.ui.displayRadar(false)/mp.game.ui.displayHud(false)behave as on RAGE:MP.