Endstar LUA API Documentation
Loading...
Searching...
No Matches
NpcManager Class Reference

This class is used to SpawnNpcs and access members of npc groups. More...

Public Member Functions

Context SpawnNpc (Context instigator, CellReference cellReference, NpcConfiguration config, Context fallbackContextForPosition)
 Attempts to spawn an npc near the given cell reference.
 
Context SpawnNpc (Context instigator, UnityEngine.Vector3 position, float yAxisRotation, NpcConfiguration config)
 Attempts to spawn an npc near the given position with the given rotation.
 
Context SpawnNpc (Context instigator, UnityEngine.Vector3 position, NpcConfiguration config, Context rotationContext)
 Attempts to spawn an npc near the given position with the same rotation as the rotationContext.
 
Context GetNpcInGroupByIndex (int group, int index)
 Returns the context of the npc in the group by its index.
 
int GetNumNpcsByGroup (int group)
 Returns the number of npcs in a given group.
 
NpcConfiguration CreateNewConfiguration ()
 Creates a default configuration for an npc.
 
NpcConfiguration CopyNpcConfiguration (Context context)
 Creates a copy of the configuration of the npc associated with this context.
 

Detailed Description

This class is used to SpawnNpcs and access members of npc groups.

Member Function Documentation

◆ CopyNpcConfiguration()

NpcConfiguration CopyNpcConfiguration ( Context context)

Creates a copy of the configuration of the npc associated with this context.

Parameters
context
Returns
A new configuration with the same settings as the given context. It returns a default configuration if the context is not associated with an npc or the npc is not yet configured

◆ CreateNewConfiguration()

NpcConfiguration CreateNewConfiguration ( )

Creates a default configuration for an npc.

Returns
A default npc configuration.

◆ GetNpcInGroupByIndex()

Context GetNpcInGroupByIndex ( int group,
int index )

Returns the context of the npc in the group by its index.

Parameters
groupThe group to select an npc from.
indexThe index of the npc in the group.
Returns
Context of the selected npc.

◆ GetNumNpcsByGroup()

int GetNumNpcsByGroup ( int group)

Returns the number of npcs in a given group.

Parameters
groupThe group to analyze.
Returns
The number of npcs in the group.

◆ SpawnNpc() [1/3]

Context SpawnNpc ( Context instigator,
CellReference cellReference,
NpcConfiguration config,
Context fallbackContextForPosition )

Attempts to spawn an npc near the given cell reference.

Parameters
instigatorThe context triggering the spawn.
cellReferenceThe position to spawn the npc.
configThe configuration of the npc to be spawned.
fallbackContextForPositionThe context of the prop that will be used for the fallback position.

◆ SpawnNpc() [2/3]

Context SpawnNpc ( Context instigator,
UnityEngine.Vector3 position,
float yAxisRotation,
NpcConfiguration config )

Attempts to spawn an npc near the given position with the given rotation.

Parameters
instigatorThe context triggering the spawn.
positionThe position at which to attempt to spawn the npc.
yAxisRotationThe rotation to spawn the npc with.
configThe configuration of the npc to be spawned.
Returns

◆ SpawnNpc() [3/3]

Context SpawnNpc ( Context instigator,
UnityEngine.Vector3 position,
NpcConfiguration config,
Context rotationContext )

Attempts to spawn an npc near the given position with the same rotation as the rotationContext.

Parameters
instigatorThe context triggering the spawn.
positionThe position at which to attempt to spawn the npc.
configThe configuration of the npc to be spawned
rotationContextThe context of the world object to use as the rotation reference.
Returns