Jump to content
Sign in to follow this  
The_Captain

Changing EffectiveCommander of Vehicle

Recommended Posts

I have a very simple problem. When a player gets in an armed transport which is in his group, such as the stryker M2 or BMP-2, he assumes effective command of the vehicle (giving him the ability to give basic commands). The main problem is when such a vehicle is under command of a cargo unit, it goes into safe mode! Yep, all the crew turn out and no longer attack, making the vehicle useless until the player disembarks.

When a player gets into a transport that's in his group, my eventhandler goes through a number of steps to make sure that the commander of the vehicle stays the commander (the code doesn't currently check to see if there's no commander. I'll add a simple check to make the effectivecommander first commander, then gunner, then driver, if available).

here's part of my eventhandler:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_vehicle = _this select 0;

_position = _this select 1;

_unit = _this select 2;

_group = group _unit;

_commander = commander _vehicle;

if (_unit != player) exitwith{};

Titlecut ["","BLACK",];

if (_position == "cargo" && _unit == effectiveCommander _vehicle) then {

[_unit] joinSilent grpnull;

sleep .01;

_unit action ["eject",_vehicle];

sleep .01;

_commander action ["eject",_vehicle];

sleep .01;

_commander moveincommander _vehicle;

sleep .01;

_group selectLeader _commander;

sleep .01;

_unit moveincargo _vehicle;

sleep .01;

[_unit] joinSilent _group;

sleep .01;

_group selectLeader _commander;

sleep .01;

selectPlayer _commander;

};

if (_position == "cargo" && _unit != effectiveCommander _vehicle) then {

_group selectLeader effectivecommander _vehicle;

selectPlayer effectivecommander _vehicle;

};

it's a chunky solution, and doesn't always seem to work properly, where sometimes the stubborn player keeps vehicle command. Does anyone know a simpler way to retransfer command of a vehicle?

Thanks.

Share this post


Link to post
Share on other sites

Yeah, this is an annoying bug. Good find. I've just added it to the BTS. Link here.

It affects all vehicles with cargo positions, the turned out crew is just a hint of what's going on.

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  

×