Jump to content
easyeb

AI won’t drive vehicle with items attached using attachtorelative

Recommended Posts

So I’ve got a decked out vehicle with items attached to it using attachtorelative, but I’m having problems with my AI driver. When the vehicle is off road he’ll follow his orders and drive where I want him, but when he’s on a road, and when he’s stopped and turned off his engine he’ll not drive any more.

looking at his status in the group status bar it goes to ”moving” when I give him an order to move, and after a couple of seconds his status will change to ”Ready” without him moving.

 

has anyone of you encountered this? How did you solve it? 

Share this post


Link to post
Share on other sites

Thanks for the tip! Tried it out but it didn’t work sadly.

Share this post


Link to post
Share on other sites

@easyeb,

Can you save your car with attachments and driver into a composition and upload it for testing?

Share this post


Link to post
Share on other sites

what objects are you attaching?  their weight, boundingbox,  and physics might cause a problem.  if you set enablesimulation false on all attached objects it should work. 

 

also, maybe the ai is acting weird because of some other reason.  try exact same scenario with no objects attached to prove the attached objects cause the problem.

Share this post


Link to post
Share on other sites

It's collideWith
 


In the car's init, for each item

[this, redCUBE] remoteExecCall ["disableCollisionWith", 0, redCUBE];

If that still doesn't work set the AI to "CARELESS".


Have fun!

EDIT:
Also, if the objects don't begin attached to the car, make sure they do. Use show/hide instead of a mid-mission attachTo.

Edited by wogz187
I hope that makes sense...
  • Like 2

Share this post


Link to post
Share on other sites

Thanks alot for the help guys. None of it works unfortunately.

The AI driver is compliant for a couple of minutes in but after a while he refuses to move after a given order. If I get in the vehicle (that has a commander spot) and orders him to move forward he will, and when he's already started rolling I can give him map click orders which he will obey, but when he stops again he won't move any more.

 

The vehicle is a UK3CB Maxxpro (MRAP1), and the items attached to it are four fuel cans (FUELCAN1 through 4) and a stretcher (STRETCHER1). 

MRAP1 init:

[this, FUELCAN1] remoteExecCall ["disableCollisionWith", 0, FUELCAN1];
[this, FUELCAN2] remoteExecCall ["disableCollisionWith", 0, FUELCAN2];
[this, FUELCAN3] remoteExecCall ["disableCollisionWith", 0, FUELCAN3];
[this, FUELCAN4] remoteExecCall ["disableCollisionWith", 0, FUELCAN4];
[this, STRETCHER1] remoteExecCall ["disableCollisionWith", 0, STRETCHER1];


FUELCAN1 init (same for all other items except different names):

this enablesimulation false; [FUELCAN1, MRAP1] call BIS_fnc_attachToRelative;

 

Share this post


Link to post
Share on other sites

@easyeb

Quote

I can give him map click orders which he will obey, but when he stops again he won't move any more.

Ah. That's the key.

It's not the attached objects. I've seen this before. How does the player join this unit?

Share this post


Link to post
Share on other sites

The AI units are part of the group from mission start. If I remove the attached objects everything works fine.

Share this post


Link to post
Share on other sites
18 minutes ago, easyeb said:

The AI units are part of the group from mission start. If I remove the attached objects everything works fine.

thats freaky.   try converting BIS_fnc_attachToRelative to use attachTo (calculate the relative positions of your cans and stretcher based on you editor placement, or pre-record the offsets once and hardcode the offsets for each).   maybe there is a bug in BIS_fnc_attachToRelative...

FUELCAN1 attachTo [MRAP1, [0, 0, 1] ]; 

in my burning barrels script, i  attach 8 or 10 fuel barrels to a big truck, and ai has no problem following waypoints.

  • Like 1

Share this post


Link to post
Share on other sites

@johnnyboy, @easyeb,

Quote

If I remove the attached objects everything works fine.

As long as you're super-sure.

BIS_fnc_attachToRelative is fine that's what I used in the video above. Disable the fuel can simulation by the checkbox instead of script and also remove damage from the cans. Try removing damage from the vehicle, too.

Here's the file from the video above for reference.

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, wogz187 said:

@johnnyboy, @easyeb,

As long as you're super-sure.

BIS_fnc_attachToRelative is fine that's what I used in the video above. Disable the fuel can simulation by the checkbox instead of script and also remove damage from the cans. Try removing damage from the vehicle, too.

Here's the file from the video above for reference.


I'm super-duper-sure. I tried disabling simulation and damage in the checkboxes for each item, no change.

 

Here's a clip of the problem:

 

 

  • Like 1

Share this post


Link to post
Share on other sites

@easyeb

EDIT: Try one truck. If you haven't already. The trucks may be worried because from the AI point of view there are gas cans on the road. They are excepted from the gas can attached to their own vehicle but not the one on the other vehicle. You see what I mean? What happens with one truck?

Thanks for the video. Does it work perfectly without the cans? If so, instead of the cans, attach a hidden helper-- literally whatever object-- I like the arrow helpers. Attach the helper to the truck and the cans to the helper instead of the truck and see if that helps.

You could also try something like, 
Attach the cans together with BIS_fnc_attachToRelative and name one of them "cans" or whatever,

gasRACK = mRAP1;

cans attachTo [gasRACK, [0,7,-1], "vez"];  // you'll need to know the position trial and error will do remember increments of 1 meter
    
addMissionEventHandler ["Draw3D", {
cans setVectorDirAndUp [
(gasRACK selectionPosition "pohon") vectorFromTo (gasRACK selectionPosition "vez"),[0,0,0]
    ];}]; // I don't know the English version of these words but your truck might be different

Have fun!
 

  • Like 2

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

×