Jump to content
bogdanm

How to make the AI Divers(crew and passengers) get out of the SDV underwater?

Recommended Posts

I've started making another mission and I have some AI divers that need to move close to a port inside an SDV but I want to have them disembark the vehicles underwater and swim to shore.

The unload/getout waypoints don't work, they always move the sub near to shore to disembark even if the waypoint is in the middle of the sea. I've tried naming the group and put "group1 action ["eject", SDV1]" inside a move waypoint but it gives me an error(for single units it works though). If I use "SDV1 action ["eject", SDV1]" script, only the driver gets out and then he gets back in (probably ordered by the group leader). Any ideas how to make it work?

Share this post


Link to post
Share on other sites
Try this:

{unassignvehicle _x; dogetout _x} foreach units yourgroupname;

Unfortunately it doesn't work. The sub goes to shore just like when using the Get Out waypoint.

Share this post


Link to post
Share on other sites

_null = [groupname] execVM "groupEject.sqf"

if (isServer) then
{
_grp = _this select 0;

sleep (random 3);

{
	unassignVehicle (_x);
	(_x) action ["EJECT", vehicle _x];
	sleep 0.4;
} foreach units _grp;
};

Share this post


Link to post
Share on other sites

Hey cobra, I was just messing around with some similar code wrote by you on this thread. Silly question time, I put "_null = [groupname] execVM "groupEject.sqf"" in the waypoint on act. field right?

EDIT: I've tried the script, they all get out at the waypoint but the scumbag leader orders them to get back in.

Edited by BogdanM

Share this post


Link to post
Share on other sites

Tried leaveVehicle?

groupOne leaveVehicle sdvOne;

Totally doesn't work... grr.

This worked in the onAct of a MOVE waypoint:

{unassignvehicle _x; (_x) action ["EJECT", vehicle _x]} forEach units groupOne;

Basically the same as cobra had above, just inline.

Edited by kylania

Share this post


Link to post
Share on other sites

I've found the same thing.

Using unassignVehicle and getOut makes the sub go to the shore

Using eject means they get back in.

The only workaround I've found so far is using eject, then making them join a new group.

Something like:

if (isServer) then
{
_grp = _this select 0;

_side = side _grp;

_new_grp = createGroup _side;

sleep (random 3);

{
	unassignVehicle (_x);
	(_x) action ["EJECT", vehicle _x];
	[_x] joinSilent _new_grp;
	sleep 0.4;
} foreach units _grp;

deleteGroup _grp;
};

It's a bit messy, but should work.

Share this post


Link to post
Share on other sites

Another thing to try along with previously suggested unassignvehicle and eject is: sub setfuel 0;

Maybe AI will ignore the sub if its out of fuel.

And finally, have a different locked sub on the map (or createvehicle one) and name it sub2. Then do the following (after divers exit sub):

_pos = getpos sub;

_dir = getdir sub;

sub2 setdir _dir;

deletevehicle sub;

sub2 setpos _pos;

By deleting the sub the divers are assigned to, they will hopefully move on their way, and ignore the new sub. Worth a try. I know it sucks to have to do tricks to get stuff like this to work...but a man's gotta do what a man's gotta do. Good luck.

Edited by JohnnyBoy

Share this post


Link to post
Share on other sites

sorry to necro a 4 year old thread, but i just found an alternate solution to this and had to share, because this is the first search result i find when i go looking for this issue.

 

here's the core of the code:
 

crew SDV allowGetIn false; // <-- This is the important bit, it prevents the AI (and player(s)) from being ordered to mount vehicles.

{

  unassignVehicle _x;

  _x action ["Eject",vehicle _x];

} forEach crew SDV;

 

notes/suggestions/caveats:

 

1. you may want to zero out the SDVs velocity and turn it's engine off to keep it from floating away.

 

2. you may want to consider locking the SDV to prevent a player from remounting it.

 

3. don't forget to call "allowGetIn true" for each member of the group later if you want them to remount the SDV or other vehicles.

 

4. if "allowGetIn true" is called with the group in the vacinity of the SDV, they will remount it automatically.

 

5. do not call the code while the SDV is moving at high speeds as it may kill members of the crew (if this needs to be done, it's reccomended that you use setPosition with a bit of math).

 

6. Link To allowGetIn documentation (link good As of Jan 2, 2017): https://community.bistudio.com/wiki/allowGetIn

  • 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

×