← Previous | Next →
goToClosestPlayer
Description
Makes the NPC move towards the closest player within a specified distance and speed.
Name | Type | Possibilities |
goToClosestPlayer | behaviour | 3 |
Parameters
# | Name | Type | Mandatory | Description | Multiple |
1 | distance | number | No | The maximum distance to search for a player. Defaults to 15 if not specified. | No |
2 | speed | number | No | The speed at which the NPC should move towards the player. Defaults to 2.0 if not specified. | No |
Outputs
# | Description |
1 | The NPC is in player's proximity. |
2 | The NPC moves towards the closest player. |
3 | No player was found within the specified distance. |
Example
NPC
name Follower
model s_m_m_security_01
position -1020.72 4839.78 258.30 0.0
interaction
nothing
behaviour
goToClosestPlayer 15 3.0