super-truite 54 Posted March 31, 2013 Hi, Do someone knows how to force AI boats to go ashore before unloading troops? I tried to use a simple transport unload waypoint (placing it slightly ashore or right on the shore) but with no luck. The boat often unload its cargo 5-10 meters away from the shore and the units begin to swim in circle around the boat, which I must reckon is quite funny but it is not what I had in mind :). I can fix this by trial and error (at some locations on the beach, the unload waypoint works), but I would like something more efficient. As suggested in this thread: http://www.ofpec.com/forum/index.php?topic=14103.0, I tried to set the velocity of the boat manually with setvelocity, but the engine stops for some reason... PS: For those who are trying to make a beach landing too a useful trick is to put this in the init of the boats: this disableAI "TARGET";this disableAI "AUTOTARGET";this allowfleeing 0;this setbehaviour "CARELESS" This way they don't freak out and flee when they see ennemies on the beach. Share this post Link to post Share on other sites
johnnyboy 3741 Posted March 31, 2013 I had the exact same problem, and velocity fixed it for me. I created a rectangular trigger parallel to the shore, and call this script when the boats enter trigger. The velocity boost then pushes them in close enough to get out standing up. The boat units have a getout waypoint on the shore. Velocity boost 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"; // // Code taken from Example 2 in this Wiki page: http://community.bistudio.com/wiki/setVelocity ////////////////////////////////////////////////////////// if (isServer) then { _vehicle = _this select 0; _vel = velocity _vehicle; _dir = direction _vehicle; _speed = 10; _vehicle setVelocity [(_vel select 0)+(sin _dir*_speed),(_vel select 1)+ (cos _dir*_speed),(_vel select 2)]; }; I still have another problem though. If boat driver gets shot, the crew just sits in boat like retards and float. Need another script to sense dead driver, and assign another crew member to move in as driver. Also i setBehaviour "CARELESS" on driver so he won't turn away from beach when fired on. Share this post Link to post Share on other sites
super-truite 54 Posted March 31, 2013 (edited) thanks JohnnyBoy I will give it a try. Checking if the driver is alive is simple: !alive driver _vehicle but I don't find the function to make an AI change positions in the vehicle. I'll try to figure this out, but I am quite the noob at this :) Edited March 31, 2013 by super-truite wrong code balise Share this post Link to post Share on other sites
Sarge46 10 Posted April 1, 2013 You might be interested in moveInDriver Share this post Link to post Share on other sites
super-truite 54 Posted April 1, 2013 thanks sarge. I didn't manage yet to replace the driver when he get killed, but I would like to fix something else first. The JohnnyBoy's script works perfectly, but I am trying to modify it a bit, setting the boat fuel to 0 near the shore and restoring the driver behavior to combat mode. But this last step doesn't work and the whole script bug when I add the last line... if (isServer) then { _vehicle = _this select 0; _vel = velocity _vehicle; _dir = direction _vehicle; _driv= driver _vehicle; _speed = 10; _vehicle setVelocity [(_vel select 0)+(sin _dir*_speed),(_vel select 1)+ (cos _dir*_speed),(_vel select 2)]; sleep 2; _vehicle setFuel 0; sleep 4; _driv setBehavior "COMBAT"; }; I tried various different syntaxes but it never works :( (I am new to scripting). Share this post Link to post Share on other sites
johnnyboy 3741 Posted April 1, 2013 (edited) That's becuz you have not spelled behavior like a bloody brit: setBehaviour (you're missing the "u"). You might want to use notepad++ (free) editor and download the sqf/sqs template. It will highlight misspelled sqf keywords for you while you are editing the script. It's a powerful and free editor. Although the template I'm using does not recognize the new arma3 commands yet. Edited April 1, 2013 by JohnnyBoy Share this post Link to post Share on other sites
super-truite 54 Posted April 1, 2013 lol, thanks Johnny. I feel stupid :). It works now. I noticed something interesting: on the map, in the editor, you can see the shore height line. The AI boat driver begin to slow down at the first height line next to the shore. It is then a bad idea to set a landing waypoint at a position where this height line is really far from the shore, because the AI will try to stop sooner and even with the help of the VelocityBoost script it will stop in the water. Here is an example: (The line in red is the nearest to the shore). It would be nice to have a solution which allows to set up a beach landing quickly, without having to fine-tune each waypoints. ---------- Post added at 04:54 PM ---------- Previous post was at 04:13 PM ---------- Here is a little example mission (just the boat landing) for those interested: http://rapidshare.com/files/4243034249/test_beach_landing.Stratis.rar It is still not perfect but it works. It would be nice to be able to force the boat driver to follow a direction strictly, because they still allow themselves to deviate a bit from direction defined by their starting position and the "transport unload" waypoint. This can produce collisions between two boats an looks weird. Share this post Link to post Share on other sites
johnnyboy 3741 Posted April 2, 2013 Your rapidshare sample file gives me this error: Download permission denied by uploader. (0b67c2f5) I was going to check it out, and maybe tweak it a bit, but can't get to your mission. Share this post Link to post Share on other sites
Freebie 10 Posted April 2, 2013 You just want the boat to land and the AI to get out on the beach? Just give the boat a "get out" waypoint on the beach front. Boat beaches, AI's get out on beach. Share this post Link to post Share on other sites
johnnyboy 3741 Posted April 2, 2013 You just want the boat to land and the AI to get out on the beach?Just give the boat a "get out" waypoint on the beach front. Boat beaches, AI's get out on beach. What you say is true, but in many cases they getout in too deep of water, and then the AI swims in circles instead of to the beach. This happens even if the getout wp is in shallow water or on dry land. So the scripting truite and I are working on forces the boat in closer to shore so when the AI gets out, they don't get confused. Share this post Link to post Share on other sites
Freebie 10 Posted April 2, 2013 What you say is true, but in many cases they getout in too deep of water, and then the AI swims in circles instead of to the beach. This happens even if the getout wp is in shallow water or on dry land. So the scripting truite and I are working on forces the boat in closer to shore so when the AI gets out, they don't get confused. I haven't seen this happen yet, as long as there's beach the driver beaches the boat and the AI get out either on sand or in shallow water. If there's a sandbank and they get out a little early or the water bank drops off steeply and a couple get out swimming then all you need is a move waypoint however far you want in from the beach and they'll continue onto there once they get out of the boat. I just tried it a few times in different places on Stratis and it worked everytime. Maybe I've just been lucky. Share this post Link to post Share on other sites
super-truite 54 Posted April 2, 2013 here you go: http://www.filedropper.com/testbeachlandingstratis I forgot to mention that in my example, when the boat is ashore, the driver get out and join the group leader that was in the boat. It's messy in the editor and I want to do this within the script later when I'll have time and more experience Yes Freebie, you were lucky! And by the way, thanks for the sqf/sqs template idea for notepad++, this will change my life! Share this post Link to post Share on other sites
TheBigOne_014 16 Posted April 2, 2013 I'm having the same problem,... if they get out in deepwater (water over their waist) thei just keep going in circles on the water. I'm goign to try some of this codes to see if it get's better. Share this post Link to post Share on other sites