Advertisement
Guest User

Speedflips 0.1

a guest
Jun 27th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'Speedflips 0.1
  2. 'A Quick Flipper Speedhack by NF
  3.  
  4. 'Needs two triggers around each flipper named TriggerLF and TriggerRF
  5. 'Recommended flipper strength: 5000-6000 @ mass 1
  6. '(Any faster will cause the flipper code to break)
  7. 'the faster the flipper, the more sharp the shots will get.
  8.  
  9. 'Bugs:
  10. 'Triggers can cause stutter if they trigger multiple times very quickly. Haven't seen this happen yet but it's possible
  11.  
  12.  
  13. 'Flippers
  14.  
  15. dim m1, m2, m3, m4
  16.  
  17. 'adjust speed coefficient here
  18. '(Coordinates. x = IN ball velocity, y = OUT ball speed coefficient)
  19. 'x1,    y1,      x2,        y2
  20. m1 = 1 : m2 = 1 : m3 = 220 : m4 = 0
  21.  
  22. dim RFon, LFon : LFon = True : RFon = True
  23. Sub FalloffnF(ThresholdMin, Y1, ThresholdMax, Y2)   'thresholdmin, bounce% #1, thresholdmax, bounce% #2 - falloff between these two points
  24.     dim FinalSpeed
  25.     finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  26.     if finalspeed < ThresholdMin then exit sub  'if ball is below minimum threshold
  27. '   if finalspeed < ThresholdMin then : tb1.text = finalspeed : exit sub  'if ball is below minimum threshold  
  28.  
  29.     Dim SlopeMath, ModElast
  30.     SlopeMath = (Y2 - Y1) / (ThresholdMax - ThresholdMin)
  31.     ModElast = SlopeMath * (FinalSpeed - ThresholdMax) + Y2
  32.  
  33.     if finalspeed > ThresholdMax then ModElast = Y2 'ball is above max threshold
  34.  
  35.     activeball.velx = activeball.velx * ModElast
  36.     activeball.vely = activeball.vely * ModElast
  37. '   playsound "woodhit", 0, 10                                          'debug stuff
  38. '   tbFlipper.text = ModElast & " slope?:" & slopemath & vbnewline & _
  39. '             finalspeed & "-> " & SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  40. '   TBflipper.TimerEnabled = 1
  41. End Sub
  42. Sub TBflipper_Timer() : me.timerenabled = 0 : me.text = "..." : End Sub 'clear debug box
  43.  
  44. leftflipper.eostorque = (2175/leftflipper.strength) : rightflipper.eostorque = leftflipper.eostorque
  45.  
  46. TriggerLF.TimerInterval = 32 : TriggerRF.TimerInterval = 32
  47. Sub TriggerLF_Timer(): LFon = False : me.TimerEnabled = 0 : End Sub
  48. Sub TriggerLF_UnHit(): if LFon then FalloffnF m1, m2, m3, m4 End If : End Sub
  49. Sub TriggerRF_Timer(): RFon = False : me.TimerEnabled = 0 : End Sub
  50. Sub TriggerRF_UnHit(): if RFon then FalloffnF m1, m2, m3, m4 End If : End Sub
  51.  
  52. 'Modify your flipper subs to add these two lines...
  53.  
  54. Sub SolLFlipper(Enabled)
  55.     If Enabled Then
  56.         PlaySound SoundFX("fx_FlipperUp",DOFContactors), 0, LVL(0.5), -0.1, 0.1
  57.         LeftFlipper.RotateToEnd
  58.         TriggerLF.TimerEnabled = 1  'speed hack
  59.         LFon = True                 'speed hack
  60.     Else
  61.         PlaySound SoundFX("fx_FlipperDown",DOFContactors), 0, LVL(0.5), -0.1, 0.1
  62.         LeftFlipper.RotateToStart
  63.     End If
  64. End Sub
  65.  
  66. Sub SolRFlipper(Enabled)
  67.     If Enabled Then
  68.         PlaySound SoundFX("fx_FlipperUp",DOFContactors), 0, LVL(0.3), 0.1, 0.1
  69.         RightFlipper.RotateToEnd
  70.         TriggerRF.TimerEnabled = 1      'speed hack
  71.         RFon = True                     'speed hack
  72.     Else
  73.         PlaySound SoundFX("fx_FlipperDown",DOFContactors), 0, LVL(0.3), 0.1, 0.1
  74.         RightFlipper.RotateToStart
  75.     End If
  76. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement