set_skill.sqf 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. params [ "_unit"];
  2. private _side = side _unit;
  3. private _wounded = false;
  4. (group _unit) allowFleeing 0;
  5. if ( damage _unit > 0.25 ) then { _wounded = true; };
  6. private _skillmodifier = sqrt GRLIB_difficulty_modifier;
  7. private _inVehicle = false;
  8. if ( vehicle _unit != _unit ) then {
  9. _inVehicle = true;
  10. };
  11. if ( !(GRLIB_autodanger) && (_side == GRLIB_side_friendly)) then {
  12. _unit disableAI "AUTOCOMBAT";
  13. };
  14. if ( _wounded ) then {
  15. _unit setSkill ["aimingspeed", [ 0.15 * _skillmodifier ] call F_limitSkill ];
  16. if ( !_inVehicle ) then {
  17. _unit setSkill ["aimingaccuracy", [ 0.03 * _skillmodifier ] call F_limitSkill ];
  18. };
  19. _unit setSkill ["aimingshake", 0];
  20. _unit setSkill ["spottime", 0.5];
  21. _unit setSkill ["spotdistance", 0.25];
  22. _unit setSkill ["commanding", 0.1];
  23. _unit setSkill ["reloadSpeed", 0.1];
  24. } else {
  25. if ( _side == GRLIB_side_friendly || _side == GRLIB_side_enemy ) then {
  26. _unit setSkill ["aimingspeed", [ 0.35 * _skillmodifier ] call F_limitSkill];
  27. if ( _inVehicle ) then {
  28. _unit setSkill ["aimingaccuracy", [ 0.65 * _skillmodifier ] call F_limitSkill];
  29. } else {
  30. _unit setSkill ["aimingshake", [ 0.35 * _skillmodifier ] call F_limitSkill];
  31. };
  32. _unit setSkill ["spottime", [ 0.5 * _skillmodifier ] call F_limitSkill];
  33. _unit setSkill ["spotdistance", [ 0.5 * _skillmodifier ] call F_limitSkill];
  34. _unit setSkill ["commanding", 0.5];
  35. _unit setSkill ["reloadSpeed", 0.7];
  36. } else {
  37. _unit setSkill ["aimingspeed", [ 0.35 * _skillmodifier ] call F_limitSkill];
  38. _unit setSkill ["aimingaccuracy", [ 0.25 * _skillmodifier ] call F_limitSkill];
  39. _unit setSkill ["aimingshake", [ 0.35 * _skillmodifier ] call F_limitSkill];
  40. _unit setSkill ["spottime", [ 0.5 * _skillmodifier ] call F_limitSkill];
  41. _unit setSkill ["spotdistance", [ 0.5 * _skillmodifier ] call F_limitSkill];
  42. _unit setSkill ["commanding", 0.5];
  43. _unit setSkill ["reloadSpeed", 0.5];
  44. };
  45. };