Jump to content

Recommended Posts

Hi  guys,

 

there is this command setDriveOnPath  which allows you to set the path for an AI driver via Markers

 

but is it somehow possible to record the path of a vehicle-player (none AI) and then play that path on an AI?

Share this post


Link to post
Share on other sites
44 minutes ago, Alert23 said:

Hi  guys,

 

there is this command setDriveOnPath  which allows you to set the path for an AI driver via Markers

 

but is it somehow possible to record the path of a vehicle-player (none AI) and then play that path on an AI?

AI will not exactly drive on the path, but it will try to move as exact as possible, had some decent results with the cart doing slalom through tanoan main airport, also works flawlessly moving through the hangars (all possible entrances, heh).

No longer got the snippet I used, was just a simple loop recording my position every 5m or 5 seconds, whatever came first.

Worked pretty good.

 

Something like this, with a unit named "test" sitting inside a vehicle:



GOM_fnc_path = [];


GOM_fnc_recordPath = {

	_duration = 30;//record path for 30 seconds after activation
	_interval = 3;//record path at least once every 3 seconds
	_distance = 5;//record path at least every 5m
	_record = [];
	_timeOut = time + _duration;
	_lastPos = getPosATL player;
	_lastTime = time;
	while {time < _timeOut} do {
		waitUntil {getPosATL player distance2D _lastPos >= _distance OR time > _lastTime + _interval};

		_lastPos = getposATL player;
		_lastTime = time;
		GOM_fnc_path pushBack _lastPos;

	};

	copyToClipboard str GOM_fnc_path;
	test switchCamera "EXTERNAL";
	test setDriveOnPath GOM_fnc_path;


};

[] spawn GOM_fnc_recordPath;

Be aware that it's still the AI who's driving...

 

Cheers

  • Like 3
  • Haha 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×