Jump to content
Sign in to follow this  
roguetrooper

A.I. refuses to get out of car

Recommended Posts

I have an A.I. OPFOR UAZ with a machinegun. Driver and gunner belong to a bigger group and are both subordinates.

When the gunner is dead, the driver shall disembark. Since the A.I. commander does not order other infantry of his group (even those without weapons/ammo) to get into the gunner position, the UAZ is quite useless and the driver remains a sitting duck waiting to be shot.

I have tried a trigger:

Condition:
(alive enemycar) and !(side gunner enemycar == east)

On activation:
enemycar setFuel 0;
enemycardriver assignAsDriver enemycar; 
[enemycardriver] orderGetIn false;
enemycardriver action ["eject",enemycar];
hint "test";

But the driver refuses to get out (until tires are destroyed).

Share this post


Link to post
Share on other sites

try this in init of car.

_null = (vehicle this) spawn {waitUntil {!(alive (gunner _this))}; if (alive (driver _this)) then {[(driver _this)] orderGetIn false; unassignVehicle (driver _this)}};

this will wait until gunner is dead, then if driver is alive and in vehicle he will exit.

You can ofc also switch it around to assign another member of group to get in as gunner using this:

_null = (vehicle _this) spawn {waitUntil {!alive (gunner _this)}; if (canMove _this AND alive (driver _this)) then {((group (driver _this)) select ((count (group (driver _this)))-1)) assignAsGunner _this; [((group (driver _this)) select ((count (group (driver _this)))-1))] orderGetin true;};};

all untested but you see the purpose if its not working correctly and you need to change something.

Share this post


Link to post
Share on other sites
I test the trigger with:

moveout driver enemycar;

on activation.

works for me

It only seems to work, if you un- and regroup the driver and attach move-out-orders to him while he is ungrouped:

not alive gunner enemycar:

currentleader = leader enemycardriver;
[enemycardriver] joinSilent grpNull;
enemycardriver assignAsDriver enemycar;
[enemycardriver] orderGetIn false;
unassignVehicle enemycardriver;
enemycardriver action ["eject",enemycar];
moveout driver enemycar;
enemycar lock true;
[enemycardriver] joinSilent currentleader;

Edit:

Damn, its really annoing. Even when the driver has been ungrouped, moved out and regrouped, he walks to the car again and moves in. What a freaking feature is this, that AI moves into a vehicle and just sits there, waiting moveless to be shot while enemies are around? He moves even in and stays there when you set the vehicle setfuel 0. No gunner, no fuel, but moving in without order.

Edited by RogueTrooper

Share this post


Link to post
Share on other sites

did you even try my code in previous post? it works, i place vehicle with gunner in a group with a leader, code in initline, kill the gunner, driver gets out and returns to formation, abandoning car.

Share this post


Link to post
Share on other sites

I have tried it. But it's a bit trickier since the vehicle is not present all the time.

Share this post


Link to post
Share on other sites

What do you mean?

if you mean you spawn the vehicle or use another vehicle found empty as vehicle, its simple to add or change the code again.

Share this post


Link to post
Share on other sites

You can also do this when the trigger activates if you want him to get out:

car2 sethit ["wheel_1_2_steering",1]

This should work for most of the cars.

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  

×