Class Npc
Wrapper class for handling NPC players.
Inherited Members
Namespace: Exiled.API.Features
Assembly: Exiled.API.dll
Syntax
public class Npc : Player, IEntity, IWorldSpace, IPosition, IRotation
Constructors
| Improve this Doc View SourceNpc(ReferenceHub)
Declaration
public Npc(ReferenceHub referenceHub)
Parameters
Type | Name | Description |
---|---|---|
ReferenceHub | referenceHub |
Npc(GameObject)
Declaration
public Npc(GameObject gameObject)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.GameObject | gameObject |
Properties
| Improve this Doc View SourceList
Gets a list of Npcs.
Declaration
public static List<Npc> List { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<Npc> |
Methods
| Improve this Doc View SourceDestroy()
Destroys the NPC.
Declaration
public void Destroy()
Get(CommandSender)
Retrieves the NPC associated with the specified CommandSender.
Declaration
public static Npc Get(CommandSender sender)
Parameters
Type | Name | Description |
---|---|---|
CommandSender | sender | The CommandSender to retrieve the NPC for. |
Returns
Type | Description |
---|---|
Npc | The NPC associated with the CommandSender, or |
Get(ICommandSender)
Retrieves the NPC associated with the specified ICommandSender.
Declaration
public static Npc Get(ICommandSender sender)
Parameters
Type | Name | Description |
---|---|---|
CommandSystem.ICommandSender | sender | The ICommandSender to retrieve the NPC for. |
Returns
Type | Description |
---|---|
Npc | The NPC associated with the ICommandSender, or |
Get(Footprint)
Retrieves the NPC associated with the specified Footprint.
Declaration
public static Npc Get(Footprint footprint)
Parameters
Type | Name | Description |
---|---|---|
Footprinting.Footprint | footprint | The Footprint to retrieve the NPC for. |
Returns
Type | Description |
---|---|
Npc | The NPC associated with the Footprint, or |
Get(NetworkConnection)
Retrieves the NPC associated with the specified NetworkConnection.
Declaration
public static Npc Get(NetworkConnection conn)
Parameters
Type | Name | Description |
---|---|---|
Mirror.NetworkConnection | conn | The NetworkConnection to retrieve the NPC for. |
Returns
Type | Description |
---|---|
Npc | The NPC associated with the NetworkConnection, or |
Get(ReferenceHub)
Retrieves the NPC associated with the specified ReferenceHub.
Declaration
public static Npc Get(ReferenceHub rHub)
Parameters
Type | Name | Description |
---|---|---|
ReferenceHub | rHub | The ReferenceHub to retrieve the NPC for. |
Returns
Type | Description |
---|---|
Npc | The NPC associated with the ReferenceHub, or |
Get(Int32)
Retrieves the NPC associated with the specified ID.
Declaration
public static Npc Get(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The ID to retrieve the NPC for. |
Returns
Type | Description |
---|---|
Npc | The NPC associated with the ID, or |
Get(String)
Retrieves the NPC associated with the specified user ID.
Declaration
public static Npc Get(string userId)
Parameters
Type | Name | Description |
---|---|---|
System.String | userId | The user ID to retrieve the NPC for. |
Returns
Type | Description |
---|---|
Npc | The NPC associated with the user ID, or |
Get(UInt32)
Retrieves the NPC associated with the specified net ID.
Declaration
public static Npc Get(uint netId)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | netId | The net ID to retrieve the NPC for. |
Returns
Type | Description |
---|---|
Npc | The NPC associated with the net ID, or |
Get(Collider)
Retrieves the NPC associated with the specified Collider.
Declaration
public static Npc Get(Collider collider)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Collider | collider | The Collider to retrieve the NPC for. |
Returns
Type | Description |
---|---|
Npc | The NPC associated with the Collider, or |
Get(GameObject)
Retrieves the NPC associated with the specified GameObject.
Declaration
public static Npc Get(GameObject gameObject)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.GameObject | gameObject | The GameObject to retrieve the NPC for. |
Returns
Type | Description |
---|---|
Npc | The NPC associated with the GameObject, or |
Spawn(String, RoleTypeId, Int32, String, Nullable<Vector3>)
Spawns an NPC based on the given parameters.
Declaration
public static Npc Spawn(string name, RoleTypeId role, int id = 0, string userId = "", Vector3? position = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the NPC. |
PlayerRoles.RoleTypeId | role | The RoleTypeId of the NPC. |
System.Int32 | id | The player ID of the NPC. |
System.String | userId | The userID of the NPC. |
System.Nullable<UnityEngine.Vector3> | position | The position to spawn the NPC. |
Returns
Type | Description |
---|---|
Npc | The Npc spawned. |