taskGoToEntity
TASK_GO_TO_ENTITY0x6A071245EB0D1882The GTA V native TASK_GO_TO_ENTITY of the TASK namespace, as LS:MP client scripts call it: the global function taskGoToEntity, in JavaScript and in Lua.
taskGoToEntity(
entity: Entity,
target: Entity,
duration: number,
distance: number,
moveBlendRatio: number,
slowDownDistance: number,
flags: number
): voidtaskGoToEntity(
entity: Entity,
target: Entity,
duration: integer,
distance: number,
moveBlendRatio: number,
slowDownDistance: number,
flags: integer
)Usage
taskGoToEntity(entity, target, duration, distance, moveBlendRatio, slowDownDistance, flags);taskGoToEntity(entity, target, duration, distance, moveBlendRatio, slowDownDistance, flags)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
entity | Entity | number | integer |
target | Entity | number | integer |
duration | int | number | integer |
distance | float | number | number |
moveBlendRatio | float | number | number |
slowDownDistance | float | number | number |
flags | int | number | integer |
Returns
Nothing. In JavaScript the call evaluates to undefined.
Notes
From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.
The entity will move towards the target until time is over (duration) or get in target's range (distance). p5 and p6 are unknown, but you could leave p5 = 1073741824 or 100 or even 0 (didn't see any difference but on the decompiled scripts, they use 1073741824 mostly) and p6 = 0
Note: I've only tested it on entity -> ped and target -> vehicle. It could work differently on other entities, didn't try it yet.
Example: taskGoToEntity(pedHandle, vehicleHandle, 5000, 4.0, 100, 1073741824, 0)
Ped will run towards the vehicle for 5 seconds and stop when time is over or when he gets 4 meters(?) around the vehicle (with duration = -1, the task duration will be ignored).
Reference
- Namespace
- Tasks TASK
- In the game
void TASK_GO_TO_ENTITY(Entity entity, Entity target, int duration, float distance, float moveBlendRatio, float slowDownDistance, int flags)- Hash
0x6A071245EB0D1882