Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. fn_findNearby.sqf
  2. //Exit if client side
  3. if (!isServer && isMultiplayer) exitWith {};
  4. params["_unit","_side","_shooter", "_nearestunits", "_nearestfriendlies", "_a"];
  5. _unit = _this select 0;
  6. _side = side _unit;
  7. _shooter = _this select 1;
  8. _nearestunits = nearestObjects [getpos _unit ,["Man"], 1000];
  9. _nearestfriendlies = [];
  10.  
  11. if(_side countSide _nearestunits > 0) then{
  12. {
  13. _a = _x;
  14. if((side _a == _side) && (group _a != group _unit) && !(behaviour leader (group _a) isEqualTo "COMBAT")) then{
  15. _nearestfriendlies = _nearestfriendlies + [_a];
  16. [group _a, getpos _shooter, 100] call CBA_fnc_taskAttack;
  17. };
  18. } foreach _nearestunits;
  19. };
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29. fn_getHitEvent.sqf
  30. //Exit if client side
  31. if (!isServer && isMultiplayer) exitWith {};
  32.  
  33. _aiUnits = [];
  34. {
  35. _unit = _x;
  36. if !(isPlayer _unit) then
  37. {
  38. _unit addEventHandler ["Hit",{_this call fn_findNearby}];
  39. };
  40. }foreach allUnits;
  41.  
  42.  
  43.  
  44.  
  45. postinit.sqf
  46. fn_getHit = call compile preProcessFile "functions\fn_getHitEvent.sqf";
  47. fn_findNearby = compile preprocessFileLineNumbers "functions\fn_findNearby.sqf";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement