jumpHandler.sqf 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. personToApply=_this select 0;
  2. personToApply addEventHandler ["HandleDamage",
  3. {
  4. _namUnit=_this select 0;
  5. _namJumpData=_namUnit getVariable["jumpArray",[false,0,0,5,2]];
  6. _namIsJumping=(_namJumpData)select 0;
  7. _namResult=0;
  8. _namIsToggling=_namUnit getVariable["isTogglingJumpEH",true];
  9. if(_namIsJumping && {isTouchingGround _namUnit} ) then
  10. {
  11. [west, "HQ"] sideChat format["isJumping-- %1 and istouchingGround -->%2 --time %3",_namIsJumping,(isTouchingGround _namUnit),time];
  12. _namResult=0;
  13. _null = _this spawn
  14. {
  15. _namUnitSpawn=_this select 0;
  16. _namJumpDataSpawn=_namUnitSpawn getVariable["jumpArray",[false,0,0,5,2]];
  17. sleep 0.25;
  18. if((_namJumpDataSpawn select 0) && !(isTouchingGround _namUnitSpawn )) then//added measures to ensure u dont die/knock out
  19. {
  20. _namUnitSpawn setVariable ["jumpArray", [true,(_namJumpDataSpawn select 1),(_namJumpDataSpawn select 2),(_namJumpDataSpawn select 3),(_namJumpDataSpawn select 4)],true];
  21. }
  22. else
  23. {
  24. _namUnitSpawn setVariable ["jumpArray", [false,(_namJumpDataSpawn select 1),(_namJumpDataSpawn select 2),(_namJumpDataSpawn select 3),(_namJumpDataSpawn select 4)],true];
  25. };
  26. };
  27. _namResult=0;
  28. }
  29. else
  30. {
  31. if(!(isTouchingGround _namUnit)) then//if ur not touching ground then ur still flying
  32. {
  33. //_namUnitSpawn setVariable ["jumpArray", [true,(_namJumpDataSpawn select 1),(_namJumpDataSpawn select 2),(_namJumpDataSpawn select 3),(_namJumpDataSpawn select 4)],true];
  34. _namResult=0;
  35. }
  36. else
  37. {
  38. _namResult=_this call ACE_medical_fnc_handleDamage;
  39. _namUnit setVariable ["jumpArray", [false,(_namJumpData select 1),(_namJumpData select 2),(_namJumpData select 3),(_namJumpData select 4)],true];
  40. };
  41. };
  42. _namResult
  43. }];