Advertisement
Guest User

Untitled

a guest
May 16th, 2017
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.65 KB | None | 0 0
  1. #include "\A3XAI\globaldefines.hpp"
  2.  
  3. private["_object","_hit","_damage","_source","_ammo","_hitPartIndex","_hitPoint"];
  4.  
  5. _object =       _this select 0;             //Object the event handler is assigned to. (the unit taking damage)
  6. _hit =          _this select 1;             //Name of the selection where the unit was damaged. "" for over-all structural damage, "?" for unknown selections.
  7. _damage =       _this select 2;             //Resulting level of damage for the selection. (Received damage)
  8. _source =       _this select 3;             //The source unit that caused the damage.
  9. _ammo =         _this select 4;             //Classname of the projectile that caused inflicted the damage. ("" for unknown, such as falling damage.)
  10. _hitPartIndex = _this select 5;             //Hit part index of the hit point, -1 otherwise.
  11.  
  12. _object allowDamage true;
  13. _object removeAllEventHandlers 'HandleDamage';
  14.  
  15. _hitPoint = (_object getHitIndex _hitPartIndex);
  16. if (_damage > _hitPoint) then {
  17.     call {
  18.         if (isNull _source) exitWith {_damage = _hitPoint;};                                //No physics damage
  19.         if ((group _object) call A3XAI_getNoAggroStatus) exitWith {_damage = _hitPoint;};   //No damage from any source when non-hostile
  20.         if ((side _source) isEqualTo A3XAI_side) exitWith {_damage = _hitPoint;};           //No damage from units on same side
  21.         if ((!isNull (objectParent _source)) && {_ammo isEqualTo ""}) then {                //No damage if source is a vehicle and damage has no ammo (vehicle collision)
  22.             call {
  23.                 if (A3XAI_noCollisionDamage) exitWith {_damage = _hitPoint;};
  24.                 if ((_damage >= 0.9) && {_hit in ["","body","head"]} && {_hitPartIndex > -1}) exitWith {_object setVariable ["CollisionKilled",A3XAI_roadKillPenalty];};
  25.             };
  26.         };
  27.     };
  28. };
  29.  
  30. _damage
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement