effectiveCommander – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
(Blanked the page)
 
Line 1: Line 1:
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.01 ms) but will return the effective commander immediately:
where ''vehicle'' is the same object as for effectiveCommander ''vehicle'' .


<pre>
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
};
</pre>

Latest revision as of 06:52, 11 April 2016