Skip to content

Instantly share code, notes, and snippets.

@GeorgeDettmer
Last active August 29, 2015 14:12
Show Gist options
  • Save GeorgeDettmer/beab6fbec7a2a0517252 to your computer and use it in GitHub Desktop.
Save GeorgeDettmer/beab6fbec7a2a0517252 to your computer and use it in GitHub Desktop.
waitUntil {
_v = _this nearEntities ["Car", 20];
if ({alive _x && !(_this getVariable ["no-collide",false])} count _v > 0) then {
_v = _v select 0;
_bb = boundingBoxReal _v;
_dist = abs ((_bb select 1 select 1) - (_bb select 0 select 1)) - (_this distance _v);
if (_this distance _v > _dist +2) exitWith {_this setVariable ["no-collide",nil,true]; _this enableCollisionWith _v};
if (speed _v > 2) then {driver _v forceWeaponFire [currentWeapon _v,currentWeapon _v]};
_this setVariable ["no-collide",true,true];
_this disableCollisionWith _v
};
!alive _this
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment