jumpLong.sqf 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //Params["personToApply"];
  2. personToApply=_this select 0;
  3. personToApply addAction ["<t color='#00FF00'>Long Jump--------U14</t>",
  4. {
  5. _namUnit=_this select 0;
  6. _jumpResult = compile preprocessFile "scripts\zeus3denScripts\playerBased\airborne\HJS Protocal\jumpDecider.sqf";
  7. _jumpDecision = [_namUnit] call _jumpResult;
  8. if(_jumpDecision) then
  9. {
  10. comment "data from jump array";
  11. comment "is Jumping-0
  12. last jump time-1
  13. jump counter-2
  14. cooldown-3
  15. max consecutive jumps-4
  16. !C or (!A and B)";
  17. _namThisJumpData=_namUnit getVariable["jumpArray",[false,0,0,5,2]];
  18. _namJumpPhysicsArray=_namUnit getVariable["jumpPhysicsArray",[[5,5],[20,40],[1,40]]];
  19. _namSpeed=(_namJumpPhysicsArray select 1) select 0;
  20. _namSpeedUp=(_namJumpPhysicsArray select 1) select 1;
  21. comment "initiate jump";
  22. (_namUnit) setVelocity
  23. [
  24. ((vectordir (_namUnit)) select 0)*_namSpeed,
  25. ((vectordir (_namUnit)) select 1)*_namSpeed,
  26. (velocity (_namUnit) select 2)+_namSpeedUp
  27. ];
  28. comment "update variables";
  29. //variables are (isJumping),(last jump time),(jump counter),(cooldown),(max consecutive jumps)
  30. _namUnit setVariable ["jumpArray", [true,time,(_namThisJumpData select 2)+1,_namThisJumpData select 3,_namThisJumpData select 4],true];
  31. };
  32. }
  33. ,[1],0,false,true,"User14"," driver _target == _this"];