Nevermind,
Solved this using a right click to open the GUI of NPC instead of a left click.
import { RpgGui, RpgSprite, RpgSpriteHooks } from '@rpgjs/client'
const sprite: RpgSpriteHooks = {
onInit(sprite: RpgSprite) {
if (sprite.data.name === 'SimpleBlacksmith') {
sprite.eventMode = 'static';
sprite.on('rightclick', () => {
RpgGui.display('item-upgrade-gui');
});
}
},
}
export default sprite;
but I also had to disable context menu of right-click:
import { RpgSceneMapHooks, RpgSceneMap } from '@rpgjs/client'
const sceneMap: RpgSceneMapHooks = {
onAfterLoading(scene: RpgSceneMap) {
document.addEventListener('contextmenu', event => {
event.preventDefault();
});
}
}
export default sceneMap;