effectiveCommander – Talk

From Bohemia Interactive Community
Revision as of 06:26, 11 April 2016 by PierreMGI (talk | contribs) (Created page with "This command doesn't return the effective commander immediately. when this unit dies, it takes few second to make change. on the other hand, the following script, runs slower...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This command doesn't return the effective commander immediately. when this unit dies, it takes few second to make change. on the other hand, the following script, runs slower (~ 0.008 ms) but will return the effective commander immediately:

- where vehicle is the same object as for effectiveCommander vehicle - 

vehicle call {

 if (!(typeof _this isKindOf "air")) exitWith { 
   call {
     if (alive commander _this) exitWith {_commandingUnit = commander _this};
     if (alive gunner _this) exitWith {_commandingUnit = gunner _this};
      _commandingUnit = driver _this};
   };
   _commandingUnit = driver _this;

_commandingUnit

};