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

Contains methods to modify the npc during gameplay. More...

Public Member Functions

void Kill (Context instigator)
 Kills the NPC by reducing its health to zero.
 
void SetCombatMode (Context instigator, int combatMode)
 Sets the combat mode for the NPC.
 
void SetDamageMode (Context instigator, int damageMode)
 Sets the damage mode for the NPC.
 
void SetPhysicsMode (Context instigator, int physicsMode)
 Sets the physics mode for the NPC.
 
void SetCanFidget (Context instigator, bool canFidget)
 Configures whether the NPC can fidget.
 
void SetDestinationTolerance (Context instigator, float newTolerance)
 Configures the distance to a destination where the npc will stop moving.
 
void SetDestination (Context instigator)
 Sets the npcs destination to the position of an instruction node. This method is obsolete. Use SetDestinationToCell instead.
 
void SetDestinationToCell (Context instigator, CellReference cellReference, Context fallbackContextForPosition)
 Set the npcs destination to the position of the selected cell. If no cell is selected it will set the destination to the position of the fallback context.
 
void SetDestinationToPosition (Context instigator, Vector3 position)
 Sets the npcs destination to the position in world space.
 
void SetDestinationToPosition (Context instigator, Vector3Int position)
 Sets the npcs destination to the position in world space.
 
void ClearDestination (Context instigator)
 Clears the NPC's destination.
 
Vector3 GetNpcPosition (Context instigator)
 Gets the current position of the NPC.
 
void SetNewWanderPosition (Context instigator, float distance)
 Sets a new wander position for the NPC within a specified distance of its current location.
 
void SetNewRovePosition (Context instigator, float roveDistance, float distancePerMove)
 Sets a new rove position for the NPC within a certain distance of an instruction node.
 
int GetNumberOfInteractables ()
 Gets the number of interactables associated with the NPC.
 
void SetActivity (Context _, ActivityInstanceReference instanceRef)
 Sets the activity the npc should go perform. The npc will path to the activity and start it once it gets there.
 
void SetActivity (Context _, ActivityInstanceReference instanceRef, bool teleport, bool kickOccupant)
 Sets the activity the npc should go perform. The npc will path to the activity and start it once it gets there.
 
void SetActivity (Context _, ActivityData activityData)
 Sets the activity the npc should go perform. The npc will path to the activity and start it once it gets there.
 
void SetActivity (Context _, ActivityData activityData, bool teleport, bool kickOccupant)
 Sets the activity the npc should go perform. The npc will path to the activity and start it once it gets there.
 
void ForceStopActivity (Context instigator)
 Stops the activity the npc is currently performing, ending its animation without completing it.
 
void SetUseActivities (Context instigator, bool useActivities)
 Sets if the npc can use activities.
 
void SetActivityDelay (Context instigator, float delay)
 Sets the delay between activities.
 
PointOfInterest GetTargetPointOfInterest ()
 Gets the interface for the NPC's target point of interest if it has one.
 
bool GetNextPointOfInterest (Context instigator)
 Updates the NPC's target point of interest to one that it hasn't recently visited.
 
void SetDestinationToTargetPointOfInterest (Context instigator)
 Sets the NPC's behavior destination to a point near its target point of interest.
 
void ClearBehaviorDestination (Context instigator)
 Clears the NPC's behavior destination.
 
void ClearTargetPointOfInterest (Context instigator)
 Clears the NPC's target point of interest.
 
CharacterCosmeticProfile GetCurrentCosmeticProfile ()
 Get currently active character cosmetic profile.
 
void SetCharacterCosmeticsOverride (Context instigator, CharacterCosmeticProfile value)
 Overrides the npc's current cosmetics.
 

Detailed Description

Contains methods to modify the npc during gameplay.

Member Function Documentation

◆ ClearBehaviorDestination()

void ClearBehaviorDestination ( Context instigator)

Clears the NPC's behavior destination.

Parameters
instigatorThe source context triggering this change

◆ ClearDestination()

void ClearDestination ( Context instigator)

Clears the NPC's destination.

Parameters
instigatorThe source context triggering this change

◆ ClearTargetPointOfInterest()

void ClearTargetPointOfInterest ( Context instigator)

Clears the NPC's target point of interest.

Parameters
instigatorThe source context triggering this change

◆ ForceStopActivity()

void ForceStopActivity ( Context instigator)

Stops the activity the npc is currently performing, ending its animation without completing it.

Parameters
instigatorThe source context triggering this change.

◆ GetCurrentCosmeticProfile()

CharacterCosmeticProfile GetCurrentCosmeticProfile ( )

Get currently active character cosmetic profile.

Returns
CharacterCosmeticProfile

◆ GetNextPointOfInterest()

bool GetNextPointOfInterest ( Context instigator)

Updates the NPC's target point of interest to one that it hasn't recently visited.

Parameters
instigatorThe source context triggering this change

◆ GetNpcPosition()

Vector3 GetNpcPosition ( Context instigator)

Gets the current position of the NPC.

Parameters
instigatorThe source context triggering this change
Returns
The current position of the NPC.

◆ GetNumberOfInteractables()

int GetNumberOfInteractables ( )

Gets the number of interactables associated with the NPC.

Returns
The number of interactables.

◆ GetTargetPointOfInterest()

PointOfInterest GetTargetPointOfInterest ( )

Gets the interface for the NPC's target point of interest if it has one.

Returns
Returns the NPC's target point of interest. Returns null if the NPC doesn't have a target point of interest.

