← Previous | Next →
enterClosestVehicle
Description
Makes the NPC enter the closest vehicle within a specified distance.
| Name | Type | Possibilities |
| enterClosestVehicle | behaviour | 3 |
Parameters
| # | Name | Type | Mandatory | Description | Multiple |
| 1 | vehicle | Entity | Yes | The global variable name where the vehicle entity will be stored. | No |
| 2 | distance | number | Yes | The maximum distance within which the NPC should look for a vehicle. | No |
| 3 | seatIndex | number | No | The seat index the NPC should attempt to enter. Defaults to the driver's seat if not specified. | No |
| 4 | speed | number | No | The speed at which the NPC should enter the vehicle. Defaults to 2.0 if not specified. | No |
| 5 | timeout | number | No | The time in milliseconds to wait before giving up on entering the vehicle. Defaults to -1 (no timeout) if not specified. | No |
| 6 | mode | number | No | The mode of entry. Defaults to 1 if not specified. | No |
Outputs
| # | Description |
| 1 | The NPC is already in or entering a vehicle. |
| 2 | The NPC starts entering the closest vehicle. |
| 3 | No vehicle was found within the specified distance. |
Example
NPC
name Thief
model a_m_y_hipster_01
position -1020.72 4839.78 258.30 0.0
interaction
nothing
behaviour
enterClosestVehicle myVehicle 15.0 0 2.0 -1 1