Jump to content
Brexin212

TaskInvoker.ParkVehicle issues

Recommended Posts

Hello fellow officers!

 

I am back hoping to get some help with a new problem that I need help solving. When invoking a Ped to park a vehicle, I noticed that the Ped will get almost right on top of the point, then drive around in circles for a few minutes before straitening out and parking the vehicle correctly. No matter how far away from the Vector3 that I call the "ParkVehicle" method, the Ped always drives like an idiot in circles before parking. Is anyone willing to share with me a work around?

 

My relevant code:

// Run checks while officer is enroute to the callout
while (drivingTask.IsActive)
{
	// Check for assignment changes
	if (NextTask != TaskSignal.None)
		return; // Return

	// Distance check
	if (parkingNicely && !isParking)
	{
      		// Getting close to location
		if (Officer.Position.TravelDistanceTo(CurrentCall.Location.Position) < 100)
		{
			Officer.Tasks.Clear(); // Clears the DriveToPosition task
			isParking = true;
			drivingTask = Officer.Tasks.ParkVehicle(CurrentCall.Location.Position, CurrentCall.Location.Heading);
		}
	}

	// Allow other threads to do something
	GameFiber.Yield();
}

 

Edited by Brexin212

Share this post


Link to post
Share on other sites

Parking AI (or driving AI in general) in V is not great, so I am not sure if there is a real fix for this. You could try checking their distance to the target position and also compared desired heading and current heading and perhaps just mark them as parked yourself.


Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

Share this post


Link to post
Share on other sites

If u cant solve the problem try to use the driver.Tasks.DriveToPosition() command, and when the ped task ended just align the car with the parking spot*, or make the driver.Tasks.ParkVehicle() after the DriveToPosition() task ends. Maybe, with that, the AI will be more "intelectual".

Edited by playervooob
i missed the spot*

Hello.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...