All pastes #2081656 Raw Edit

Someone

public text v1 · immutable
#2081656 ·published 2011-09-20 21:38 UTC
rendered paste body
  _unit       = _this select 0;
  _part       = _this select 1;
  _partDamage = _this select 2;
  
  if (_part == "") then {
    _unit setVariable [QUOTE(GVAR(hds)), [_this]];
  } else {
    _unit setVariable [QUOTE(GVAR(hds)), (_unit getVariable QUOTE(GVAR(hds))) + [_this]];
  };

  if (_part == "body") then { // check for head hit
    _hds    = _unit getVariable QUOTE(GVAR(hds);
	_hdHead = _hds select 1;
	_hdBody = _hds select 2;
	if (_hdHead select 2 > _hdBody select 2) then { // hit in the head
	  [_hds, "hit_head"] call FUNC(hd3);
	};
  };
  
  if (_part == "hands") then {
    // last chance to go to hd3 if legs don't fire
	//[_unit, "hit_head"] call FUNC(hd3);
  };
  
  if (_part == "legs") then { // last hit
    // determine hit location
    _hds    = _unit getVariable QUOTE(GVAR(hds);
	_hdTotal = _hds select 0;
	_hdHead  = _hds select 1;
	_hdBody  = _hds select 2;
	_hdHands = _hds select 3;
	_hdLegs  = _hds select 4;
	_hitLoc = "body";
	if ( (_hdHands select 2 >= _hdBody select 2) && (_hdHands select 2 >= _hdLegs select 2) ) then {
      _hitLoc = "hands";
	};
	if ( (_hdLegs select 2 >= _hdBody select 2) && (_hdLegs select 2 >= _hdHands select 2) ) then {
      _hitLoc = "legs";
	};
	if (_hdHead select 2 > _hdBody select 2) then { // hit in the head
	  [_hds, _hitLoc] call FUNC(hd3);
	};
  };