atteBase.sqf 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. //----------
  2. //Now this file is called in the init.sqf. Thus whenever the the atteTypeSelector is executed and the at-te from there is spawned,this is ran
  3. //Function that makes at-te gun do more dmg
  4. rexiAtteBulMux={
  5. _rexiUnit = (_this select 0);
  6. _rexiProjType = _this select 4;
  7. _rexiProjectile = _this select 6;
  8. _rexiUp = vectorUp _rexiProjectile;
  9. _rexiProjPos = getPosASL _rexiProjectile;
  10. _RexiDist=1;
  11. for "_i" from 1 to 4 do {
  12. _rexiO = _rexiProjType createVehicle _rexiProjPos;
  13. _rexiO setPosASL [
  14. (_rexiProjPos select 0) + ((vectorDir _rexiUnit) select 0)*(_RexiDist),
  15. (_rexiProjPos select 1) + ((vectorDir _rexiUnit) select 1)*(_RexiDist),
  16. (_rexiProjPos select 2) + ((vectorDir _rexiUnit) select 2)*(_RexiDist)
  17. ];
  18. _rexiO setVectorDirAndUp[(vectorDir _rexiUnit),_rexiUp];
  19. _rexiO setVelocity velocity _rexiProjectile;
  20. };
  21. };//end at-te bul mux
  22. //general script
  23. rexiAtteBase={
  24. params["_vic"];
  25. _rexiHasBeenModded= _vic getVariable ["modded", false];
  26. //adds the ability to check how much dmg the at-te has taken
  27. _vic addAction ["<t color='#00FF00'>Hull Damage Report</t>",
  28. {
  29. hint parseText format["<t color='#0099FF'> Hull Integrity is :%1%2</t>",((1-(damage (_this select 0)))*100),"%"];
  30. },[1],0,false,true,""," commander _target == _this "];
  31. _vic removeAllEventHandlers "Fired";
  32. //ads repair function
  33. _vic addAction ["<t color='#FC6F07'>Repair</t>",
  34. {
  35. [_this select 0] execVM "scripts\zeus3denScripts\vehicleBased\actionMenu\Repair\repairTo65.sqf";
  36. }];
  37. //handles reducing dmg taken by at-te
  38. _vic addeventhandler ["HandleDamage",
  39. {
  40. _rexiUnit = _this select 0;
  41. _rexiSelection = _this select 1;
  42. _rexiPassedDamage = _this select 2;
  43. _rexiOldDamage = 0;
  44. _rexiDmgScaleFactor=5;
  45. switch(_rexiSelection)do{
  46. case(""):{_rexiOldDamage = damage _rexiUnit;};
  47. default{};
  48. };
  49. _rexiReturn = _rexiOldDamage + ((_rexiPassedDamage - _rexiOldDamage) / _rexiDmgScaleFactor);
  50. _rexiReturn
  51. }];
  52. };//end at-te Base
  53. //Add repair ability to turrets and makes it so that they cant die 100%,just disabled
  54. UAVT={
  55. params["_vic"];
  56. comment "ADDS REPAIR";
  57. _vic addAction ["<t color='#47FF1A'>Repair</t>",
  58. {[_this select 0] execVM "scripts\zeus3denScripts\vehicleBased\actionMenu\Repair\repair.sqf";}];
  59. _vic addEventHandler ["HandleDamage", {
  60. _damage = _this select 2;
  61. if ( (_this select 1 == "") and (_damage > 0.9999) ) then { _damage = 0.9999 };
  62. _damage;
  63. }];
  64. };
  65. ["B_HMG_01_A_F", "init",UAVT, true, [], true] call CBA_fnc_addClassEventHandler;
  66. ["Republic_ATTE", "init",rexiAtteBase, true, [], true] call CBA_fnc_addClassEventHandler;
  67. ["Republic_ATTE", "fired",rexiAtteBulMux] call CBA_fnc_addClassEventHandler;