Advertisement
ArcheKruz

For Hellser (Redux)

Nov 30th, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.37 KB | None | 0 0
  1. // Lines to add to Decorate
  2.  
  3. Select:
  4. TNT1 A 0 ACS_ExecuteAlways(800,0,###) // Set the WeaponID with digits corresponding to
  5. // SlotNumber|TierNumber|VarNumber
  6. SPRI A 1 A_Raise
  7. Goto Select+1
  8. .
  9. .
  10. .
  11. Fire:
  12. .
  13. .
  14. .
  15. SPRF A 0 ACS_ExecuteAlways(840,0,x,y,z) // Call this when the weapon fires, it's for the recoil.
  16. . // x = Strength, y = Recoil Time, z = Recov Time
  17. . // 6,3,8 = 768 ±64 Recoil that kicks up in 3 tics,
  18. . // with a 16 tic recovery.
  19.  
  20. // Define Script names to numbers
  21.  
  22. #define SET_WEAPONID 800
  23. #define CALL_RECOV_RATIO 820
  24. #define RECOIL_ICD 840
  25. #define PLAYER_MAX 64
  26.  
  27. // Global Vars to add in ACS
  28. int WeaponID[PLAYER_MAX];
  29.  
  30. int RecoilRecoveryRatios[8][4][5] = // Set these values to > 1 if you want the recovery to be greater
  31. { // than the recoil, and < 1 for the opposite effect.
  32. {
  33. { 1.0,1.0,1.0,1.0,1.0,}, // Slot 1
  34. { 1.0,1.0,1.0,1.0,1.0,},
  35. { 1.0,1.0,1.0,1.0,1.0,},
  36. { 1.0,1.0,1.0,1.0,1.0,},
  37. },
  38. {
  39. { 1.0,1.0,1.0,1.0,1.0,}, // Slot 2
  40. { 1.0,1.0,1.0,1.0,1.0,},
  41. { 1.0,1.0,1.0,1.0,1.0,},
  42. { 1.0,1.0,1.0,1.0,1.0,},
  43. },
  44. {
  45. { 1.0,1.0,1.0,1.0,1.0,}, // Slot 3
  46. { 1.0,1.0,1.0,1.0,1.0,},
  47. { 1.0,1.0,1.0,1.0,1.0,},
  48. { 1.0,1.0,1.0,1.0,1.0,},
  49. },
  50. {
  51. { 1.0,1.0,1.0,1.0,1.0,}, // Slot 4
  52. { 1.0,1.0,1.0,1.0,1.0,},
  53. { 1.0,1.0,1.0,1.0,1.0,},
  54. { 1.0,1.0,1.0,1.0,1.0,},
  55. },
  56. {
  57. { 1.0,1.0,1.0,1.0,1.0,}, // Slot 5
  58. { 1.0,1.0,1.0,1.0,1.0,},
  59. { 1.0,1.0,1.0,1.0,1.0,},
  60. { 1.0,1.0,1.0,1.0,1.0,},
  61. },
  62. {
  63. { 1.0,1.0,1.0,1.0,1.0,}, // Slot 6
  64. { 1.0,1.0,1.0,1.0,1.0,},
  65. { 1.0,1.0,1.0,1.0,1.0,},
  66. { 1.0,1.0,1.0,1.0,1.0,},
  67. },
  68. {
  69. { 1.0,1.0,1.0,1.0,1.0,}, // Slot 7
  70. { 1.0,1.0,1.0,1.0,1.0,},
  71. { 1.0,1.0,1.0,1.0,1.0,},
  72. { 1.0,1.0,1.0,1.0,1.0,},
  73. },
  74. {
  75. { 1.0,1.0,1.0,1.0,1.0,}, // Slot 8
  76. { 1.0,1.0,1.0,1.0,1.0,},
  77. { 1.0,1.0,1.0,1.0,1.0,},
  78. { 1.0,1.0,1.0,1.0,1.0,},
  79. }
  80. };
  81.  
  82. // The Actual Script
  83.  
  84. script SET_WEAPONID (int x)
  85. {
  86. WeaponID[PlayerNumber()] = x;
  87. }
  88.  
  89. script CALL_RECOV_RATIO (void) // This retrieves the value from the array.
  90. {
  91. int SlotNumber = (WeaponID[PlayerNumber()] / 100) - 1;
  92. int TierNumber = ((WeaponID[PlayerNumber()] % 100) / 10) - 1;
  93. int VarNumber = (WeaponID[PlayerNumber()] % 10) - 1;
  94. SetResultValue(RecoilRecoveryRatios[SlotNumber][TierNumber][VarNumber]);
  95. }
  96.  
  97. /* The main recoil script */
  98. script RECOIL_ICD (int Amplitude, int TransLength, int DecayLength) clientside
  99. {
  100. int RecPitch = (Amplitude * 128) + Random(-64,64);
  101. int SubPitch = 0;
  102. int ModPitch = 0;
  103. int PTDivisor = RecPitch * 2 / (TransLength * (TransLength + 1));
  104. int PTMod = RecPitch * 2 % (TransLength * (TransLength + 1));
  105. int DecRecov = ACS_ExecuteWithResult(820);
  106. int DecPitch = (RecPitch * DecRecov) >> 16;
  107. int PRDivisor = DecPitch / (DecayLength * (DecayLength + 1));
  108. int PRMod = DecPitch % (DecayLength * (DecayLength + 1));
  109. // int ActualDecay = 0; // For Debugging
  110. // int ActualPitch = 0; // For Debugging
  111.  
  112. for (int a = 0; a < TransLength; a++) // Recoil Transient
  113. {
  114. ModPitch += (PTMod * (TransLength - a));
  115. SubPitch = ModPitch / (TransLength * (TransLength + 1));
  116. ModPitch = ModPitch % (TransLength * (TransLength + 1));
  117. SetActorPitch(0, GetActorPitch(0) - (PTDivisor * (TransLength - a) + SubPitch));
  118. // ActualPitch += (PTDivisor * (TransLength - a) + SubPitch); // For Debugging
  119. SubPitch = 0;
  120. Delay(1);
  121. }
  122. Delay(1);
  123. for (int b = 0; b < DecayLength; b++) // Recovery.
  124. {
  125. ModPitch += (PRMod * (b + 1));
  126. SubPitch = ModPitch / (DecayLength * (DecayLength + 1));
  127. ModPitch = ModPitch % (DecayLength * (DecayLength + 1));
  128. SetActorPitch(0, GetActorPitch(0) + (PRDivisor * (b + 1) + SubPitch));
  129. // ActualDecay += (PRDivisor * (b + 1) + SubPitch); // For Debugging
  130. SubPitch = 0;
  131. Delay(1);
  132. }
  133. for (int c = 0; c < DecayLength; c++)
  134. {
  135. ModPitch += (PRMod * (DecayLength - c));
  136. SubPitch = ModPitch / (DecayLength * (DecayLength + 1));
  137. ModPitch = ModPitch % (DecayLength * (DecayLength + 1));
  138. SetActorPitch(0, GetActorPitch(0) + (PRDivisor * (DecayLength - c) + SubPitch));
  139. // ActualDecay += (PRDivisor * (DecayLength - c) + SubPitch); // For Debugging
  140. SubPitch = 0;
  141. Delay(1);
  142. }
  143. /* For Debugging */
  144. // Hudmessage(s:"Recoil : ", i:RecPitch, s:" (", i:ActualPitch, s:") , Decay : ", i:DecPitch, s:" (", i:ActualDecay, s:")";
  145. // HUDMSG_FADEOUT,1,CR_WHITE,0.5,0.9,1.0,1.0);
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement