Jump to content

Recommended Posts

JBOY Boat Waypoints script

 

Vanilla boat AI is terrible at navigating narrow rivers.  This script fixes that problem.  Using this script, mission makers can now use waypoints to move boats up any narrow river that is deep enough for their boat to access it.  

I was inspired by the awesome Prairie Fire DLC map Cam Lao Nam that has many beautiful rivers and the Mekong Delta.  Let's fill those rivers with AI boats!

 

 

Download sample mission here.

 

Features:

  • Boats move to exact positions and can navigate narrow rivers, pass under bridges, etc.
  • Easy for mission maker to use:  Place move waypoints for boat, and place call to my script in first move waypoint.
  • Boats can back out from a beached position or a boat dock (if you put the word "reverse" in the move waypoint description).
  • Waypoints supported:  Move and GetOut.  I will add support for Transport/Unload later.
  • If a boat is beached, units exit boat and script terminates
  • When AI senses danger and switches to Combat Mode they will:
    • React verbally using various random in-game voice reactions: Under Fire!, Enemy Spotted!, Stay Low!, etc.
    • Boat will accelerate to max speed for boat.
    • 25% chance driver pops a smoke at back of boat to obscure their getaway
  • Some AI will ragdoll and fall from vehicle when killed (thanks to my Fall From Vehicles script which is also included)
  • Boat speed can be set by 2nd parameter to script call, or by default, it will be set by speedMode of Waypoint (Limited, Normal, or Full).  Limited will be 25% of max speed of boat. Normal is 50% of max speed.  Full is 75% of max speed.  100% (max speed) is reserved for when boat goes into combat mode, they will accelerate to max speed.
  • 3rd parameter to call is an "x offset", which means boat will travel x meters to right or left of waypoints.  This allows many boats to share same set of waypoints but travel in parallel paths to right or left of waypoint.

 

How to add to your own mission:

  1. From the demo mission, copy the JBOY folder into your mission folder.
  2.  Put the following code into your init.sqf to compile my scripts.
Spoiler

// init.sqf
call compile preprocessFile "JBOY\boatMove.sqf";
JBOY_Speak =  compile preprocessFileLineNumbers "JBOY\JBOY_Speak.sqf";
JBOY_PainGrunt =  compile preprocessFileLineNumbers "JBOY\JBOY_PainGrunt.sqf";
JBOY_BreatheSfx =  compile preprocessFileLineNumbers "JBOY\JBOY_BreatheSfx.sqf";
JBOY_PainSfx =  compile preprocessFileLineNumbers "JBOY\JBOY_PainSfx.sqf";
JBOY_Lip =  compile preprocessFileLineNumbers "JBOY\JBOY_Lip.sqf";

// Make all vietnamese guys speak chinese. This is optional!  I just want to hear the VC AI talk, and Chinese is better than just a squelch.
{if (speaker _x == "vie") then {_x setspeaker "male03chi";};} foreach allunits;

 

  1. Place a boat with an AI driver in the editor and create Move waypoints for him. 
  2. Note that each waypoint must have clear unobstructed line of sight to next waypoint (with no land in-between)
  3. In the first move way point, place a call to my script.  Here's three different formats for the call:
_n = [vehicle this] spawn JBOY_boatMoveWaypoints; // boat will follow waypoints with speed dictated by speedMode of waypoints (Limited, Normal, Full)
_n = [myboat,25] spawn JBOY_boatMoveWaypoints; // boat will follow waypoints, and speed will always be 25 (speedMode of waypoints ignored if speed specified).
_n = [vehicle this,0,-4] spawn JBOY_boatMoveWaypoints; // boat will follow waypoints, speedmode determines speed of boat, and -4 means boat will travel 4 meters to left of waypoints.  

 

  • Like 16
  • Thanks 1

Share this post


Link to post
Share on other sites

This is literally a game changer, thanks for putting in the work on this JB, feature rich and a great showcase, you are so awesome brother!

 

 

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Johnnyboy to the rescue (again!). Devs please start addressing your AI issues - its great we have scripters and modders to try and better these longstanding issues but dang cmon now where yall at ??

 

Looks great Johnny - love the AI backing up, tight navigating,  ragdoll getting shotted from boat and reactions -really great stuff. Might have to actually buy that DLC now

 

*kicks old dog and curmudgeonly grabs credit card

  • Like 1
  • Haha 2

Share this post


Link to post
Share on other sites

J-boy strikes again!  Wow, this is incredibly useful.  I love the flotilla at the end, boat on boat combat generally, the beached boat backing into the water ready for action, the ease of setup... the list goes on and on.  All scenarios you gloriosly present here would definitely be total clown shows with vanilla AI helming all these boats.

 

Time to populate the waterways of the armaverse with confidence, well done man. :thumbsup:

  • Thanks 1

Share this post


Link to post
Share on other sites

