Jump to content
ArmA Scarlett

Help! Ai won't get back into the vehicle!

Recommended Posts

Hey all! Here's the situation. I am spawning a vehicle via VVS with ai as the driver, this way I can gun and drive at the same time. In a dedicated MP server setting. Problem is, if I accidentally flip the vehicle, the ai ejects automatically and I can't get him back in once the vehicle is un-flipped. So far this is what I have:

if (tolower (typeof _vehicle) in
[
    "b_mbt_01_cannon_f","b_mbt_01_tusk_f","o_mbt_02_cannon_f","o_mbt_04_cannon_f","o_mbt_04_command_f","i_mbt_03_cannon_f","b_afv_wheeled_01_cannon_f","b_afv_wheeled_01_up_cannon_f","b_apc_tracked_01_aa_f",
    "o_apc_tracked_02_aa_f","o_apc_tracked_02_cannon_f","o_apc_wheeled_02_rcws_v2_f","b_afv_wheeled_01_cannon_f","b_afv_wheeled_01_up_cannon_f","i_apc_wheeled_03_cannon_f","b_apc_wheeled_01_cannon_f",
    "i_apc_tracked_03_cannon_f","b_afv_wheeled_01_cannon_f","b_afv_wheeled_01_up_cannon_f"]) then {
    _group = createGroup [west, true];
    _crew = _group createUnit ["B_crew_F", position _vehicle, [], 0, "CAN_COLLIDE"];
    _crew moveInDriver _vehicle;
    _crew assignAsDriver _vehicle;
    _crew allowDamage false; 
    hideObjectGlobal _crew; 
    _crew setCaptive true;
    _crew disableAI "all";
    _vehicle lockDriver true;
    _vehicle allowCrewInImmobile true;
    _vehicle setUnloadInCombat [false, false];
    _crew enableSimulationGlobal false;
    };

if (alive _vehicle) then
{
waitUntil { sleep 1; (( vectorUp _vehicle ) isNotEqualTo [0,0,1]) || (alive _vehicle) };
    _vehicle lock 0;
    _vehicle lockDriver false;
    _vehicle setVehicleLock "UNLOCKED";
    _crew enableSimulationGlobal true;        
    _crew enableAI "all";
    _crew moveInDriver _vehicle;
    _crew assignAsDriver _vehicle;
    _crew disableAI "all";
    _vehicle lockDriver true;
    _crew enableSimulationGlobal false;
};

The waitUntil bit is where it is hanging and I'm unsure how to tell the engine to check if the vehicle is upright again so that the ai will get back in. Any help is much appreciated! 

Share this post


Link to post
Share on other sites

For something like this all I could do was have the unit leave a group, run orders,  and rejoin. 

Share this post


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

The waitUntil bit is where it is hanging

Can you explain a little more what you mean with this? Both conditions in your waitUntil should return true and so should move on immediately

 

VectorUp changes with the terrain, so you'll probably really only find this in the VR map and you check if vehicle is alive right above

  • Like 1

Share this post


Link to post
Share on other sites

Solved. I decided to go a different route, delete the ai if flipped, spawn new ai in the unflip script. Cheers.

  • 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

×