Jump to content
johnnyboy

setDriveOnPath for boats

Recommended Posts

setDriveOnPath only works for land vehicles.  I would like to modify it to work for boats as well.  In the functions viewer, I can't find setDriveOnPath.

 

Is there a way to find the code for this function?

Share this post


Link to post
Share on other sites
14 minutes ago, johnnyboy said:

setDriveOnPath only works for land vehicles.  I would like to modify it to work for boats as well.  In the functions viewer, I can't find setDriveOnPath.

 

Is there a way to find the code for this function?

 

It's not a function but an engine command. therefore you can't find a code for it.

I can't find on the wiki that it works only for land vehicles. what happens with your boats when using it?

Share this post


Link to post
Share on other sites
1 minute ago, sarogahtyp said:

I can't find on the wiki that it works only for land vehicles. what happens with your boats when using it?

The boat doesn't move - no error is given.  I'm sure my code is clean.  If I change the boat to an atv and make first position in array a land position, the atv will move that position (which means the code works, but the engine code must just exit if vehicle not a land vehicle).  If first position on land and next positions on water, atv will drive to first position, and then drive underwater for awhile until he finally flips over.  This makes me think it will work with water positions for an amphibious land vehicle.  I'll try that next just for fun.

Share this post


Link to post
Share on other sites

what happens with vehicles which are able to move on both? I mean water and land. Are those vehicle moving in water?

Share this post


Link to post
Share on other sites
14 minutes ago, sarogahtyp said:

what happens with vehicles which are able to move on both? I mean water and land. Are those vehicle moving in water?

I just ran 2 tests with the amphibious Marshall vehicle.  In test 1 the Marshall traveled up river through 3 water positions and then stopped (there are about 20 water positions in the path array).  On Test 2 the Marshall successfully ran through all 20 water positions.   This should mean we can make a path of markers up a narrow river, and have an amphibious vehicle follow that path.

14 minutes ago, squeeze said:

have you tried ATLToASL

Thanks, but I don't think that is relevant.  My goal is to have an AI boat travel up a narrow river by following an array of position markers placed in the river path.  Driver AI is terrible so boats can't do this very well using waypoints.  But setDriveOnPath eliminates path finding and drivers move reliably from point to point (at least on land they do).  I was hoping to get the same result for setDriveOnPath.  I know I can use UnitCapture, but that is alot more work to record all possible boat paths on a good river map like Isla Duala.

Share this post


Link to post
Share on other sites

Yep, that doesn't work for boats (BI dislikes Navy things 😉)
 

You can use the new syntax of addWaypoint with a radius set to -1, driver careless and low speed.

  • Like 1
  • Haha 1

Share this post


Link to post
Share on other sites

It also doesn't work for planes, helicopters, etc. Basically anything that doesn't touch the ground.

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, lexx said:

It also doesn't work for planes, helicopters, etc. Basically anything that doesn't touch the ground.

But it seems there is a type filter for these objects because that works for amphibious like Marshall (I had to add a sleep but it works).

Share this post


Link to post
Share on other sites
2 hours ago, pierremgi said:

But it seems there is a type filter for these objects because that works for amphibious like Marshall (I had to add a sleep but it works).

I confirmed that as well.  Amphibious vehicles will travel a water surface path using setDriveOnPath.  Water vehicles and air vehicles will not.

 

Share this post


Link to post
Share on other sites

This is a month too late, but I ran into a similar issue yesterday and wanted to post a potential solution. I started by looking at how the BIS_fnc_UnitPlay function makes vehicles follow a set of points *smooth-ish=ly*. That function uses setvelocitytransformation


object setVelocityTransformation [fromPosASL, toPosASL, fromVelocity, toVelocity, fromVectorDir, toVectorDir, fromVectorUp, toVectorUp, interval]

 

With some careful planning, you can create an array of positions and iterate through it to get the AI to "drive" the boat down the water. If you use this method, you would have to add checks for things like combat, a dead driver, dead vehicle, or a halted boat that interrupt the loop. Otherwise you will have a ghost boat driving around....

 

Which sounds fairly cool anyway....

 

The only other solution I could think of...would to be constantly nudging the boat forward and away from the shore... using 

abs (getTerrainHeightASL (getposASL _boat))

you can constantly be checking the depth of the water - and if it gets too shallow, have a function setvelocitytransformation away from the edge of the water. This method would most likely create a drunken driver effect...as the AI LOVE to just drive boats into the shore.

 

  • Like 1

Share this post


Link to post
Share on other sites

I wanna to report this problem on bug trucker  too due test on big ships - I try to eliminate AI - path calculations and even using agents and setdestination command with go direct options etc is impossibile to tell to AI go directly to this point, this command will be perfect for that but as you observe it not work, (rememeber to put more than one weaypoints to list - i try with one and nothing happen until i put secont in pplace far than sensivity of vehicle) , so this is next limitation to preven make in arma things ppossibile in VBS as many other. But maybe is some solution for that - but very much complicated - using script of automation this proces with commands like _ship sendSimpleCommand "FORWARD" more of them is on wiki https://community.bistudio.com/wiki/sendSimpleCommand i try it and report how it work. (one tested method is pushing object by force vesctor but it need very complicated script too for put them in correct places with correct values in correct time to have correct effect - i made it for submarine but it take lot of code and CPU so using implemented functions in core of arma is the fastest way to not take too much CPU but those limitations casues so many problems for modders that it is sometimes very hard. 

  • Like 2

Share this post


Link to post
Share on other sites

After hours of multiple tests I give up, even commands like simplecommands forward/fet/right not works with boats -  worst:  with land vehicles not working good, this too so this part of manage moving of vehicles in arma is so limited that I am thinking about break works on ships addons , until they not change something with this "setDriveOnPath" for ships too - my other method  with "addforce" is of course working but is scripting vectoring overriding engine forces on object - it is not perfect for me.

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

×