Skip to content

Npcs

Namespace Mc.Scripting · Kind class (sealed)

public sealed class Npcs

Creates NPCs for this plugin and listens to the clicks on them. Everything made here is removed when the plugin unloads.

Member Description
Create Creates an NPC that everybody sees.
Subscription OnInteract(Action<NpcInteraction> handler) Calls handler when a player clicks an NPC of this plugin’s server (any NPC: check NpcInteraction.Npc).
public Npc Create(World world, Vec3d position, string name, NpcSkin? skin = null, bool showInTab = false, float yaw = 0f, float pitch = 0f)

Creates an NPC that everybody sees.

Parameters

Name Type Description
world World The world.
position Vec3d Where it stands.
name string The profile name (1..16 letters, digits or underscores).
skin NpcSkin? = null The skin; null for the default one.
showInTab bool = false Whether it is in the tab list (unlisted by default).
yaw float = 0f The horizontal look, degrees.
pitch float = 0f The vertical look, degrees.

Returns Npc: The NPC.

Throws

  • System.ArgumentException: The name is not a valid profile name.
  • System.InvalidOperationException: The engine refused the NPC (the world, or the server’s visual limit).
public Subscription OnInteract(Action<NpcInteraction> handler)

Calls handler when a player clicks an NPC of this plugin’s server (any NPC: check NpcInteraction.Npc).

Parameters

Name Type Description
handler Action<NpcInteraction> The handler.

Returns Subscription: The subscription (removed when the plugin unloads).

Npc · NpcInteraction · NpcSkin · Subscription · Vec3d · World