Jump to content
Sign in to follow this  
IndeedPete

How to prevent units from getting out of a boat?

Recommended Posts

Hey there,

I'm having a little design problem with the AI. In my latest work a few attack boats full of soldiers are heading towards a beach and encounter some hostile boats on the way. Sadly, they seem to behave like they're road vehicles, i.e. the AI orders everyone in cargo to get out as long as the threat is present. As you can imagine I now have a lot of idiots going for a swim in the the ocean while there's a war going on. Once the hostile boats are destroyed the AI orders them to get back into the boats. But until then it's just plain stupid and it kind of destroys the atmosphere I wish to create. I've already tried to lock the boats but it doesn't help.

Any ideas on how to prevent the AI from ordering swimming lessons on enemy contact?^^

Cheers

Share this post


Link to post
Share on other sites

How are you putting them in? If you are doing moveInCargo, be sure to assignAsCargo as well.

If that doesn't work, I suggest putting all cargo into the same group and all crew into the same group, setting cargo's combat mode to BLUE and CARELESS, and the crew group to RED and COMBAT, assuming that's what you want.

In one of my missions I use the BIS function to spawn a crewed boat, then the BIS function to spawn a group of soldiers, which I then move and assign as cargo. They eventually get into combat, and don't unload until I want them to. Works fine.

Share this post


Link to post
Share on other sites

Hey IndeedPete, I just battle with that myself.

Wanted my soldiers to stay in a truck no matter what until i said otherwise, and it was harder than I though.

Here's what I did on each passenger :

on each unit :
_x assignAsCargo _car;
_x moveInCargo _car;
_x disableAI "MOVE";

on the group :
_grp setCombatMode "BLUE";
_grp setBehaviour "CARELESS";
_grp allowFleeing 0;

on the vehicle 
_car lockCargo true;
_car lock true;
_car lockDriver true;

And undo all that when you want to "free" your soldiers.

Some of this may be excessive but Ive lost much time trying to make this *ù$ù%^$*ù of script work so im not going to search for what can be cleaned up.

Note : Locking the vehicle will prevent you to put units in it, so you have to unlock it everytime you add soldiers and lock it again just after that.

Share this post


Link to post
Share on other sites

Thanks for the replies guys, I will try my luck when I have time and let you know what worked. :)

Share this post


Link to post
Share on other sites

If all else fails, maybe this quick n' dirty could be an option.

// [vehicle, position, unit]
_veh addEventHandler ["getOut",{ 
   call compile format ["(_this select 2) assignAs%1 (_this select 0);(_this select 2) moveIn%1 (_this select 0)", (_this select 1)];
}];  

---------- Post added at 02:23 ---------- Previous post was at 01:50 ----------

Additionally, you could use setVelocity on the boat to push it towards the LZ. AI act too silly in boats IMO. setVelocity makes for a proper (fast and smooth) insertion via boats. If you are aware then please disregard.

Edited by Iceman77

Share this post


Link to post
Share on other sites

I've now put the cargo guys in a different group and let them join on a move waypoint right before the getout. It seems to work so far, thanks guys!

@Iceman77: Yes, the AI driving is really horrible. But they make it to the coast in reasonable time. I wonder how they will behave when I add some enemies on the beach... :D

Share this post


Link to post
Share on other sites

Oh damn, the AI is driving me totally nuts. Now the boat insertion works more or less but once they got boots on the beach they simply won't move. They have a waypoint 250 metres ahead, the area is clear but they choose to just lie down on the beach.

Any simple ideas out there? I could experiment with doMove and stuff but there must be a better solution.

Share this post


Link to post
Share on other sites
Oh damn, the AI is driving me totally nuts. Now the boat insertion works more or less but once they got boots on the beach they simply won't move. They have a waypoint 250 metres ahead, the area is clear but they choose to just lie down on the beach.

Any simple ideas out there? I could experiment with doMove and stuff but there must be a better solution.

Are there enemies around? Play around with the Behavior and CombatMode settings. If they are CARELESS and BLUE, they'll move for sure, but may not fire.

Share this post


Link to post
Share on other sites

No, I had additional enemies placed in the area behind the beach but that was causing the boat to never actually make it to the getout waypoint. They were just driving around and reporting enemy movement. However, there's an enemy squad on the beach but once they're taken out the AI seems to have no problems to land properly. Sometimes, the AI driver even crashes the boat into the hostile squad, that's kind of cool. :D

Hm, I've put them to aware on getout (they were in combat mode before) and I've assigned the boat to some civilian dummy, just in case. They moved on to their waypoint in my testrun now. So, I will just spawn some enemies once they've got boots on the sand and it should be fine. Thanks again!

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
Sign in to follow this  

×