Skip to content
On this page

Display a notification

Prerequisites

You must have a menu installed on your project (or you must create it yourself) To install default menu:

npx rpgjs add @rpgjs/default-gui

Use Notification

You have two ways to display a notification:

Client Side

Use RpgGui:

ts
import { RpgGui, PrebuiltGui } from '@rpgjs/client'

RpgGui.display(PrebuiltGui.Notification, {
    message: 'You have unlocked the secret passage',
    time: 2000,
    icon: 'icon_id',
    sound: 'sound_id'
})

RpgGui API

Server Side

Use player.showNotification():

ts
player.showNotification('You have unlocked the secret passage', {
    time: 2000,
    icon: 'icon_id',
    sound: 'sound_id'
})

player.showNotification()

Custom Notification UI

Go to theme.scss file and add notification SCSS variables

Example:

scss
$notification-background-color: rgba(0, 0, 0, 0.7);
$notification-font-color: white;
$notification-font-family: 'lato';