← Previous | Next →
combatClosestPlayer
Description
Engages the NPC in combat with the closest player within a specified distance.
| Name | Type | Possibilities |
| combatClosestPlayer | behaviour | 2 |
Parameters
| # | Name | Type | Mandatory | Description | Multiple |
| 1 | distance | number | No | The maximum distance within which the NPC will engage the closest player. Defaults to 15 if not specified. | No |
Outputs
| # | Description |
| 1 | The NPC engages in combat with the closest player. |
| 2 | No player is within the specified distance, or the NPC cannot engage. |
Example
NPC
name Guard
model s_m_y_cop_01
position -1020.72 4839.78 258.30 0.0
interaction
nothing
behaviour
combatClosestPlayer 20