Can somebody confirm that the download sample mission link in top post works?  Somebody reported on youtube its not working, and it works for me (but maybe I have permission and others don't).  Thanks in advance!

Share this post


Link to post
Share on other sites
1 hour ago, johnnyboy said:

Can somebody confirm that the download sample mission link in top post works?  Somebody reported on youtube its not working, and it works for me (but maybe I have permission and others don't).  Thanks in advance!

 

Download Link works perfectly 😉 

  • Thanks 1

Share this post


Link to post
Share on other sites

J-Boy, Great script, I know I'm going to get a lot of use out of this.

I've just started putting a mission together using it and am getting this error msg although the ai do still follow wp as they should.

Is there something I missed?

 

11.jpg?raw=1

Share this post


Link to post
Share on other sites

Hmmm...not sure what the deal is there.  Can you post your mission somewhere where I can download and recreate the problem?  I'm traveling right now, so could be 3 days before I can look at it.

 

Also if you check the log file, maybe you can get an exact line # where its failing?

Share this post


Link to post
Share on other sites

Thanks for the reply J-Boy.

I'll get it uploaded tomorrow for you to have a look at. Just started the mission so it's pretty basic, (no mods) but will direct where the msg activates.

Cheers

...F

Share this post


Link to post
Share on other sites

Did some more checking J-Boy the msg has something to do with deleting boat and crew using this in a trigger.

call{{deleteVehicle _x;}forEach crew b1_4; deleteVehicle b1_4;}

As soon as I hit that trigger, up came the error msg.

Also noticed it's not showing all the time.

Don't think it's going to effect anything.

 

Hope this helps

Share this post


Link to post
Share on other sites
On 10/3/2021 at 1:04 PM, fawlty said:

Did some more checking J-Boy the msg has something to do with deleting boat and crew using this in a trigger.

call{{deleteVehicle _x;}forEach crew b1_4; deleteVehicle b1_4;}

As soon as I hit that trigger, up came the error msg.

Also noticed it's not showing all the time.

Don't think it's going to effect anything.

 

Hope this helps

Sorry for not getting back to you sooner.  The problem is that the boat is being deleted while a script is running on that boat.  I will need to modify the script to sense this condition so it does not fail, but not sure when I can get to that.  Thanks for reporting the bug, I do need to fix it.

 

Your workaround is to let the boat finish its waypoints and then delete it.  Or set the boat's damage to 1, wait 10 seconds (while the scripts finish), and then delete the boat.

 

Sorry not to respond sooner but I was traveling, and came home to alot of RL stuff.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

in a waitUntil, it's safer to check for:

isNil {anObject getVariable "blabla"}, or not,   // double secured : anObject can be inexistent and blabla can be undefined.

 

or even: anObject getVariable ["blabla",false]    (so with a default value in case or undefined variable "blabla").  // simple secured by blabla by default. Fails if anObject is inexistent.  If any doubt about the object's presence and the variable for the object, start like this:

  !isNil "anObject" && { anObject getVariable ["blabla",false] }

  • Thanks 1

Share this post


Link to post
Share on other sites

Is there a way that this could be made into a script that does the same if you are adding waypoints while in game, versus in the editor?

Share this post


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

Is there a way that this could be made into a script that does the same if you are adding waypoints while in game, versus in the editor?

Probably.  Its not something I'm likely to pursue though (too little time, and too many other priorities).

Share this post


Link to post
Share on other sites

Hi Folks,

 

Been MIA for a bit - the SOG sucked me back in. I came across this sorely needed boat script and it looks fantastic.

 

Quick Question: I tried putting "_n = [vehicle this] spawn JBOY_boatMoveWaypoints;" in the first waypoint activation field as described. it comes back with a "missing ;" error. It's been a while - - - what am I doing wrong? I looked at the demo mission - and - the first waypoints did not have the calls to the scripts mentioned above.

 

Thanks.

 

Regards,
Scott

Share this post


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

Been MIA for a bit - the SOG sucked me back in. I came across this sorely needed boat script and it looks fantastic.

Welcome back, SOG re-motivated me as well.

20 minutes ago, scottb613 said:

uick Question: I tried putting "_n = [vehicle this] spawn JBOY_boatMoveWaypoints;" in the first waypoint activation field as described. it comes back with a "missing ;" error. It's been a while - - - what am I doing wrong? I looked at the demo mission - and - the first waypoints did not have the calls to the scripts mentioned above.

That looks right to me.  YOu didn't actually include the quotes in that did you? 

 

In the demo mission, many of the first waypoints don't contain the call because I have "this lockWP true;" in the first waypoint's activation, and then the call to my script in the second waypoint's activation.  I can then do a lockWP false in a trigger condition to actually start that boat to move (because control moves to next waypoint once unlocked).

 

I assume you have copied my scripts into your mission directory, and added compile lines to your init.sqf?

Share this post


Link to post
Share on other sites

Hi Johnny,

 

Thanks so much for the very rapid response. Yeah - I was always a fan of "Unsung" but the "SOG" is like "Unsung" on steroids.

 

Yeah - no quotes.

 

I delved deeper in your mission example - I found an instance where you defined the "Activation" as follows which differs from above:

call{[vehicle this] spawn JBOY_boatMoveWaypoints;}

...which seems to work.

 

I did copy your directory and your "init.sqf" from your examples to a new mission.

 

I'm trying to setup the SOG PBR to come flying down the river - pull into shore with the nose on the beach - load a squad of SEALS - then reverse and charge up the river. Your typical INFIL/EXFIL via PBR - ala - Apocalypse Now style. 

 

I'm getting some weird results. When in reverse for more than a very brief period - the PBR sinks stern first very rapidly. Also - when I initially tried the beach thing with four waypoints - the reverse worked - then I added around ten more waypoints to the end to navigate the river without changing my initial four - the reverse no longer works and the boat attempt to charge up on the beach forward. If you go too far up on the beach the PBR crew bails - perhaps that's by design.

 

I should probably unload all my mods but the SOG required for testing. I'll play with this some more.

 

Regards,

Scott

 

 

Share this post


Link to post
Share on other sites

Good luck, I hope it works out for you.  It is by design that when beached, everybody gets out.  So for the initial nose in landing, be going slow for landing and don't beach it (put waypoint at waters edge, but not up on land).  Also the back out might have to be a slow waypoint also also (I honestly forget how that works, its been so long since I looked at it, but I know it works in my demo mission case).

  • Like 1

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

×