atteBase.sqf 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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=3;
  45. switch(_rexiSelection)do{
  46. case(""):{_rexiOldDamage = damage _rexiUnit;};
  47. default{};
  48. };
  49. rexiReturn = _rexiOldDamage + ((_rexiPassedDamage - _rexiOldDamage) / _rexiDmgScaleFactor);
  50. //_rexiReturn = _rexiOldDamage + ((_rexiPassedDamage ) / _rexiDmgScaleFactor);
  51. if((_rexiReturn+_rexiOldDamage)>1) then
  52. {
  53. _namAtteObjArray=_rexiUnit getVariable "atteObjectsOnIt";
  54. if((count _namAtteObjArray)>0) then
  55. {
  56. {
  57. _x setDammage 1;
  58. } forEach _namAtteObjArray;
  59. _rexiUnit setVariable ["atteObjectsOnIt",[],true];
  60. }
  61. else
  62. {
  63. };
  64. }
  65. else
  66. {
  67. };
  68. _rexiReturn
  69. }];
  70. };//end at-te Base
  71. ["Republic_ATTE", "init",rexiAtteBase, true, [], true] call CBA_fnc_addClassEventHandler;
  72. ["Republic_ATTE", "fired",rexiAtteBulMux] call CBA_fnc_addClassEventHandler;