Skip to main content
← Back

Cobblemon NPC Animation Interaction

A reusable Cobblemon NPC behaviour that plays an animation, a sound, outputs a chat line, and spawns a particle effect when a player right-clicks the NPC. Each of the four channels has its own configurable delay, so a server owner can choreograph the timing without writing any Molang. Drop the behaviour onto any NPC, set the variables in the in-game editor, and the NPC starts emoting.

What it does

Right-clicking the NPC fires up to four things, all optional:

  • Animation: plays a named animation on the NPC's poser. The default is wave. Server owners can set any animation defined on the NPC's model.
  • Sound: plays a server-side sound at the NPC's position with configurable volume and pitch.
  • Chat line: sends a styled message to the player. The default is " waves at you." in gray. Supports {{npc}} and {{player}} placeholders.
  • Particles: spawns a bedrock particle effect at a configurable XYZ position (default: NPC's position).

Each channel can be disabled by leaving its config blank. The four delays are independent, so each can be fine-tuned separately to activate at the exact right moment. All of this is done by tweaking numbers in the NPC editor. (/npcedit)

Use cases

  • Greeters: a wave animation and a friendly chat line for shopkeepers, NPCs at warps, or quest givers between dialogue states.
  • Reaction emotes: a Pokémon NPC that bounces and emits sparkle particles when patted, with a quick chat caption.
  • One-shot cutscene beats: chain delays to time a flourish.
  • Interactive set dressing: an NPC at a cluttered desk that plays a rummage animation and a paper-shuffle sound.

Cooldowns and the "seen" perm

Two pieces of state make the behaviour shippable on a busy server:

  • Per-player cooldown: configurable in seconds, default 3. Stored as a millisecond timestamp on a per-NPC variable on the player, so spamming one NPC does not lock out another.
  • Seen permission: the first time a player triggers the interaction, an LP perm is granted. The default is npc.anim_interact.seen.{{npc}}_interact_anim. Other behaviours can branch on it. As such, a dialogue NPC can say "oh, we've met" once the player has seen the wave animation.

Techy Stuff

  • Built on Cobblemon's behaviour and Molang systems. Declared in JSON, dispatched through set_script_interaction.
  • Each of the four channels runs through q.npc.run_molang_after(...). The Molang string is parsed once and scheduled, so the script does not block waiting for a sleep.
  • Chat messages route through a shared cobblemon:print_and_tell helper. Placeholder substitution uses cobblemon:replace_placeholders and cobblemon:replace_placeholders_var, the same helpers the dialogue and trade behaviours use. As such, {{npc}} and {{player}} work identically everywhere.
  • The cooldown reads from q.player.get_npc_variable(q.npc, 'anim_interact_cooldown'), so the timer is scoped to this NPC for this player.

Built for the Callisto and Cobblewilds Cobblemon servers, but available for commission.