Jump to content
jonilahtinen

Force AI to drive boats fast

Recommended Posts

Hey, I'm trying to make invasion style mission with landing boats (craft?), but the AI drives veeeery slowly even when the waypoint is made "careless" and full speed.

 

Any idea how to force the AI to "crash" full speed to the shore?

Share this post


Link to post
Share on other sites
17 minutes ago, genesis92x said:

This will create hilarious results if not used carefully. Boats act funny with setVelocity.

Oh, I didn't know about that. Maybe I just use it carefully. :smileee::tounge_o:

I only really use it for vehicle boost and on static Trawler object.

(old video - the newer version of this actually had water effects under the ship when moving, like how boats do when moving)

Share this post


Link to post
Share on other sites

I solved beach landings with a velocity boost script.  To see it in action, play the beginning of my Leper Island mission in MP, and pick a non-Team Leader unit (you can play it in MP without other players).  The AI Team Leader will drive the boat to a waypoint just offshore, where I have put a trigger to call the velocity boost script.  The script then uses a short setVelocity loop to move the boat to shore.  This way the AI disembark in shallow water and don't get stuck swimming in cirles.

 

Here's the script:

//////////////////////////////////////////////////////////
// velocityBoost.sqf 
// Created by: johnnyboy
//
// Call this from a trigger that activates when boat is close to shore.  The VelocityBoost will push 
// boat to shore, so when soldiers eject, they don't get confused walking in circles in the water.
//
// nul = [boatName] execVM "Scripts\velocityBoost.sqf";
//
//////////////////////////////////////////////////////////
if (isServer) then
{
	_vehicle = _this select 0;
	_vehicle allowDamage false;
	_vel = velocity _vehicle;
	_dir = direction _vehicle;
	_speed = 11;
    _iterations = 10;
	
	diag_log format ["speed=%1",_speed];
	if (! (isplayer (driver _vehicle)) ) then
	{
		driver _vehicle enablesimulation false;
		_vehicle setVelocity [(_vel select 0)+(sin _dir*_speed),(_vel select 1)+ (cos _dir*_speed),(_vel select 2)];
		_continue = true;
		sleep(0.2);
		x = 0;
		while {x < _iterations and (alive _vehicle) and (alive (driver _vehicle)) } do
	   {
			x = x + 1;
			_vehicle setVelocity [_speed * sin(_dir), _speed * cos(_dir), (_vel select 2)];  
			Sleep(.2);
		};
		_vehicle allowDamage true;
		sleep 2;
		driver _vehicle enablesimulation true;
		driver _vehicle leaveVehicle _vehicle;
		sleep .5;
		{_x leaveVehicle _vehicle; } forEach crew _vehicle; 		
	};
}
;

 

  • Like 2

Share this post


Link to post
Share on other sites

Thanks, but that didnt do anything.

 

So there is no way to force AI to drive full speed to shore? Arma... :dozingoff:

Share this post


Link to post
Share on other sites

Check my post Beach landing with IFA LCVP. It has a link for a test mission with beach landing. Check it out and tell me what you think

 

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

×