◆ Kill()

void Kill ( Context instigator)

Kills the NPC by reducing its health to zero.

Parameters
instigatorThe source context triggering this change

◆ SetActivity() [1/4]

void SetActivity ( Context _,
ActivityData activityData )

Sets the activity the npc should go perform. The npc will path to the activity and start it once it gets there.

Parameters
_The instigator of the action. This is ignored in this case.
activityDataThe data describing the activity to perform.

◆ SetActivity() [2/4]

void SetActivity ( Context _,
ActivityData activityData,
bool teleport,
bool kickOccupant )

Sets the activity the npc should go perform. The npc will path to the activity and start it once it gets there.

Parameters
_The instigator of the action. This is ignored in this case.
activityDataThe data describing the activity to perform.
teleportIf true the npc teleports into the activity's position instead of moving into it.
kickOccupantIf true the npc forces out any npc already occupying the slot it wants, instead of failing to start the activity.

◆ SetActivity() [3/4]

void SetActivity ( Context _,
ActivityInstanceReference instanceRef )

Sets the activity the npc should go perform. The npc will path to the activity and start it once it gets there.

Parameters
_The instigator of the action. This is ignored in this case.
instanceRefThe reference to the activity instance to perform.

◆ SetActivity() [4/4]

void SetActivity ( Context _,
ActivityInstanceReference instanceRef,
bool teleport,
bool kickOccupant )

Sets the activity the npc should go perform. The npc will path to the activity and start it once it gets there.

Parameters
_The instigator of the action. This is ignored in this case.
instanceRefThe reference to the activity instance to perform.
teleportIf true the npc teleports into the activity's position instead of moving into it.
kickOccupantIf true the npc forces out any npc already occupying the slot it wants, instead of failing to start the activity.

◆ SetActivityDelay()

void SetActivityDelay ( Context instigator,
float delay )

Sets the delay between activities.

Parameters
instigatorThe source context triggering this change.
delayThe new activity delay.

◆ SetCanFidget()

void SetCanFidget ( Context instigator,
bool canFidget )

Configures whether the NPC can fidget.

Parameters
instigatorThe source context triggering this change
canFidgetIf set to true, the NPC can fidget.

◆ SetCharacterCosmeticsOverride()

void SetCharacterCosmeticsOverride ( Context instigator,
CharacterCosmeticProfile value )

Overrides the npc's current cosmetics.

Parameters
instigatorThe source context triggering this change
valueCharacterCosmeticProfile

◆ SetCombatMode()

void SetCombatMode ( Context instigator,
int combatMode )

Sets the combat mode for the NPC.

Parameters
instigatorThe source context triggering this change
combatModeThe CombatMode to set.

◆ SetDamageMode()

void SetDamageMode ( Context instigator,
int damageMode )

Sets the damage mode for the NPC.

Parameters
instigatorThe source context triggering this change
damageModeThe DamageMode to set.

◆ SetDestination()

void SetDestination ( Context instigator)

Sets the npcs destination to the position of an instruction node. This method is obsolete. Use SetDestinationToCell instead.

Parameters
instigatorThe source context triggering this change

◆ SetDestinationToCell()

void SetDestinationToCell ( Context instigator,
CellReference cellReference,
Context fallbackContextForPosition )

Set the npcs destination to the position of the selected cell. If no cell is selected it will set the destination to the position of the fallback context.

Parameters
instigatorThe source context triggering this change
cellReferenceThe cell to direct the npc to move to
fallbackContextForPositionThe context of the fallback position object

◆ SetDestinationTolerance()

void SetDestinationTolerance ( Context instigator,
float newTolerance )

Configures the distance to a destination where the npc will stop moving.

Parameters
instigatorThe source context triggering this change
newToleranceThe new destination tolerance.

◆ SetDestinationToPosition() [1/2]

void SetDestinationToPosition ( Context instigator,
Vector3 position )

Sets the npcs destination to the position in world space.

Parameters
instigatorThe source context triggering this change
positionThe position to set as the destination

◆ SetDestinationToPosition() [2/2]

void SetDestinationToPosition ( Context instigator,
Vector3Int position )

Sets the npcs destination to the position in world space.

Parameters
instigatorThe source context triggering this change
positionThe position to set as the destination

◆ SetDestinationToTargetPointOfInterest()

void SetDestinationToTargetPointOfInterest ( Context instigator)

Sets the NPC's behavior destination to a point near its target point of interest.

Parameters
instigatorThe source context triggering this change

◆ SetNewRovePosition()

void SetNewRovePosition ( Context instigator,
float roveDistance,
float distancePerMove )

Sets a new rove position for the NPC within a certain distance of an instruction node.

Parameters
instigatorThe source context triggering this change.
roveDistanceThe maximum distance to rove.
distancePerMoveThe distance per move during roving.

◆ SetNewWanderPosition()

void SetNewWanderPosition ( Context instigator,
float distance )

Sets a new wander position for the NPC within a specified distance of its current location.

Parameters
instigatorThe source context triggering this change
distanceThe distance within which to find a wander position.

◆ SetPhysicsMode()

void SetPhysicsMode ( Context instigator,
int physicsMode )

Sets the physics mode for the NPC.

Parameters
instigatorThe source context triggering this change
physicsModeThe PhysicsMode to set.

◆ SetUseActivities()

void SetUseActivities ( Context instigator,
bool useActivities )

Sets if the npc can use activities.

Parameters
instigatorThe source context triggering this change.
useActivitiesThe new activity use state.