Jump to content
Tova

Disable player vehicle driving while commander

Recommended Posts

Hello Arma scripting gurus !


Since a recent update (a couple months ago), you can have direct control over tanks even if you are in the gunner seat. What I mean, is that you man the gun while moving the tank, à-la Battlefield for instance.

 

I would like to disable that feature : I want the player to be unable to drive the tank if he is in the gunner seat. Any way to do that ?

 

Thanks a lot !

  • Like 1

Share this post


Link to post
Share on other sites

driver, commander, gunner, passenger...

 

In case of one player and 2 AIs in the slammer vanilla tank:

- If you start as commander, you are the "effective commander", and you'll stay it!," even if you shift place for gunner or driver or even passenger, disembark/reembark... So, you can order the moves as soon as you're inside tank.

- If you start as gunner, you're not the effective commander and nothing happens, even if you shift for commander. Probably for the reason above: an effective commander stays effective commander (at least if nobody is killed).

- if you start as driver, you  cannot shift for any other place.

 

On my mind, there is no command for setting the effective commander (effectiveCommander is just a getter). See also.

 

Here is my workaround:

 

MGI_keysOrder = ["carForward","Turbo","carSlowForward","carBack","carLeft","carRight"] apply {actionkeys _x select 0};
0 = [] spawn {
  waitUntil {!isNull findDisplay 46};
  if (isnil "MGI_keysDriving") then {  
  MGI_keysDriving = (findDisplay 46) displayAddEventHandler ["KeyDown",  
    "

      private _handled = false;  
      if (!isNull objectParent player && player == effectiveCommander vehicle player && {(_this select 1) in MGI_keysOrder}) then {  
        _handled = true  
      };  
      _handled  
    "];
  };
};

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Thank you nice work around !

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

×