mvbg

VM_ACTOR_EMOTE

VM_ACTOR_EMOTE is a GBVM instruction used to display a temporary “emote” image above or near a specified actor, typically to convey an emotion, reaction, or thought.

Purpose: Emotes are a common way in games to provide non-verbal communication from characters, adding personality and context to interactions. VM_ACTOR_EMOTE is essential for:

When VM_ACTOR_EMOTE is called, the specified AVATAR image is displayed for a short duration above the ACTOR. The GBVM typically manages the display and eventual removal of this emote automatically.

Syntax:

VM_ACTOR_EMOTE ACTOR, AVATAR_BANK, AVATAR

Usage Example: NPC Showing Surprise When Spoken To

Imagine a villager NPC who shows a “surprise” emote the first time the player talks to them.

; In your script, when the player interacts with a villager:

; Assume VILLAGER_ACTOR_ID is the actor ID for the villager
VILLAGER_ACTOR_ID:
  .R_INT8 20 ; Example Actor ID

; Assume VAR_VILLAGER_SPOKEN_TO is a flag for this villager
VAR_VILLAGER_SPOKEN_TO:
  .R_INT8 0 ; 0 = not spoken to, 1 = spoken to

; Emote image definitions (these would be defined in your assets)
EMOTE_SURPRISE_BANK:
  .R_INT8 BANK(EMOTE_SURPRISE_SPRITE)
EMOTE_SURPRISE_SPRITE:
  ; ... actual sprite data for a surprise emote (e.g., '!') ...

; Check if player has spoken to this villager before
VM_IF_CONST .EQ, VAR_VILLAGER_SPOKEN_TO, 0, FIRST_TIME_TALK, 0
  ; If already spoken to, just display normal dialogue
  VM_LOAD_TEXT TEXT_VILLAGER_NORMAL_GREETING
  VM_DISPLAY_TEXT
  VM_JUMP END_TALK

FIRST_TIME_TALK:
  ; Set flag to indicate player has now spoken to them
  VM_SET_CONST VAR_VILLAGER_SPOKEN_TO, 1

  ; Display a surprise emote above the villager
  VM_ACTOR_EMOTE VILLAGER_ACTOR_ID, EMOTE_SURPRISE_BANK, EMOTE_SURPRISE_SPRITE

  VM_IDLE 60 ; Wait for the emote to display for a second

  VM_LOAD_TEXT TEXT_VILLAGER_SURPRISED_GREETING
  VM_DISPLAY_TEXT

END_TALK:
  ; ... continue script ...

TEXT_VILLAGER_NORMAL_GREETING:
  .TEXT "Hello again!"
  .TEXT_END

TEXT_VILLAGER_SURPRISED_GREETING:
  .TEXT "Oh! You startled me!"
  .TEXT_END

In this example, VM_ACTOR_EMOTE VILLAGER_ACTOR_ID, EMOTE_SURPRISE_BANK, EMOTE_SURPRISE_SPRITE causes the EMOTE_SURPRISE_SPRITE to appear above the villager. This provides a visual cue to the player that the NPC is reacting to their presence, making the interaction more engaging.

Analogy to other programming languages/game engines: This is similar to instantiating a temporary particle effect or a UI element above a character in a modern game engine. For example, in Unity, you might spawn a small sprite prefab above a character’s head. In older 2D games, this was often achieved by temporarily changing a character’s sprite or adding an overlay sprite at a specific position relative to the character.