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 14
  • 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 1
  • 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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×