Jump to content
ibpixels

How to make AI vehicle move to waypoint when other AI gets in?

Recommended Posts

Hello,

 

I am trying to figure out how to keep an AI controlled SUV to sit still until a specific AI unit enters that vehicle. So far I haven't gotten it to work, nor could I find anything to help online with something this specific. Hopefully someone has the solution.

 

Thanks

Share this post


Link to post
Share on other sites

Hey there ibpixels.

 

I believe you could use the "GetInMan" eventHandler. You have to add it to the unit that you want to trigger the SUV movement in a fashion like

_vipUnit addEventHandler["GetInMan", {
	_theVIP = _this select 0; // Get the VIP unit
	_theVechicle = _this select 2; // Get the vehicle (s)he entered
	
	// Perform check to see if the vehicle (s)he entered is the one you are interested in
	if(_theVehicle isEqualTo theSUV) then {
		systemChat "(S)he is in... Step on it...!!!"; / (S)he is in the correct vehicle
		_theVehicle forceSpeed -1; // Allow the vehicle to move normally 
	} else {
		systemChat "Madam/Sir, please get out. You are not supposed to be here...!!!"; // (S)he is in another vehicle
	};
}];

Please keep in mind that you will have to give a specific name to the SUV you want to move, in the editor, and use that where I typed theSUV.

 

One more thing you must take care of, is the locality of the unit when you add the event handler. I haven't used this specific event handler before but according to the BIKI (see link above) the event handler is persistent after respawn only if it is assigned where the unit was local.

 

EDIT: I just realized that your question was to get the SUV to stay still. Well, for that you can use forceSpeed. I have changed the code snippet above to incorporate the functionality. You will have to put in the SUV's init

this forceSpeed 0; // Force the vehicle to stay still

Apologies if I caused any confusion... 😟

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

variablename in variablename

 

AI_name in Name_of_car. Condition of a waypoint or trigger.

 

Not tested.

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

×