Advertisement
Outhere

Friday the 13th JP's wip38

Dec 17th, 2021
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 139.32 KB | None | 0 0
  1. ' ****************************************************************
  2. ' JP's Friday the 13th for VISUAL PINBALL X 10.7
  3. ' Including JP's Arcade Physics 3.0.1
  4. ' ****************************************************************
  5.  
  6. 'On the DOF website put Exxx
  7. 'DOF commands:
  8. '101 Left Flipper
  9. '102 Right Flipper
  10. '103 left slingshot
  11. '104 right slingshot
  12. '105
  13. '106
  14. '107
  15. '108 RIGHT Bumper
  16. '109
  17. '110
  18. '111 Scoop
  19. '118
  20. '119
  21. '120 AutoFire
  22. '122 knocker
  23. '123 ballrelease
  24.  
  25. Option Explicit
  26. Randomize
  27.  
  28. Const BallSize = 50 ' 50 is the normal size used in the core.vbs, VP kicker routines uses this value divided by 2
  29. Const BallMass = 1.7 ' standard ball mass in JP's VPX Physics 3.0
  30. Const SongVolume = 0.3 ' 1 is full volume, but I set it quite low to listen better the other sounds since I use headphones, adjust to your setup :)
  31.  
  32. 'FlexDMD in high or normal quality
  33. 'change it to True if you have an LCD screen, 256x64
  34. 'or keep it False if you have a real DMD at 128x32 in size
  35. Const FlexDMDHighQuality = False
  36.  
  37. ' Load the core.vbs for supporting Subs and functions
  38. LoadCoreFiles
  39.  
  40. Sub LoadCoreFiles
  41. On Error Resume Next
  42. ExecuteGlobal GetTextFile("core.vbs")
  43. If Err Then MsgBox "Can't open core.vbs"
  44. ExecuteGlobal GetTextFile("controller.vbs")
  45. If Err Then MsgBox "Can't open controller.vbs"
  46. On Error Goto 0
  47. End Sub
  48.  
  49. ' Define any Constants
  50. Const cGameName = "jpsfriday13th"
  51. Const myVersion = "0.38"
  52. Const MaxPlayers = 4 ' from 1 to 4
  53. Const BallSaverTime = 10 ' in seconds of the first ball
  54. Const MaxMultiplier = 5 ' limit playfield multiplier
  55. Const MaxBonusMultiplier = 9 'limit Bonus multiplier
  56. Const BallsPerGame = 3 ' usually 3 or 5
  57. Const MaxMultiballs = 13 ' max number of balls during multiballs
  58.  
  59. ' Use FlexDMD if in FS mode
  60. Dim UseFlexDMD
  61. If Table1.ShowDT = True then
  62. UseFlexDMD = False
  63. Else
  64. UseFlexDMD = True
  65. End If
  66.  
  67. ' Define Global Variables
  68. Dim PlayersPlayingGame
  69. Dim CurrentPlayer
  70. Dim Credits
  71. Dim BonusPoints(4)
  72. Dim BonusHeldPoints(4)
  73. Dim BonusMultiplier(4)
  74. Dim PlayfieldMultiplier(4)
  75. Dim PFxSeconds
  76. Dim bBonusHeld
  77. Dim BallsRemaining(4)
  78. Dim ExtraBallsAwards(4)
  79. Dim Score(4)
  80. Dim HighScore(4)
  81. Dim HighScoreName(4)
  82. Dim Jackpot(4)
  83. Dim SuperJackpot(4)
  84. Dim Tilt
  85. Dim TiltSensitivity
  86. Dim Tilted
  87. Dim TotalGamesPlayed
  88. Dim mBalls2Eject
  89. Dim SkillshotValue(4)
  90. Dim SuperSkillshotValue(4)
  91. Dim bAutoPlunger
  92. Dim bInstantInfo
  93. Dim bAttractMode
  94. Dim x
  95.  
  96. ' Define Game Control Variables
  97. Dim LastSwitchHit
  98. Dim BallsOnPlayfield
  99. Dim BallsInLock(4)
  100. Dim BallsInHole
  101.  
  102. ' Define Game Flags
  103. Dim bFreePlay
  104. Dim bGameInPlay
  105. Dim bOnTheFirstBall
  106. Dim bBallInPlungerLane
  107. Dim bBallSaverActive
  108. Dim bBallSaverReady
  109. Dim bMultiBallMode
  110. Dim bMusicOn
  111. Dim bSkillshotReady
  112. Dim bExtraBallWonThisBall
  113. Dim bJackpot
  114.  
  115. ' core.vbs variables
  116. Dim plungerIM 'used mostly as an autofire plunger during multiballs
  117. Dim mMagnet
  118.  
  119. ' *********************************************************************
  120. ' Visual Pinball Defined Script Events
  121. ' *********************************************************************
  122.  
  123. Sub Table1_Init()
  124. LoadEM
  125. Dim i
  126. Randomize
  127.  
  128. 'Impulse Plunger as autoplunger
  129. Const IMPowerSetting = 45 ' Plunger Power
  130. Const IMTime = 0.5 ' Time in seconds for Full Plunge
  131. Set plungerIM = New cvpmImpulseP
  132. With plungerIM
  133. .InitImpulseP swplunger, IMPowerSetting, IMTime
  134. .Random 1.5
  135. .InitExitSnd SoundFXDOF("fx_kicker", 141, DOFPulse, DOFContactors), SoundFXDOF("fx_solenoid", 141, DOFPulse, DOFContactors)
  136. .CreateEvents "plungerIM"
  137. End With
  138.  
  139. ' Magnet
  140. Set mMagnet = New cvpmMagnet
  141. With mMagnet
  142. .InitMagnet Magnet, 35
  143. .GrabCenter = True
  144. .CreateEvents "mMagnet"
  145. End With
  146.  
  147. ' Misc. VP table objects Initialisation, droptargets, animations...
  148. VPObjects_Init
  149.  
  150. ' load saved values, highscore, names, jackpot
  151. Credits = 0
  152. Loadhs
  153.  
  154. ' Initalise the DMD display
  155. DMD_Init
  156.  
  157. ' freeplay or coins
  158. bFreePlay = False 'we want coins
  159.  
  160. if bFreePlay Then DOF 125, DOFOn
  161.  
  162. ' Init main variables and any other flags
  163. bAttractMode = False
  164. bOnTheFirstBall = False
  165. bBallInPlungerLane = False
  166. bBallSaverActive = False
  167. bBallSaverReady = False
  168. bMultiBallMode = False
  169. PFxSeconds = 0
  170. bGameInPlay = False
  171. bAutoPlunger = False
  172. bMusicOn = True
  173. BallsOnPlayfield = 0
  174. BallsInHole = 0
  175. LastSwitchHit = ""
  176. Tilt = 0
  177. TiltSensitivity = 6
  178. Tilted = False
  179. bBonusHeld = False
  180. bJackpot = False
  181. bInstantInfo = False
  182. ' set any lights for the attract mode
  183. GiOff
  184. StartAttractMode
  185.  
  186. ' Start the RealTime timer
  187. RealTime.Enabled = 1
  188.  
  189. ' Load table color
  190. LoadLut
  191. End Sub
  192.  
  193. '******
  194. ' Keys
  195. '******
  196.  
  197. Sub Table1_KeyDown(ByVal Keycode)
  198.  
  199. If keycode = LeftTiltKey Then Nudge 90, 8:PlaySound "fx_nudge", 0, 1, -0.1, 0.25
  200. If keycode = RightTiltKey Then Nudge 270, 8:PlaySound "fx_nudge", 0, 1, 0.1, 0.25
  201. If keycode = CenterTiltKey Then Nudge 0, 9:PlaySound "fx_nudge", 0, 1, 1, 0.25
  202.  
  203. If keycode = LeftMagnaSave Then bLutActive = True
  204. If keycode = RightMagnaSave Then
  205. If bLutActive Then
  206. NextLUT
  207. End If
  208. End If
  209.  
  210. If Keycode = AddCreditKey Then
  211. Credits = Credits + 1
  212. if bFreePlay = False Then DOF 125, DOFOn
  213. If(Tilted = False) Then
  214. DMDFlush
  215. DMD "", CL("CREDITS " & Credits), "", eNone, eNone, eNone, 500, True, "fx_coin"
  216. If NOT bGameInPlay Then ShowTableInfo
  217. End If
  218. End If
  219.  
  220. If keycode = PlungerKey Then
  221. Plunger.Pullback
  222. PlaySoundAt "fx_plungerpull", plunger
  223. End If
  224.  
  225. If hsbModeActive Then
  226. EnterHighScoreKey(keycode)
  227. Exit Sub
  228. End If
  229.  
  230. ' Normal flipper action
  231.  
  232. If bGameInPlay AND NOT Tilted Then
  233.  
  234. If keycode = LeftTiltKey Then CheckTilt 'only check the tilt during game
  235. If keycode = RightTiltKey Then CheckTilt
  236. If keycode = CenterTiltKey Then CheckTilt
  237.  
  238. If keycode = LeftFlipperKey Then SolLFlipper 1:InstantInfoTimer.Enabled = True:RotateLaneLights 1
  239. If keycode = RightFlipperKey Then SolRFlipper 1:InstantInfoTimer.Enabled = True:RotateLaneLights 0
  240.  
  241. If keycode = StartGameKey Then
  242. If((PlayersPlayingGame < MaxPlayers) AND(bOnTheFirstBall = True) ) Then
  243.  
  244. If(bFreePlay = True) Then
  245. PlayersPlayingGame = PlayersPlayingGame + 1
  246. TotalGamesPlayed = TotalGamesPlayed + 1
  247. DMD "_", CL(PlayersPlayingGame & " PLAYERS"), "", eNone, eBlink, eNone, 1000, True, ""
  248. Else
  249. If(Credits > 0) then
  250. PlayersPlayingGame = PlayersPlayingGame + 1
  251. TotalGamesPlayed = TotalGamesPlayed + 1
  252. Credits = Credits - 1
  253. DMD "_", CL(PlayersPlayingGame & " PLAYERS"), "", eNone, eBlink, eNone, 1000, True, ""
  254. If Credits < 1 And bFreePlay = False Then DOF 125, DOFOff
  255. Else
  256. ' Not Enough Credits to start a game.
  257. DMD CL("CREDITS " & Credits), CL("INSERT COIN"), "", eNone, eBlink, eNone, 1000, True, "vo_givemeyourmoney"
  258. End If
  259. End If
  260. End If
  261. End If
  262. Else ' If (GameInPlay)
  263.  
  264. If keycode = StartGameKey Then
  265. If(bFreePlay = True) Then
  266. If(BallsOnPlayfield = 0) Then
  267. ResetForNewGame()
  268. End If
  269. Else
  270. If(Credits > 0) Then
  271. If(BallsOnPlayfield = 0) Then
  272. Credits = Credits - 1
  273. If Credits < 1 And bFreePlay = False Then DOF 125, DOFOff
  274. ResetForNewGame()
  275. End If
  276. Else
  277. ' Not Enough Credits to start a game.
  278. DMDFlush
  279. DMD CL("CREDITS " & Credits), CL("INSERT COIN"), "", eNone, eBlink, eNone, 1000, True, "vo_givemeyourmoney"
  280. ShowTableInfo
  281. End If
  282. End If
  283. End If
  284. End If ' If (GameInPlay)
  285. End Sub
  286.  
  287. Sub Table1_KeyUp(ByVal keycode)
  288.  
  289. If keycode = LeftMagnaSave Then bLutActive = False
  290.  
  291. If keycode = PlungerKey Then
  292. Plunger.Fire
  293. PlaySoundAt "fx_plunger", plunger
  294. End If
  295.  
  296. If hsbModeActive Then
  297. Exit Sub
  298. End If
  299.  
  300. ' Table specific
  301.  
  302. If bGameInPLay AND NOT Tilted Then
  303. If keycode = LeftFlipperKey Then
  304. SolLFlipper 0
  305. InstantInfoTimer.Enabled = False
  306. If bInstantInfo Then
  307. DMDScoreNow
  308. bInstantInfo = False
  309. End If
  310. End If
  311. If keycode = RightFlipperKey Then
  312. SolRFlipper 0
  313. InstantInfoTimer.Enabled = False
  314. If bInstantInfo Then
  315. DMDScoreNow
  316. bInstantInfo = False
  317. End If
  318. End If
  319. End If
  320. End Sub
  321.  
  322. Sub InstantInfoTimer_Timer
  323. InstantInfoTimer.Enabled = False
  324. If NOT hsbModeActive Then
  325. bInstantInfo = True
  326. DMDFlush
  327. InstantInfo
  328. End If
  329. End Sub
  330.  
  331. '*************
  332. ' Pause Table
  333. '*************
  334.  
  335. Sub table1_Paused
  336. End Sub
  337.  
  338. Sub table1_unPaused
  339. End Sub
  340.  
  341. Sub Table1_Exit
  342. Savehs
  343. If UseFlexDMD Then FlexDMD.Run = False
  344. If B2SOn = true Then Controller.Stop
  345. End Sub
  346.  
  347. '********************
  348. ' Flippers
  349. '********************
  350.  
  351. Sub SolLFlipper(Enabled)
  352. If Enabled Then
  353. PlaySoundAt SoundFXDOF("fx_flipperup", 101, DOFOn, DOFFlippers), LeftFlipper
  354. LeftFlipper.EOSTorque = 0.75:LeftFlipper.RotateToEnd
  355. LeftFlipper001.EOSTorque = 0.75:LeftFlipper001.RotateToEnd
  356. LeftSplat
  357. Else
  358. PlaySoundAt SoundFXDOF("fx_flipperdown", 101, DOFOff, DOFFlippers), LeftFlipper
  359. LeftFlipper.EOSTorque = 0.2:LeftFlipper.RotateToStart
  360. LeftFlipper001.EOSTorque = 0.2:LeftFlipper001.RotateToStart
  361. End If
  362. End Sub
  363.  
  364. Sub SolRFlipper(Enabled)
  365. If Enabled Then
  366. PlaySoundAt SoundFXDOF("fx_flipperup", 102, DOFOn, DOFFlippers), RightFlipper
  367. RightFlipper.EOSTorque = 0.75:RightFlipper.RotateToEnd
  368. RightSplat
  369. Else
  370. PlaySoundAt SoundFXDOF("fx_flipperdown", 102, DOFOff, DOFFlippers), RightFlipper
  371. RightFlipper.EOSTorque = 0.2:RightFlipper.RotateToStart
  372. End If
  373. End Sub
  374.  
  375. ' flippers hit Sound
  376.  
  377. Sub LeftFlipper_Collide(parm)
  378. PlaySound "fx_rubber_flipper", 0, parm / 60, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  379. End Sub
  380.  
  381. Sub LeftFlipper001_Collide(parm)
  382. PlaySound "fx_rubber_flipper", 0, parm / 60, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  383. End Sub
  384.  
  385. Sub RightFlipper_Collide(parm)
  386. PlaySound "fx_rubber_flipper", 0, parm / 60, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  387. End Sub
  388.  
  389. Dim RSplat, LSplat
  390.  
  391. Sub RightSplat
  392. RSplat = 0
  393. Rightblood_Timer
  394. End Sub
  395.  
  396. Sub Rightblood_Timer
  397. Select Case RSplat
  398. Case 0:Rightblood.ImageA = "blood1":Rightblood.Visible = 1:Rightblood.TimerEnabled = 1
  399. Case 1:Rightblood.ImageA = "blood2"
  400. Case 2:Rightblood.ImageA = "blood3"
  401. Case 3:Rightblood.ImageA = "blood4"
  402. Case 4:Rightblood.ImageA = "blood5"
  403. Case 5:Rightblood.ImageA = "blood6"
  404. Case 6:Rightblood.Visible = 0:Rightblood.TimerEnabled = 0
  405. End Select
  406. RSplat = RSplat + 1
  407. End Sub
  408.  
  409. Sub LeftSplat
  410. LSplat = 0
  411. Leftblood_Timer
  412. End Sub
  413.  
  414. Sub Leftblood_Timer
  415. Select Case LSplat
  416. Case 0:Leftblood.ImageA = "blood1a":Leftblood.Visible = 1:Leftblood.TimerEnabled = 1
  417. Case 1:Leftblood.ImageA = "blood2a"
  418. Case 2:Leftblood.ImageA = "blood3a"
  419. Case 3:Leftblood.ImageA = "blood4a"
  420. Case 4:Leftblood.ImageA = "blood5a"
  421. Case 5:Leftblood.ImageA = "blood6a"
  422. Case 6:Leftblood.Visible = 0:Leftblood.TimerEnabled = 0
  423. End Select
  424. LSplat = LSplat + 1
  425. End Sub
  426.  
  427. '*********
  428. ' TILT
  429. '*********
  430.  
  431. 'NOTE: The TiltDecreaseTimer Subtracts .01 from the "Tilt" variable every round
  432.  
  433. Sub CheckTilt 'Called when table is nudged
  434. Tilt = Tilt + TiltSensitivity 'Add to tilt count
  435. TiltDecreaseTimer.Enabled = True
  436. If(Tilt > TiltSensitivity) AND(Tilt < 15) Then 'show a warning
  437. DMD "_", CL("CAREFUL"), "_", eNone, eBlinkFast, eNone, 1000, True, ""
  438. End if
  439. If Tilt > 15 Then 'If more that 15 then TILT the table
  440. 'display Tilt
  441. DMDFlush
  442. DMD CL("YOU"), CL("TILTED"), "", eNone, eNone, eNone, 200, False, "vo_yousuck" &RndNbr(5)
  443. DisableTable True
  444. TiltRecoveryTimer.Enabled = True 'start the Tilt delay to check for all the balls to be drained
  445. End If
  446. End Sub
  447.  
  448. Sub TiltDecreaseTimer_Timer
  449. ' DecreaseTilt
  450. If Tilt > 0 Then
  451. Tilt = Tilt - 0.1
  452. Else
  453. TiltDecreaseTimer.Enabled = False
  454. End If
  455. End Sub
  456.  
  457. Sub DisableTable(Enabled)
  458. If Enabled Then
  459. Tilted = True
  460. 'turn off GI and turn off all the lights
  461. GiOff
  462. LightSeqTilt.Play SeqAllOff
  463. 'Disable slings, bumpers etc
  464. LeftFlipper.RotateToStart
  465. LeftFlipper001.RotateToStart
  466. RightFlipper.RotateToStart
  467. Bumper1.Threshold = 100
  468. 'Bumper2.Threshold = 100
  469. 'Bumper3.Threshold = 100
  470. LeftSlingshot.Disabled = 1
  471. RightSlingshot.Disabled = 1
  472. Else
  473. Tilted = False
  474. 'turn back on GI and the lights
  475. GiOn
  476. LightSeqTilt.StopPlay
  477. Bumper1.Threshold = 1
  478. 'Bumper2.Threshold = 1
  479. 'Bumper3.Threshold = 1
  480. LeftSlingshot.Disabled = 0
  481. RightSlingshot.Disabled = 0
  482. 'clean up the buffer display
  483. DMDFlush
  484. End If
  485. End Sub
  486.  
  487. Sub TiltRecoveryTimer_Timer()
  488. ' if all the balls have been drained then..
  489. If(BallsOnPlayfield = 0) Then
  490. ' do the normal end of ball thing (this doesn't give a bonus if the table is tilted)
  491. vpmtimer.Addtimer 2000, "EndOfBall() '"
  492. TiltRecoveryTimer.Enabled = False
  493. End If
  494. ' else retry (checks again in another second or so)
  495. End Sub
  496.  
  497. '*****************************************
  498. ' Music as wav sounds
  499. ' in VPX 10.7 you may use also mp3 or ogg
  500. '*****************************************
  501.  
  502. Dim Song
  503. Song = ""
  504.  
  505. Sub PlaySong(name)
  506. If bMusicOn Then
  507. If Song <> name Then
  508. StopSound Song
  509. Song = name
  510. PlaySound Song, -1, SongVolume
  511. End If
  512. End If
  513. End Sub
  514.  
  515. Sub ChangeSong
  516. If bMultiBallMode Then
  517. PlaySong "mu_multiball" &RndNbr(2)
  518. Else
  519. If Mode(CurrentPLayer, 0) = 0 Then
  520. PlaySong "mu_main" &Balls
  521. Else
  522. PlaySong "mu_pursuit"
  523. End If
  524. End If
  525. End Sub
  526.  
  527. Sub StopSong(name)
  528. StopSound name
  529. End Sub
  530.  
  531. '********************
  532. ' Play random quotes
  533. '********************
  534.  
  535. Sub PlayQuote 'Jason's mom
  536. PlaySound "vo_mother" &RndNbr(45)
  537. End Sub
  538.  
  539. Sub PlayEndQuote
  540. Select Case RndNbr(10)
  541. Case 1:PlaySound "vo_hahaha1"
  542. Case 2:PlaySound "vo_hahaha2"
  543. Case 3:PlaySound "vo_hahaha3"
  544. Case 4:PlaySound "vo_hahaha4"
  545. Case 5:PlaySound "vo_hastalaviatababy"
  546. Case 6:PlaySound "vo_hastalaviatababy2"
  547. Case 7:PlaySound "vo_Illbeback"
  548. Case 8:PlaySound "vo_itstimetodie"
  549. Case 9:PlaySound "vo_youneedflipperskills"
  550. Case 10:PlaySound "vo_youmissedeverything"
  551. End Select
  552. End Sub
  553.  
  554. Sub PlayThunder
  555. PlaySound "sfx_thunder" &RndNbr(7)
  556. End Sub
  557.  
  558. Sub PlaySword
  559. PlaySound "sfx_sword" &RndNbr(5)
  560. End Sub
  561.  
  562. Sub PlayKill
  563. PlaySound "sfx_kill" &RndNbr(10)
  564. End Sub
  565.  
  566. Sub PlayElectro
  567. PlaySound "sfx_electro" &RndNbr(9)
  568. End Sub
  569.  
  570. '**********************
  571. ' GI effects
  572. ' independent routine
  573. ' it turns on the gi
  574. ' when there is a ball
  575. ' in play
  576. '**********************
  577.  
  578. Dim OldGiState
  579. OldGiState = -1 'start witht the Gi off
  580.  
  581. Sub ChangeGi(col) 'changes the gi color
  582. Dim bulb
  583. For each bulb in aGILights
  584. SetLightColor bulb, col, -1
  585. Next
  586. End Sub
  587.  
  588. Sub GIUpdateTimer_Timer
  589. Dim tmp, obj
  590. tmp = Getballs
  591. If UBound(tmp) <> OldGiState Then
  592. OldGiState = Ubound(tmp)
  593. If UBound(tmp) = -1 Then '-1 means no balls, 0 is the first captive ball, 1 is the second captive ball...)
  594. GiOff ' turn off the gi if no active balls on the table, we could also have used the variable ballsonplayfield.
  595. Else
  596. Gion
  597. End If
  598. End If
  599. End Sub
  600.  
  601. Sub GiOn
  602. PlaySoundAt "fx_GiOn", li036 'about the center of the table
  603. DOF 118, DOFOn
  604. Dim bulb
  605. For each bulb in aGiLights
  606. bulb.State = 1
  607. Next
  608. End Sub
  609.  
  610. Sub GiOff
  611. PlaySoundAt "fx_GiOff", li036 'about the center of the table
  612. DOF 118, DOFOff
  613. Dim bulb
  614. For each bulb in aGiLights
  615. bulb.State = 0
  616. Next
  617. End Sub
  618.  
  619. ' GI, light & flashers sequence effects
  620.  
  621. Sub GiEffect(n)
  622. Dim ii
  623. Select Case n
  624. Case 0 'all off
  625. LightSeqGi.Play SeqAlloff
  626. Case 1 'all blink
  627. LightSeqGi.UpdateInterval = 40
  628. LightSeqGi.Play SeqBlinking, , 15, 25
  629. Case 2 'random
  630. LightSeqGi.UpdateInterval = 25
  631. LightSeqGi.Play SeqRandom, 50, , 1000
  632. Case 3 'all blink fast
  633. LightSeqGi.UpdateInterval = 20
  634. LightSeqGi.Play SeqBlinking, , 10, 20
  635. Case 4 'seq up
  636. LightSeqGi.UpdateInterval = 3
  637. LightSeqGi.Play SeqUpOn, 25, 3
  638. Case 5 'seq down
  639. LightSeqGi.UpdateInterval = 3
  640. LightSeqGi.Play SeqDownOn, 25, 3
  641. End Select
  642. End Sub
  643.  
  644. Sub LightEffect(n)
  645. Select Case n
  646. Case 0 ' all off
  647. LightSeqInserts.Play SeqAlloff
  648. Case 1 'all blink
  649. LightSeqInserts.UpdateInterval = 40
  650. LightSeqInserts.Play SeqBlinking, , 15, 25
  651. Case 2 'random
  652. LightSeqInserts.UpdateInterval = 25
  653. LightSeqInserts.Play SeqRandom, 50, , 1000
  654. Case 3 'all blink fast
  655. LightSeqInserts.UpdateInterval = 20
  656. LightSeqInserts.Play SeqBlinking, , 10, 20
  657. Case 4 'center - used in the bonus count
  658. LightSeqInserts.UpdateInterval = 4
  659. LightSeqInserts.Play SeqCircleOutOn, 15, 2
  660. Case 5 'top down
  661. LightSeqInserts.UpdateInterval = 4
  662. LightSeqInserts.Play SeqDownOn, 15, 2
  663. Case 6 'down to top
  664. LightSeqInserts.UpdateInterval = 4
  665. LightSeqInserts.Play SeqUpOn, 15, 1
  666. Case 7 'center from the magnet
  667. LightSeqMG.UpdateInterval = 4
  668. LightSeqMG.Play SeqCircleOutOn, 15, 1
  669. End Select
  670. End Sub
  671.  
  672. Sub FlashEffect(n)
  673. Select Case n
  674. Case 0 ' all off
  675. LightSeqFlashers.Play SeqAlloff
  676. Case 1 'all blink
  677. LightSeqFlashers.UpdateInterval = 40
  678. LightSeqFlashers.Play SeqBlinking, , 15, 25
  679. Case 2 'random
  680. LightSeqFlashers.UpdateInterval = 25
  681. LightSeqFlashers.Play SeqRandom, 50, , 1000
  682. Case 3 'all blink fast
  683. LightSeqFlashers.UpdateInterval = 20
  684. LightSeqFlashers.Play SeqBlinking, , 10, 20
  685. Case 4 'center
  686. LightSeqFlashers.UpdateInterval = 4
  687. LightSeqFlashers.Play SeqCircleOutOn, 15, 2
  688. Case 5 'top down
  689. LightSeqFlashers.UpdateInterval = 4
  690. LightSeqFlashers.Play SeqDownOn, 15, 1
  691. Case 6 'down to top
  692. LightSeqFlashers.UpdateInterval = 4
  693. LightSeqFlashers.Play SeqUpOn, 15, 1
  694. End Select
  695. End Sub
  696.  
  697. '***************************************************************
  698. ' Supporting Ball & Sound Functions v3.0
  699. ' includes random pitch in PlaySoundAt and PlaySoundAtBall
  700. '***************************************************************
  701.  
  702. Dim TableWidth, TableHeight
  703.  
  704. TableWidth = Table1.width
  705. TableHeight = Table1.height
  706.  
  707. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  708. Vol = Csng(BallVel(ball) ^2 / 2000)
  709. End Function
  710.  
  711. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  712. Dim tmp
  713. tmp = ball.x * 2 / TableWidth-1
  714. If tmp > 0 Then
  715. Pan = Csng(tmp ^10)
  716. Else
  717. Pan = Csng(-((- tmp) ^10) )
  718. End If
  719. End Function
  720.  
  721. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  722. Pitch = BallVel(ball) * 20
  723. End Function
  724.  
  725. Function BallVel(ball) 'Calculates the ball speed
  726. BallVel = (SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  727. End Function
  728.  
  729. Function AudioFade(ball) 'only on VPX 10.4 and newer
  730. Dim tmp
  731. tmp = ball.y * 2 / TableHeight-1
  732. If tmp > 0 Then
  733. AudioFade = Csng(tmp ^10)
  734. Else
  735. AudioFade = Csng(-((- tmp) ^10) )
  736. End If
  737. End Function
  738.  
  739. Sub PlaySoundAt(soundname, tableobj) 'play sound at X and Y position of an object, mostly bumpers, flippers and other fast objects
  740. PlaySound soundname, 0, 1, Pan(tableobj), 0.1, 0, 0, 0, AudioFade(tableobj)
  741. End Sub
  742.  
  743. Sub PlaySoundAtBall(soundname) ' play a sound at the ball position, like rubbers, targets, metals, plastics
  744. PlaySound soundname, 0, Vol(ActiveBall), pan(ActiveBall), 0.4, 0, 0, 0, AudioFade(ActiveBall)
  745. End Sub
  746.  
  747. Function RndNbr(n) 'returns a random number between 1 and n
  748. Randomize timer
  749. RndNbr = Int((n * Rnd) + 1)
  750. End Function
  751.  
  752. '***********************************************
  753. ' JP's VP10 Rolling Sounds + Ballshadow v3.0
  754. ' uses a collection of shadows, aBallShadow
  755. '***********************************************
  756.  
  757. Const tnob = 19 'total number of balls, 20 balls, from 0 to 19
  758. Const lob = 0 'number of locked balls
  759. Const maxvel = 45 'max ball velocity
  760. ReDim rolling(tnob)
  761. InitRolling
  762.  
  763. Sub InitRolling
  764. Dim i
  765. For i = 0 to tnob
  766. rolling(i) = False
  767. Next
  768. End Sub
  769.  
  770. Sub RollingUpdate()
  771. Dim BOT, b, ballpitch, ballvol, speedfactorx, speedfactory
  772. BOT = GetBalls
  773.  
  774. ' stop the sound of deleted balls and hide the shadow
  775. For b = UBound(BOT) + 1 to tnob
  776. rolling(b) = False
  777. StopSound("fx_ballrolling" & b)
  778. aBallShadow(b).Y = 3000
  779. Next
  780.  
  781. ' exit the sub if no balls on the table
  782. If UBound(BOT) = lob - 1 Then Exit Sub 'there no extra balls on this table
  783.  
  784. ' play the rolling sound for each ball and draw the shadow
  785. For b = lob to UBound(BOT)
  786. aBallShadow(b).X = BOT(b).X
  787. aBallShadow(b).Y = BOT(b).Y
  788. aBallShadow(b).Height = BOT(b).Z -24
  789.  
  790. If BallVel(BOT(b) ) > 1 Then
  791. If BOT(b).z < 30 Then
  792. ballpitch = Pitch(BOT(b) )
  793. ballvol = Vol(BOT(b) )
  794. Else
  795. ballpitch = Pitch(BOT(b) ) + 25000 'increase the pitch on a ramp
  796. ballvol = Vol(BOT(b) ) * 10
  797. End If
  798. rolling(b) = True
  799. PlaySound("fx_ballrolling" & b), -1, ballvol, Pan(BOT(b) ), 0, ballpitch, 1, 0, AudioFade(BOT(b) )
  800. Else
  801. If rolling(b) = True Then
  802. StopSound("fx_ballrolling" & b)
  803. rolling(b) = False
  804. End If
  805. End If
  806.  
  807. ' rothbauerw's Dropping Sounds
  808. If BOT(b).VelZ < -1 and BOT(b).z < 55 and BOT(b).z > 27 Then 'height adjust for ball drop sounds
  809. PlaySound "fx_balldrop", 0, ABS(BOT(b).velz) / 17, Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0, AudioFade(BOT(b) )
  810. End If
  811.  
  812. ' jps ball speed control
  813. If BOT(b).VelX AND BOT(b).VelY <> 0 Then
  814. speedfactorx = ABS(maxvel / BOT(b).VelX)
  815. speedfactory = ABS(maxvel / BOT(b).VelY)
  816. If speedfactorx < 1 Then
  817. BOT(b).VelX = BOT(b).VelX * speedfactorx
  818. BOT(b).VelY = BOT(b).VelY * speedfactorx
  819. End If
  820. If speedfactory < 1 Then
  821. BOT(b).VelX = BOT(b).VelX * speedfactory
  822. BOT(b).VelY = BOT(b).VelY * speedfactory
  823. End If
  824. End If
  825. Next
  826. End Sub
  827.  
  828. '**********************
  829. ' Ball Collision Sound
  830. '**********************
  831.  
  832. Sub OnBallBallCollision(ball1, ball2, velocity)
  833. PlaySound "fx_collide", 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  834. End Sub
  835.  
  836. '************************************
  837. ' Diverse Collection Hit Sounds v3.0
  838. '************************************
  839.  
  840. Sub aMetals_Hit(idx):PlaySoundAtBall "fx_MetalHit":End Sub
  841. Sub aMetalWires_Hit(idx):PlaySoundAtBall "fx_MetalWire":End Sub
  842. Sub aRubber_Bands_Hit(idx):PlaySoundAtBall "fx_rubber_band":End Sub
  843. Sub aRubber_LongBands_Hit(idx):PlaySoundAtBall "fx_rubber_longband":End Sub
  844. Sub aRubber_Posts_Hit(idx):PlaySoundAtBall "fx_rubber_post":End Sub
  845. Sub aRubber_Pins_Hit(idx):PlaySoundAtBall "fx_rubber_pin":End Sub
  846. Sub aRubber_Pegs_Hit(idx):PlaySoundAtBall "fx_rubber_peg":End Sub
  847. Sub aPlastics_Hit(idx):PlaySoundAtBall "fx_PlasticHit":End Sub
  848. Sub aGates_Hit(idx):PlaySoundAtBall "fx_Gate":End Sub
  849. Sub aWoods_Hit(idx):PlaySoundAtBall "fx_Woodhit":End Sub
  850.  
  851. 'extra collections in this table
  852. Sub aBlueRubbers_Hit(idx)
  853. Select Case RndNbr(15)
  854. Case 1:Playsound "vo_hahaha1"
  855. Case 2:Playsound "vo_hahaha2"
  856. Case 3:Playsound "vo_hahaha3"
  857. Case 4:Playsound "vo_toobusytoaim"
  858. Case 5:Playsound "vo_youmissedeverything"
  859. Case 6:Playsound "vo_yousuck1"
  860. Case 7:Playsound "vo_yousuck2"
  861. End Select
  862. End Sub
  863.  
  864. ' *********************************************************************
  865. ' User Defined Script Events
  866. ' *********************************************************************
  867.  
  868. ' Initialise the Table for a new Game
  869. '
  870. Sub ResetForNewGame()
  871. Dim i
  872.  
  873. bGameInPLay = True
  874.  
  875. 'resets the score display, and turn off attract mode
  876. StopAttractMode
  877. GiOn
  878.  
  879. TotalGamesPlayed = TotalGamesPlayed + 1
  880. CurrentPlayer = 1
  881. PlayersPlayingGame = 1
  882. bOnTheFirstBall = True
  883. For i = 1 To MaxPlayers
  884. Score(i) = 0
  885. BonusPoints(i) = 0
  886. BonusHeldPoints(i) = 0
  887. BonusMultiplier(i) = 1
  888. PlayfieldMultiplier(i) = 1
  889. BallsRemaining(i) = BallsPerGame
  890. ExtraBallsAwards(i) = 0
  891. Next
  892.  
  893. ' initialise any other flags
  894. Tilt = 0
  895.  
  896. ' initialise specific Game variables
  897. Game_Init()
  898.  
  899. ' you may wish to start some music, play a sound, do whatever at this point
  900.  
  901. vpmtimer.addtimer 1500, "FirstBall '"
  902. End Sub
  903.  
  904. ' This is used to delay the start of a game to allow any attract sequence to
  905. ' complete. When it expires it creates a ball for the player to start playing with
  906.  
  907. Sub FirstBall
  908. ' reset the table for a new ball
  909. ResetForNewPlayerBall()
  910. ' create a new ball in the shooters lane
  911. CreateNewBall()
  912. End Sub
  913.  
  914. ' (Re-)Initialise the Table for a new ball (either a new ball after the player has
  915. ' lost one or we have moved onto the next player (if multiple are playing))
  916.  
  917. Sub ResetForNewPlayerBall()
  918. ' make sure the correct display is upto date
  919. DMDScoreNow
  920.  
  921. ' set the current players bonus multiplier back down to 1X
  922. SetBonusMultiplier 1
  923.  
  924. ' reduce the playfield multiplier
  925. DecreasePlayfieldMultiplier
  926.  
  927. ' reset any drop targets, lights, game Mode etc..
  928.  
  929. BonusPoints(CurrentPlayer) = 0
  930. bBonusHeld = False
  931. bExtraBallWonThisBall = False
  932.  
  933. 'Reset any table specific
  934. ResetNewBallVariables
  935.  
  936. 'This is a new ball, so activate the ballsaver
  937. bBallSaverReady = True
  938.  
  939. 'and the skillshot
  940. bSkillShotReady = True
  941.  
  942. 'Change the music ?
  943. End Sub
  944.  
  945. ' Create a new ball on the Playfield
  946.  
  947. Sub CreateNewBall()
  948. ' create a ball in the plunger lane kicker.
  949. BallRelease.CreateSizedBallWithMass BallSize / 2, BallMass
  950.  
  951. ' There is a (or another) ball on the playfield
  952. BallsOnPlayfield = BallsOnPlayfield + 1
  953.  
  954. ' kick it out..
  955. PlaySoundAt SoundFXDOF("fx_Ballrel", 123, DOFPulse, DOFContactors), BallRelease
  956. BallRelease.Kick 90, 4
  957.  
  958. ' if there is 2 or more balls then set the multibal flag (remember to check for locked balls and other balls used for animations)
  959. ' set the bAutoPlunger flag to kick the ball in play automatically
  960. If BallsOnPlayfield > 1 Then
  961. DOF 143, DOFPulse
  962. bMultiBallMode = True
  963. bAutoPlunger = True
  964. End If
  965. End Sub
  966.  
  967. ' Add extra balls to the table with autoplunger
  968. ' Use it as AddMultiball 4 to add 4 extra balls to the table
  969.  
  970. Sub AddMultiball(nballs)
  971. mBalls2Eject = mBalls2Eject + nballs
  972. CreateMultiballTimer.Enabled = True
  973. 'and eject the first ball
  974. CreateMultiballTimer_Timer
  975. End Sub
  976.  
  977. ' Eject the ball after the delay, AddMultiballDelay
  978. Sub CreateMultiballTimer_Timer()
  979. ' wait if there is a ball in the plunger lane
  980. If bBallInPlungerLane Then
  981. Exit Sub
  982. Else
  983. If BallsOnPlayfield < MaxMultiballs Then
  984. CreateNewBall()
  985. mBalls2Eject = mBalls2Eject -1
  986. If mBalls2Eject = 0 Then 'if there are no more balls to eject then stop the timer
  987. CreateMultiballTimer.Enabled = False
  988. End If
  989. Else 'the max number of multiballs is reached, so stop the timer
  990. mBalls2Eject = 0
  991. CreateMultiballTimer.Enabled = False
  992. End If
  993. End If
  994. End Sub
  995.  
  996. ' The Player has lost his ball (there are no more balls on the playfield).
  997. ' Handle any bonus points awarded
  998.  
  999. Sub EndOfBall()
  1000. Dim AwardPoints, TotalBonus, ii
  1001. AwardPoints = 0
  1002. TotalBonus = 10 'yes 10 points :)
  1003. ' the first ball has been lost. From this point on no new players can join in
  1004. bOnTheFirstBall = False
  1005.  
  1006. ' only process any of this if the table is not tilted.
  1007. '(the tilt recovery mechanism will handle any extra balls or end of game)
  1008.  
  1009. If NOT Tilted Then
  1010. PlaySong "mu_gameover"
  1011. 'Count the bonus. This table uses several bonus
  1012. DMD CL("BONUS"), "", "", eNone, eNone, eNone, 700, True, ""
  1013.  
  1014. 'Weapons collected X 1.500.000
  1015. AwardPoints = Weapons(CurrentPlayer) * 1500000
  1016. TotalBonus = TotalBonus + AwardPoints
  1017. DMD CL("WEAPONS COLLECTED " & Weapons(CurrentPlayer) ), CL(FormatScore(AwardPoints) ), "", eNone, eNone, eNone, 700, True, "mu_bonus"
  1018.  
  1019. 'Counselors killed X 750.000
  1020. AwardPoints = CounselorsKilled(CurrentPlayer) * 750000
  1021. TotalBonus = TotalBonus + AwardPoints
  1022. DMD CL("COUNSELORS KILLED"), CL(FormatScore(AwardPoints) ), "", eNone, eNone, eNone, 700, True, "mu_bonus"
  1023.  
  1024. 'Teenagers killed x 300.000
  1025. AwardPoints = TeensKilled(CurrentPlayer) * 300000
  1026. TotalBonus = TotalBonus + AwardPoints
  1027. DMD CL("TEENAGERS KILLED"), CL(FormatScore(AwardPoints) ), "", eNone, eNone, eNone, 700, True, "mu_bonus"
  1028.  
  1029. 'Loops X 150.000
  1030. AwardPoints = LoopHits(CurrentPlayer) * 150000
  1031. TotalBonus = TotalBonus + AwardPoints
  1032. DMD CL("LOOP COMBOS"), CL(FormatScore(AwardPoints) ), "", eNone, eNone, eNone, 700, True, "mu_bonus"
  1033.  
  1034. 'Combos X 150.000
  1035. AwardPoints = ComboHits(CurrentPlayer) * 150000
  1036. TotalBonus = TotalBonus + AwardPoints
  1037. DMD CL("RAMP COMBOS"), CL(FormatScore(AwardPoints) ), "", eNone, eNone, eNone, 700, True, "mu_bonus"
  1038.  
  1039. 'Bumpers X 50.000
  1040. AwardPoints = BumperHits(CurrentPlayer) * 50000
  1041. TotalBonus = TotalBonus + AwardPoints
  1042. DMD CL("LOOP COMBOS"), CL(FormatScore(AwardPoints) ), "", eNone, eNone, eNone, 700, True, "mu_bonus"
  1043.  
  1044. DMD CL("TOTAL BONUS"), CL(FormatScore(TotalBonus) ), "", eNone, eNone, eNone, 2000, True, "mu_bonus"
  1045. AddScore2 TotalBonus * BonusMultiplier(CurrentPlayer)
  1046.  
  1047. ' add a bit of a delay to allow for the bonus points to be shown & added up
  1048. vpmtimer.addtimer 7000, "EndOfBall2 '"
  1049. Else 'if tilted then only add a short delay and move to the 2nd part of the end of the ball
  1050. vpmtimer.addtimer 100, "EndOfBall2 '"
  1051. End If
  1052. End Sub
  1053.  
  1054. ' The Timer which delays the machine to allow any bonus points to be added up
  1055. ' has expired. Check to see if there are any extra balls for this player.
  1056. ' if not, then check to see if this was the last ball (of the CurrentPlayer)
  1057. '
  1058. Sub EndOfBall2()
  1059. ' if were tilted, reset the internal tilted flag (this will also
  1060. ' set TiltWarnings back to zero) which is useful if we are changing player LOL
  1061. Tilt = 0
  1062. DisableTable False 'enable again bumpers and slingshots
  1063.  
  1064. ' has the player won an extra-ball ? (might be multiple outstanding)
  1065. If ExtraBallsAwards(CurrentPlayer) > 0 Then
  1066. 'debug.print "Extra Ball"
  1067.  
  1068. ' yep got to give it to them
  1069. ExtraBallsAwards(CurrentPlayer) = ExtraBallsAwards(CurrentPlayer) - 1
  1070.  
  1071. ' if no more EB's then turn off any Extra Ball light if there was any
  1072. If(ExtraBallsAwards(CurrentPlayer) = 0) Then
  1073. LightShootAgain.State = 0
  1074. LightShootAgain2.State = 0
  1075. End If
  1076.  
  1077. ' You may wish to do a bit of a song AND dance at this point
  1078. DMD CL("EXTRA BALL"), CL("SHOOT AGAIN"), "", eNone, eBlink, eNone, 1500, True, "vo_replay"
  1079.  
  1080. ' In this table an extra ball will have the skillshot and ball saver, so we reset the playfield for the new ball
  1081. ResetForNewPlayerBall()
  1082.  
  1083. ' Create a new ball in the shooters lane
  1084. CreateNewBall()
  1085. Else ' no extra balls
  1086.  
  1087. BallsRemaining(CurrentPlayer) = BallsRemaining(CurrentPlayer) - 1
  1088.  
  1089. ' was that the last ball ?
  1090. If(BallsRemaining(CurrentPlayer) <= 0) Then
  1091. ' debug.print "No More Balls, High Score Entry"
  1092. ' Submit the CurrentPlayers score to the High Score system
  1093. CheckHighScore()
  1094. ' you may wish to play some music at this point
  1095.  
  1096. Else
  1097.  
  1098. ' not the last ball (for that player)
  1099. ' if multiple players are playing then move onto the next one
  1100. EndOfBallComplete()
  1101. End If
  1102. End If
  1103. End Sub
  1104.  
  1105. ' This function is called when the end of bonus display
  1106. ' (or high score entry finished) AND it either end the game or
  1107. ' move onto the next player (or the next ball of the same player)
  1108. '
  1109. Sub EndOfBallComplete()
  1110. Dim NextPlayer
  1111.  
  1112. 'debug.print "EndOfBall - Complete"
  1113.  
  1114. ' are there multiple players playing this game ?
  1115. If(PlayersPlayingGame > 1) Then
  1116. ' then move to the next player
  1117. NextPlayer = CurrentPlayer + 1
  1118. ' are we going from the last player back to the first
  1119. ' (ie say from player 4 back to player 1)
  1120. If(NextPlayer > PlayersPlayingGame) Then
  1121. NextPlayer = 1
  1122. End If
  1123. Else
  1124. NextPlayer = CurrentPlayer
  1125. End If
  1126.  
  1127. 'debug.print "Next Player = " & NextPlayer
  1128.  
  1129. ' is it the end of the game ? (all balls been lost for all players)
  1130. If((BallsRemaining(CurrentPlayer) <= 0) AND(BallsRemaining(NextPlayer) <= 0) ) Then
  1131. ' you may wish to do some sort of Point Match free game award here
  1132. ' generally only done when not in free play mode
  1133.  
  1134. ' set the machine into game over mode
  1135. EndOfGame()
  1136.  
  1137. ' you may wish to put a Game Over message on the desktop/backglass
  1138.  
  1139. Else
  1140. ' set the next player
  1141. CurrentPlayer = NextPlayer
  1142.  
  1143. ' make sure the correct display is up to date
  1144. DMDScoreNow
  1145.  
  1146. ' reset the playfield for the new player (or new ball)
  1147. ResetForNewPlayerBall()
  1148.  
  1149. ' AND create a new ball
  1150. CreateNewBall()
  1151.  
  1152. ' play a sound if more than 1 player
  1153. If PlayersPlayingGame > 1 Then
  1154. Select Case CurrentPlayer
  1155. Case 1:DMD "", CL("PLAYER 1"), "", eNone, eNone, eNone, 1000, True, "vo_player1"
  1156. Case 2:DMD "", CL("PLAYER 2"), "", eNone, eNone, eNone, 1000, True, "vo_player2"
  1157. Case 3:DMD "", CL("PLAYER 3"), "", eNone, eNone, eNone, 1000, True, "vo_player3"
  1158. Case 4:DMD "", CL("PLAYER 4"), "", eNone, eNone, eNone, 1000, True, "vo_player4"
  1159. End Select
  1160. Else
  1161. DMD "", CL("PLAYER 1"), "", eNone, eNone, eNone, 1000, True, "vo_youareup"
  1162. End If
  1163. End If
  1164. End Sub
  1165.  
  1166. ' This function is called at the End of the Game, it should reset all
  1167. ' Drop targets, AND eject any 'held' balls, start any attract sequences etc..
  1168.  
  1169. Sub EndOfGame()
  1170. 'debug.print "End Of Game"
  1171. bGameInPLay = False
  1172. ' just ended your game then play the end of game tune
  1173. PlaySound "mu_death"
  1174. vpmtimer.AddTimer 2500, "PlayEndQuote '"
  1175. ' ensure that the flippers are down
  1176. SolLFlipper 0
  1177. SolRFlipper 0
  1178.  
  1179. ' terminate all Mode - eject locked balls
  1180. ' most of the Mode/timers terminate at the end of the ball
  1181.  
  1182. ' set any lights for the attract mode
  1183. GiOff
  1184. StartAttractMode
  1185. ' you may wish to light any Game Over Light you may have
  1186. End Sub
  1187.  
  1188. 'this calculates the ball number in play
  1189. Function Balls
  1190. Dim tmp
  1191. tmp = BallsPerGame - BallsRemaining(CurrentPlayer) + 1
  1192. If tmp > BallsPerGame Then
  1193. Balls = BallsPerGame
  1194. Else
  1195. Balls = tmp
  1196. End If
  1197. End Function
  1198.  
  1199. ' *********************************************************************
  1200. ' Drain / Plunger Functions
  1201. ' *********************************************************************
  1202.  
  1203. ' lost a ball ;-( check to see how many balls are on the playfield.
  1204. ' if only one then decrement the remaining count AND test for End of game
  1205. ' if more than 1 ball (multi-ball) then kill of the ball but don't create
  1206. ' a new one
  1207. '
  1208. Sub Drain_Hit()
  1209. ' Destroy the ball
  1210. Drain.DestroyBall
  1211. If bGameInPLay = False Then Exit Sub 'don't do anything, just delete the ball
  1212. ' Exit Sub ' only for debugging - this way you can add balls from the debug window
  1213.  
  1214. BallsOnPlayfield = BallsOnPlayfield - 1
  1215.  
  1216. ' pretend to knock the ball into the ball storage mech
  1217. PlaySoundAt "fx_drain", Drain
  1218. 'if Tilted the end Ball Mode
  1219. If Tilted Then
  1220. StopEndOfBallMode
  1221. End If
  1222.  
  1223. ' if there is a game in progress AND it is not Tilted
  1224. If(bGameInPLay = True) AND(Tilted = False) Then
  1225.  
  1226. ' is the ball saver active,
  1227. If(bBallSaverActive = True) Then
  1228.  
  1229. ' yep, create a new ball in the shooters lane
  1230. ' we use the Addmultiball in case the multiballs are being ejected
  1231. AddMultiball 1
  1232. ' we kick the ball with the autoplunger
  1233. bAutoPlunger = True
  1234. ' you may wish to put something on a display or play a sound at this point
  1235. ' stop the ballsaver timer during the launch ball saver time, but not during multiballs
  1236. If NOT bMultiBallMode Then
  1237. DMD "_", CL("BALL SAVED"), "_", eNone, eBlinkfast, eNone, 2500, True, "vo_giveballback"
  1238. BallSaverTimerExpired_Timer
  1239. End If
  1240. Else
  1241. ' cancel any multiball if on last ball (ie. lost all other balls)
  1242. If(BallsOnPlayfield = 1) Then
  1243. ' AND in a multi-ball??
  1244. If(bMultiBallMode = True) then
  1245. ' not in multiball mode any more
  1246. bMultiBallMode = False
  1247. ' you may wish to change any music over at this point and
  1248. changesong
  1249. ' turn off any multiball specific lights
  1250. ChangeGi white
  1251. 'stop any multiball modes of this game
  1252. StopMBmodes
  1253. End If
  1254. End If
  1255.  
  1256. ' was that the last ball on the playfield
  1257. If(BallsOnPlayfield = 0) Then
  1258. ' End Mode and timers
  1259. StopSong Song
  1260. ChangeGi white
  1261. ' Show the end of ball animation
  1262. ' and continue with the end of ball
  1263. ' DMD something?
  1264. StopEndOfBallMode
  1265. vpmtimer.addtimer 200, "EndOfBall '" 'the delay is depending of the animation of the end of ball, if there is no animation then move to the end of ball
  1266. End If
  1267. End If
  1268. End If
  1269. End Sub
  1270.  
  1271. ' The Ball has rolled out of the Plunger Lane and it is pressing down the trigger in the shooters lane
  1272. ' Check to see if a ball saver mechanism is needed and if so fire it up.
  1273.  
  1274. Sub swPlungerRest_Hit()
  1275. 'debug.print "ball in plunger lane"
  1276. ' some sound according to the ball position
  1277. PlaySoundAt "fx_sensor", swPlungerRest
  1278. bBallInPlungerLane = True
  1279. ' turn on Launch light is there is one
  1280. 'LaunchLight.State = 2
  1281.  
  1282. 'be sure to update the Scoreboard after the animations, if any
  1283.  
  1284. ' kick the ball in play if the bAutoPlunger flag is on
  1285. If bAutoPlunger Then
  1286. 'debug.print "autofire the ball"
  1287. vpmtimer.addtimer 1500, "PlungerIM.AutoFire:DOF 120, DOFPulse:PlaySoundAt ""fx_kicker"", swPlungerRest:bAutoPlunger = False '"
  1288. End If
  1289. 'Start the skillshot lights & variables if any
  1290. If bSkillShotReady Then
  1291. PlaySong "mu_wait"
  1292. UpdateSkillshot()
  1293. ' show the message to shoot the ball in case the player has fallen sleep
  1294. swPlungerRest.TimerEnabled = 1
  1295. End If
  1296. ' remember last trigger hit by the ball.
  1297. LastSwitchHit = "swPlungerRest"
  1298. End Sub
  1299.  
  1300. ' The ball is released from the plunger turn off some flags and check for skillshot
  1301.  
  1302. Sub swPlungerRest_UnHit()
  1303. lighteffect 6
  1304. bBallInPlungerLane = False
  1305. swPlungerRest.TimerEnabled = 0 'stop the launch ball timer if active
  1306. If bSkillShotReady Then
  1307. ChangeSong
  1308. ResetSkillShotTimer.Enabled = 1
  1309. End If
  1310. ' if there is a need for a ball saver, then start off a timer
  1311. ' only start if it is ready, and it is currently not running, else it will reset the time period
  1312. If(bBallSaverReady = True) AND(BallSaverTime <> 0) And(bBallSaverActive = False) Then
  1313. EnableBallSaver BallSaverTime
  1314. End If
  1315. ' turn off LaunchLight
  1316. ' LaunchLight.State = 0
  1317. End Sub
  1318.  
  1319. ' swPlungerRest timer to show the "launch ball" if the player has not shot the ball during 6 seconds
  1320. Sub swPlungerRest_Timer
  1321. IF bOnTheFirstBall Then
  1322. Select Case RndNbr(5)
  1323. Case 1:DMD CL("BACK FOR SOME"), CL("MORE TORTURE"), "_", eNone, eNone, eNone, 2000, True, "vo_backforsomemoretorture"
  1324. Case 2:DMD CL("I KNEW YOU"), CL("YOU WOULD BE BACK"), "_", eNone, eNone, eNone, 2000, True, "vo_Iknewyoullbeback"
  1325. Case 3:DMD CL("ARE YOU PLAYING"), CL("THIS GAME"), "_", eNone, eNone, eNone, 2000, True, "vo_areyouplayingthisgame"
  1326. Case 4:DMD CL("HEY YOU"), CL("SHOOT THE BALL"), "_", eNone, eNone, eNone, 2000, True, "vo_shoothereandhere"
  1327. Case 5:DMD CL("HEY YOU"), CL("WELCOME BACK"), "_", eNone, eNone, eNone, 2000, True, "vo_welcomeback"
  1328. End Select
  1329. Else
  1330. Select Case RndNbr(4)
  1331. Case 1:DMD CL("TIME TO"), CL("WAKE UP"), "_", eNone, eNone, eNone, 2000, True, "vo_timetowakeup"
  1332. Case 2:DMD CL("WHAT ARE"), CL("YOU WAITING FOR"), "_", eNone, eNone, eNone, 2000, True, "vo_whatareyouwaitingfor"
  1333. Case 3:DMD CL("HEY"), CL("PULL THE PLUNGER"), "_", eNone, eNone, eNone, 2000, True, "vo_heypulltheplunger"
  1334. Case 4:DMD CL("ARE YOU PLAYING"), CL("THIS GAME"), "_", eNone, eNone, eNone, 2000, True, "vo_areyouplayingthisgame"
  1335. End Select
  1336. End If
  1337. End Sub
  1338.  
  1339. Sub EnableBallSaver(seconds)
  1340. 'debug.print "Ballsaver started"
  1341. ' set our game flag
  1342. bBallSaverActive = True
  1343. bBallSaverReady = False
  1344. ' start the timer
  1345. BallSaverTimerExpired.Interval = 1000 * seconds
  1346. BallSaverTimerExpired.Enabled = True
  1347. BallSaverSpeedUpTimer.Interval = 1000 * seconds -(1000 * seconds) / 3
  1348. BallSaverSpeedUpTimer.Enabled = True
  1349. ' if you have a ball saver light you might want to turn it on at this point (or make it flash)
  1350. LightShootAgain.BlinkInterval = 160
  1351. LightShootAgain.State = 2
  1352. LightShootAgain2.BlinkInterval = 160
  1353. LightShootAgain2.State = 2
  1354. End Sub
  1355.  
  1356. ' The ball saver timer has expired. Turn it off AND reset the game flag
  1357. '
  1358. Sub BallSaverTimerExpired_Timer()
  1359. 'debug.print "Ballsaver ended"
  1360. BallSaverTimerExpired.Enabled = False
  1361. BallSaverSpeedUpTimer.Enabled = False 'ensure this timer is also stopped
  1362. ' clear the flag
  1363. bBallSaverActive = False
  1364. ' if you have a ball saver light then turn it off at this point
  1365. LightShootAgain.State = 0
  1366. LightShootAgain2.State = 0
  1367. ' if the table uses the same lights for the extra ball or replay then turn them on if needed
  1368. If ExtraBallsAwards(CurrentPlayer) > 0 Then
  1369. LightShootAgain.State = 1
  1370. LightShootAgain2.State = 1
  1371. End If
  1372. End Sub
  1373.  
  1374. Sub BallSaverSpeedUpTimer_Timer()
  1375. 'debug.print "Ballsaver Speed Up Light"
  1376. BallSaverSpeedUpTimer.Enabled = False
  1377. ' Speed up the blinking
  1378. LightShootAgain.BlinkInterval = 80
  1379. LightShootAgain.State = 2
  1380. LightShootAgain2.BlinkInterval = 80
  1381. LightShootAgain2.State = 2
  1382. End Sub
  1383.  
  1384. ' *********************************************************************
  1385. ' Supporting Score Functions
  1386. ' *********************************************************************
  1387.  
  1388. ' Add points to the score AND update the score board
  1389.  
  1390. Sub AddScore(points) 'normal score routine
  1391. If Tilted Then Exit Sub
  1392. ' add the points to the current players score variable
  1393. Score(CurrentPlayer) = Score(CurrentPlayer) + points * PlayfieldMultiplier(CurrentPlayer)
  1394. ' you may wish to check to see if the player has gotten a replay
  1395. End Sub
  1396.  
  1397. Sub AddScore2(points) 'used in jackpots, skillshots, combos, and bonus as it does not use the PlayfieldMultiplier
  1398. If Tilted Then Exit Sub
  1399. ' add the points to the current players score variable
  1400. Score(CurrentPlayer) = Score(CurrentPlayer) + points
  1401. End Sub
  1402.  
  1403. ' Add bonus to the bonuspoints AND update the score board
  1404.  
  1405. Sub AddBonus(points) 'not used in this table, since there are many different bonus items.
  1406. If Tilted Then Exit Sub
  1407. ' add the bonus to the current players bonus variable
  1408. BonusPoints(CurrentPlayer) = BonusPoints(CurrentPlayer) + points
  1409. End Sub
  1410.  
  1411. ' Add some points to the current Jackpot.
  1412. '
  1413. Sub AddJackpot(points)
  1414. ' Jackpots only generally increment in multiball mode AND not tilted
  1415. ' but this doesn't have to be the case
  1416. If Tilted Then Exit Sub
  1417.  
  1418. ' If(bMultiBallMode = True) Then
  1419. Jackpot(CurrentPlayer) = Jackpot(CurrentPlayer) + points
  1420. DMD "_", CL("INCREASED JACKPOT"), "_", eNone, eNone, eNone, 1000, True, ""
  1421. ' you may wish to limit the jackpot to a upper limit, ie..
  1422. ' If (Jackpot >= 6000000) Then
  1423. ' Jackpot = 6000000
  1424. ' End if
  1425. 'End if
  1426. End Sub
  1427.  
  1428. Sub AddSuperJackpot(points) 'not used in this table
  1429. If Tilted Then Exit Sub
  1430. End Sub
  1431.  
  1432. Sub AddBonusMultiplier(n)
  1433. Dim NewBonusLevel
  1434. ' if not at the maximum bonus level
  1435. if(BonusMultiplier(CurrentPlayer) + n <= MaxBonusMultiplier) then
  1436. ' then add and set the lights
  1437. NewBonusLevel = BonusMultiplier(CurrentPlayer) + n
  1438. SetBonusMultiplier(NewBonusLevel)
  1439. DMD "_", CL("BONUS X " &NewBonusLevel), "_", eNone, eBlink, eNone, 2000, True, ""
  1440. Else
  1441. AddScore2 500000
  1442. DMD "_", CL("500000"), "_", eNone, eNone, eNone, 1000, True, ""
  1443. End if
  1444. End Sub
  1445.  
  1446. ' Set the Bonus Multiplier to the specified level AND set any lights accordingly
  1447.  
  1448. Sub SetBonusMultiplier(Level)
  1449. ' Set the multiplier to the specified level
  1450. BonusMultiplier(CurrentPlayer) = Level
  1451. UpdateBonusXLights(Level)
  1452. End Sub
  1453.  
  1454. Sub UpdateBonusXLights(Level) '9 lights in this table
  1455. ' Update the lights
  1456. Select Case Level
  1457. Case 1:li021.State = 0:li022.State = 0:li023.State = 0:li024.State = 0:li025.State = 0:li026.State = 0:li027.State = 0:li027.State = 0
  1458. Case 2:li021.State = 1:li022.State = 0:li023.State = 0:li024.State = 0:li025.State = 0:li026.State = 0:li027.State = 0:li027.State = 0
  1459. Case 3:li021.State = 1:li022.State = 1:li023.State = 0:li024.State = 0:li025.State = 0:li026.State = 0:li027.State = 0:li027.State = 0
  1460. Case 4:li021.State = 1:li022.State = 1:li023.State = 1:li024.State = 0:li025.State = 0:li026.State = 0:li027.State = 0:li027.State = 0
  1461. Case 5:li021.State = 1:li022.State = 1:li023.State = 1:li024.State = 1:li025.State = 0:li026.State = 0:li027.State = 0:li027.State = 0
  1462. Case 6:li021.State = 1:li022.State = 1:li023.State = 1:li024.State = 1:li025.State = 1:li026.State = 0:li027.State = 0:li027.State = 0
  1463. Case 7:li021.State = 1:li022.State = 1:li023.State = 1:li024.State = 1:li025.State = 1:li026.State = 1:li027.State = 0:li027.State = 0
  1464. Case 8:li021.State = 1:li022.State = 1:li023.State = 1:li024.State = 1:li025.State = 1:li026.State = 1:li027.State = 1:li027.State = 0
  1465. Case 9:li021.State = 1:li022.State = 1:li023.State = 1:li024.State = 1:li025.State = 1:li026.State = 1:li027.State = 1:li027.State = 1
  1466. End Select
  1467. End Sub
  1468.  
  1469. Sub AddPlayfieldMultiplier(n)
  1470. Dim snd
  1471. Dim NewPFLevel
  1472. ' if not at the maximum level x
  1473. if(PlayfieldMultiplier(CurrentPlayer) + n <= MaxMultiplier) then
  1474. ' then add and set the lights
  1475. NewPFLevel = PlayfieldMultiplier(CurrentPlayer) + n
  1476. SetPlayfieldMultiplier(NewPFLevel)
  1477. snd = "sfx_thunder" &NewPFLevel
  1478. DMD "_", CL("PLAYFIELD X " &NewPFLevel), "_", eNone, eBlink, eNone, 2000, True, snd
  1479. LightEffect 4
  1480. ' Play a Sound
  1481. Select Case NewPFLevel
  1482. Case 2:PlaySound "vo_2xplayfield"
  1483. Case 3:PlaySound "vo_3xplayfield"
  1484. Case 4:PlaySound "vo_4xplayfield"
  1485. Case 5:PlaySound "vo_5xplayfield"
  1486. End Select
  1487. Else 'if the max is already lit
  1488. AddScore2 500000
  1489. DMD "_", CL("500000"), "_", eNone, eNone, eNone, 2000, True, ""
  1490. End if
  1491. ' restart the PlayfieldMultiplier timer to reduce the multiplier
  1492. PFXTimer.Enabled = 0
  1493. PFXTimer.Enabled = 1
  1494. End Sub
  1495.  
  1496. Sub PFXTimer_Timer
  1497. DecreasePlayfieldMultiplier
  1498. End Sub
  1499.  
  1500. Sub DecreasePlayfieldMultiplier 'reduces by 1 the playfield multiplier
  1501. Dim NewPFLevel
  1502. ' if not at 1 already
  1503. if(PlayfieldMultiplier(CurrentPlayer) > 1) then
  1504. ' then add and set the lights
  1505. NewPFLevel = PlayfieldMultiplier(CurrentPlayer) - 1
  1506. SetPlayfieldMultiplier(NewPFLevel)
  1507. Else
  1508. PFXTimer.Enabled = 0
  1509. End if
  1510. End Sub
  1511.  
  1512. ' Set the Playfield Multiplier to the specified level AND set any lights accordingly
  1513.  
  1514. Sub SetPlayfieldMultiplier(Level)
  1515. ' Set the multiplier to the specified level
  1516. PlayfieldMultiplier(CurrentPlayer) = Level
  1517. ' UpdatePFXLights(Level)
  1518. End Sub
  1519.  
  1520. Sub UpdatePFXLights(Level) 'no plx lights in this table
  1521. ' Update the playfield multiplier lights
  1522. 'Select Case Level
  1523. ' Case 1:li041.State = 1:li042.State = 0:li043.State = 0:li044.State = 0:li045.State = 0:li046.State = 0:li047.State = 0
  1524. ' Case 2:li041.State = 1:li042.State = 1:li043.State = 0:li044.State = 0:li045.State = 0:li046.State = 0:li047.State = 0
  1525. ' Case 3:li041.State = 1:li042.State = 1:li043.State = 1:li044.State = 0:li045.State = 0:li046.State = 0:li047.State = 0
  1526. ' Case 4:li041.State = 1:li042.State = 1:li043.State = 1:li044.State = 1:li045.State = 0:li046.State = 0:li047.State = 0
  1527. ' Case 5:li041.State = 1:li042.State = 1:li043.State = 1:li044.State = 1:li045.State = 1:li046.State = 0:li047.State = 0
  1528. ' Case 6:li041.State = 1:li042.State = 1:li043.State = 1:li044.State = 1:li045.State = 1:li046.State = 1:li047.State = 0
  1529. ' Case 7:li041.State = 1:li042.State = 1:li043.State = 1:li044.State = 1:li045.State = 1:li046.State = 1:li047.State = 1
  1530. 'End Select
  1531. ' perhaps show also the multiplier in the DMD?
  1532. End Sub
  1533.  
  1534. Sub AwardExtraBall()
  1535. ' If NOT bExtraBallWonThisBall Then 'in this table you can win several extra balls
  1536. DMD "_", CL("EXTRA BALL WON"), "_", eNone, eBlink, eNone, 1000, True, SoundFXDOF("fx_Knocker", 122, DOFPulse, DOFKnocker)
  1537. DOF 121, DOFPulse
  1538. PLaySound "vo_extraball"
  1539. ExtraBallsAwards(CurrentPlayer) = ExtraBallsAwards(CurrentPlayer) + 1
  1540. 'bExtraBallWonThisBall = True
  1541. LightShootAgain.State = 1 'light the shoot again lamp
  1542. LightShootAgain2.State = 1 'light the shoot again lamp
  1543. GiEffect 2
  1544. LightEffect 2
  1545. ' END If
  1546. End Sub
  1547.  
  1548. Sub AwardSpecial()
  1549. DMD "_", CL("EXTRA GAME WON"), "_", eNone, eBlink, eNone, 1000, True, SoundFXDOF("fx_Knocker", 122, DOFPulse, DOFKnocker)
  1550. DOF 121, DOFPulse
  1551. Credits = Credits + 1
  1552. If bFreePlay = False Then DOF 125, DOFOn
  1553. LightEffect 2
  1554. GiEffect 2
  1555. End Sub
  1556.  
  1557. Sub AwardJackpot() 'not used in this table as there are several jackpots
  1558. DMD CL("JACKPOT"), CL(FormatScore(Jackpot(CurrentPlayer) ) ), "d_border", eNone, eBlinkFast, eNone, 1500, True, "vo_Jackpot"
  1559. DOF 126, DOFPulse
  1560. AddScore2 Jackpot(CurrentPlayer)
  1561. LightEffect 2
  1562. GiEffect 2
  1563. End Sub
  1564.  
  1565. Sub AwardTargetJackpot() 'award a target jackpot after hitting all targets
  1566. DMD CL("TARGET JACKPOT"), CL(FormatScore(TargetJackpot(CurrentPlayer) ) ), "d_border", eNone, eBlinkFast, eNone, 1500, True, "vo_Jackpot" &RndNbr(6)
  1567. DOF 126, DOFPulse
  1568. AddScore2 TargetJackpot(CurrentPlayer)
  1569. TargetJackpot(CurrentPlayer) = TargetJackpot(CurrentPlayer) + 150000
  1570. li069.State = 0
  1571. LightEffect 2
  1572. GiEffect 2
  1573. End Sub
  1574.  
  1575. Sub AwardSuperJackpot() 'not used in this table as there are several superjackpots but I keep it as a reference
  1576. DMD CL("SUPER JACKPOT"), CL(FormatScore(SuperJackpot(CurrentPlayer) ) ), "d_border", eNone, eBlinkFast, eNone, 2000, True, "vo_superjackpot"
  1577. DOF 126, DOFPulse
  1578. AddScore2 SuperJackpot(CurrentPlayer)
  1579. LightEffect 2
  1580. GiEffect 2
  1581. End Sub
  1582.  
  1583. Sub AwardWeaponsSuperJackpot()
  1584. DMD CL("WEAPONS SUPR JACKPOT"), CL(FormatScore(WeaponSJValue(CurrentPlayer) ) ), "d_border", eNone, eBlinkFast, eNone, 2000, True, "vo_superjackpot"
  1585. DOF 126, DOFPulse
  1586. AddScore2 WeaponSJValue(CurrentPlayer)
  1587. WeaponSJValue(CurrentPlayer) = WeaponSJValue(CurrentPlayer) + ((Score(CurrentPlayer) * 0.2) \ 10) * 10 'increase the weapons score with 20%
  1588. aWeaponSJactive = False
  1589. li060.State = 0
  1590. LightEffect 2
  1591. GiEffect 2
  1592. End Sub
  1593.  
  1594. Sub AwardSkillshot()
  1595. ResetSkillShotTimer_Timer
  1596. 'show dmd animation
  1597. DMD CL("SKILLSHOT"), CL(FormatScore(SkillshotValue(CurrentPlayer) ) ), "d_border", eNone, eBlinkFast, eNone, 2000, True, "sfx_fanfare01"
  1598. DOF 127, DOFPulse
  1599. Addscore2 SkillShotValue(CurrentPlayer)
  1600. ' increment the skillshot value with 250.000
  1601. SkillShotValue(CurrentPlayer) = SkillShotValue(CurrentPlayer) + 250000
  1602. 'do some light show
  1603. GiEffect 2
  1604. LightEffect 2
  1605. End Sub
  1606.  
  1607. Sub AwardSuperSkillshot()
  1608. ResetSkillShotTimer_Timer
  1609. 'show dmd animation
  1610. DMD CL("SUPER SKILLSHOT"), CL(FormatScore(SuperSkillshotValue(CurrentPlayer) ) ), "d_border", eNone, eBlinkFast, eNone, 2000, True, "sfx_fanfare01"
  1611. DOF 127, DOFPulse
  1612. Addscore2 SuperSkillshotValue(CurrentPlayer)
  1613. ' increment the skillshot value with 500.000
  1614. SuperSkillshotValue(CurrentPlayer) = SuperSkillshotValue(CurrentPlayer) + 500000
  1615. 'do some light show
  1616. GiEffect 2
  1617. LightEffect 2
  1618. End Sub
  1619.  
  1620. Sub aSkillshotTargets_Hit(idx) 'stop the skillshot if any other target is hit
  1621. If bSkillshotReady then ResetSkillShotTimer_Timer
  1622. End Sub
  1623.  
  1624. '*****************************
  1625. ' Load / Save / Highscore
  1626. '*****************************
  1627.  
  1628. Sub Loadhs
  1629. Dim x
  1630. x = LoadValue(cGameName, "HighScore1")
  1631. If(x <> "") Then HighScore(0) = CDbl(x) Else HighScore(0) = 100000 End If
  1632. x = LoadValue(cGameName, "HighScore1Name")
  1633. If(x <> "") Then HighScoreName(0) = x Else HighScoreName(0) = "AAA" End If
  1634. x = LoadValue(cGameName, "HighScore2")
  1635. If(x <> "") then HighScore(1) = CDbl(x) Else HighScore(1) = 100000 End If
  1636. x = LoadValue(cGameName, "HighScore2Name")
  1637. If(x <> "") then HighScoreName(1) = x Else HighScoreName(1) = "BBB" End If
  1638. x = LoadValue(cGameName, "HighScore3")
  1639. If(x <> "") then HighScore(2) = CDbl(x) Else HighScore(2) = 100000 End If
  1640. x = LoadValue(cGameName, "HighScore3Name")
  1641. If(x <> "") then HighScoreName(2) = x Else HighScoreName(2) = "CCC" End If
  1642. x = LoadValue(cGameName, "HighScore4")
  1643. If(x <> "") then HighScore(3) = CDbl(x) Else HighScore(3) = 100000 End If
  1644. x = LoadValue(cGameName, "HighScore4Name")
  1645. If(x <> "") then HighScoreName(3) = x Else HighScoreName(3) = "DDD" End If
  1646. x = LoadValue(cGameName, "Credits")
  1647. If(x <> "") then Credits = CInt(x) Else Credits = 0:If bFreePlay = False Then DOF 125, DOFOff:End If
  1648. x = LoadValue(cGameName, "TotalGamesPlayed")
  1649. If(x <> "") then TotalGamesPlayed = CInt(x) Else TotalGamesPlayed = 0 End If
  1650. End Sub
  1651.  
  1652. Sub Savehs
  1653. SaveValue cGameName, "HighScore1", HighScore(0)
  1654. SaveValue cGameName, "HighScore1Name", HighScoreName(0)
  1655. SaveValue cGameName, "HighScore2", HighScore(1)
  1656. SaveValue cGameName, "HighScore2Name", HighScoreName(1)
  1657. SaveValue cGameName, "HighScore3", HighScore(2)
  1658. SaveValue cGameName, "HighScore3Name", HighScoreName(2)
  1659. SaveValue cGameName, "HighScore4", HighScore(3)
  1660. SaveValue cGameName, "HighScore4Name", HighScoreName(3)
  1661. SaveValue cGameName, "Credits", Credits
  1662. SaveValue cGameName, "TotalGamesPlayed", TotalGamesPlayed
  1663. End Sub
  1664.  
  1665. Sub Reseths
  1666. HighScoreName(0) = "AAA"
  1667. HighScoreName(1) = "BBB"
  1668. HighScoreName(2) = "CCC"
  1669. HighScoreName(3) = "DDD"
  1670. HighScore(0) = 150000
  1671. HighScore(1) = 140000
  1672. HighScore(2) = 130000
  1673. HighScore(3) = 120000
  1674. Savehs
  1675. End Sub
  1676.  
  1677. ' ***********************************************************
  1678. ' High Score Initals Entry Functions - based on Black's code
  1679. ' ***********************************************************
  1680.  
  1681. Dim hsbModeActive
  1682. Dim hsEnteredName
  1683. Dim hsEnteredDigits(3)
  1684. Dim hsCurrentDigit
  1685. Dim hsValidLetters
  1686. Dim hsCurrentLetter
  1687. Dim hsLetterFlash
  1688.  
  1689. Sub CheckHighscore()
  1690. Dim tmp
  1691. tmp = Score(CurrentPlayer)
  1692.  
  1693. If tmp > HighScore(0) Then 'add 1 credit for beating the highscore
  1694. Credits = Credits + 1
  1695. DOF 125, DOFOn
  1696. End If
  1697.  
  1698. If tmp > HighScore(3) Then
  1699. PlaySound SoundFXDOF("fx_Knocker", 122, DOFPulse, DOFKnocker)
  1700. DOF 121, DOFPulse
  1701. HighScore(3) = tmp
  1702. 'enter player's name
  1703. HighScoreEntryInit()
  1704. Else
  1705. EndOfBallComplete()
  1706. End If
  1707. End Sub
  1708.  
  1709. Sub HighScoreEntryInit()
  1710. hsbModeActive = True
  1711. PlaySound "vo_enterinitials"
  1712. hsLetterFlash = 0
  1713.  
  1714. hsEnteredDigits(0) = " "
  1715. hsEnteredDigits(1) = " "
  1716. hsEnteredDigits(2) = " "
  1717. hsCurrentDigit = 0
  1718.  
  1719. hsValidLetters = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789<" ' < is back arrow
  1720. hsCurrentLetter = 1
  1721. DMDFlush()
  1722. HighScoreDisplayNameNow()
  1723.  
  1724. HighScoreFlashTimer.Interval = 250
  1725. HighScoreFlashTimer.Enabled = True
  1726. End Sub
  1727.  
  1728. Sub EnterHighScoreKey(keycode)
  1729. If keycode = LeftFlipperKey Then
  1730. playsound "fx_Previous"
  1731. hsCurrentLetter = hsCurrentLetter - 1
  1732. if(hsCurrentLetter = 0) then
  1733. hsCurrentLetter = len(hsValidLetters)
  1734. end if
  1735. HighScoreDisplayNameNow()
  1736. End If
  1737.  
  1738. If keycode = RightFlipperKey Then
  1739. playsound "fx_Next"
  1740. hsCurrentLetter = hsCurrentLetter + 1
  1741. if(hsCurrentLetter > len(hsValidLetters) ) then
  1742. hsCurrentLetter = 1
  1743. end if
  1744. HighScoreDisplayNameNow()
  1745. End If
  1746.  
  1747. If keycode = PlungerKey OR keycode = StartGameKey Then
  1748. if(mid(hsValidLetters, hsCurrentLetter, 1) <> "<") then
  1749. playsound "fx_Enter"
  1750. hsEnteredDigits(hsCurrentDigit) = mid(hsValidLetters, hsCurrentLetter, 1)
  1751. hsCurrentDigit = hsCurrentDigit + 1
  1752. if(hsCurrentDigit = 3) then
  1753. HighScoreCommitName()
  1754. else
  1755. HighScoreDisplayNameNow()
  1756. end if
  1757. else
  1758. playsound "fx_Esc"
  1759. hsEnteredDigits(hsCurrentDigit) = " "
  1760. if(hsCurrentDigit > 0) then
  1761. hsCurrentDigit = hsCurrentDigit - 1
  1762. end if
  1763. HighScoreDisplayNameNow()
  1764. end if
  1765. end if
  1766. End Sub
  1767.  
  1768. Sub HighScoreDisplayNameNow()
  1769. HighScoreFlashTimer.Enabled = False
  1770. hsLetterFlash = 0
  1771. HighScoreDisplayName()
  1772. HighScoreFlashTimer.Enabled = True
  1773. End Sub
  1774.  
  1775. Sub HighScoreDisplayName()
  1776. Dim i
  1777. Dim TempTopStr
  1778. Dim TempBotStr
  1779.  
  1780. TempTopStr = "YOUR NAME:"
  1781. dLine(0) = ExpandLine(TempTopStr)
  1782. DMDUpdate 0
  1783.  
  1784. TempBotStr = " > "
  1785. if(hsCurrentDigit > 0) then TempBotStr = TempBotStr & hsEnteredDigits(0)
  1786. if(hsCurrentDigit > 1) then TempBotStr = TempBotStr & hsEnteredDigits(1)
  1787. if(hsCurrentDigit > 2) then TempBotStr = TempBotStr & hsEnteredDigits(2)
  1788.  
  1789. if(hsCurrentDigit <> 3) then
  1790. if(hsLetterFlash <> 0) then
  1791. TempBotStr = TempBotStr & "_"
  1792. else
  1793. TempBotStr = TempBotStr & mid(hsValidLetters, hsCurrentLetter, 1)
  1794. end if
  1795. end if
  1796.  
  1797. if(hsCurrentDigit < 1) then TempBotStr = TempBotStr & hsEnteredDigits(1)
  1798. if(hsCurrentDigit < 2) then TempBotStr = TempBotStr & hsEnteredDigits(2)
  1799.  
  1800. TempBotStr = TempBotStr & " < "
  1801. dLine(1) = ExpandLine(TempBotStr)
  1802. DMDUpdate 1
  1803. End Sub
  1804.  
  1805. Sub HighScoreFlashTimer_Timer()
  1806. HighScoreFlashTimer.Enabled = False
  1807. hsLetterFlash = hsLetterFlash + 1
  1808. if(hsLetterFlash = 2) then hsLetterFlash = 0
  1809. HighScoreDisplayName()
  1810. HighScoreFlashTimer.Enabled = True
  1811. End Sub
  1812.  
  1813. Sub HighScoreCommitName()
  1814. HighScoreFlashTimer.Enabled = False
  1815. hsbModeActive = False
  1816.  
  1817. hsEnteredName = hsEnteredDigits(0) & hsEnteredDigits(1) & hsEnteredDigits(2)
  1818. if(hsEnteredName = " ") then
  1819. hsEnteredName = "YOU"
  1820. end if
  1821.  
  1822. HighScoreName(3) = hsEnteredName
  1823. SortHighscore
  1824. EndOfBallComplete()
  1825. End Sub
  1826.  
  1827. Sub SortHighscore
  1828. Dim tmp, tmp2, i, j
  1829. For i = 0 to 3
  1830. For j = 0 to 2
  1831. If HighScore(j) < HighScore(j + 1) Then
  1832. tmp = HighScore(j + 1)
  1833. tmp2 = HighScoreName(j + 1)
  1834. HighScore(j + 1) = HighScore(j)
  1835. HighScoreName(j + 1) = HighScoreName(j)
  1836. HighScore(j) = tmp
  1837. HighScoreName(j) = tmp2
  1838. End If
  1839. Next
  1840. Next
  1841. End Sub
  1842.  
  1843. '*********
  1844. ' LUT
  1845. '*********
  1846.  
  1847. Dim bLutActive, LUTImage
  1848. Sub LoadLUT
  1849. bLutActive = False
  1850. x = LoadValue(cGameName, "LUTImage")
  1851. If(x <> "") Then LUTImage = x Else LUTImage = 0
  1852. UpdateLUT
  1853. End Sub
  1854.  
  1855. Sub SaveLUT
  1856. SaveValue cGameName, "LUTImage", LUTImage
  1857. End Sub
  1858.  
  1859. Sub NextLUT:LUTImage = (LUTImage + 1) MOD 10:UpdateLUT:SaveLUT:End Sub
  1860.  
  1861. Sub UpdateLUT
  1862. Select Case LutImage
  1863. Case 0:table1.ColorGradeImage = "LUT0"
  1864. Case 1:table1.ColorGradeImage = "LUT1"
  1865. Case 2:table1.ColorGradeImage = "LUT2"
  1866. Case 3:table1.ColorGradeImage = "LUT3"
  1867. Case 4:table1.ColorGradeImage = "LUT4"
  1868. Case 5:table1.ColorGradeImage = "LUT5"
  1869. Case 6:table1.ColorGradeImage = "LUT6"
  1870. Case 7:table1.ColorGradeImage = "LUT7"
  1871. Case 8:table1.ColorGradeImage = "LUT8"
  1872. Case 9:table1.ColorGradeImage = "LUT9"
  1873. End Select
  1874. End Sub
  1875.  
  1876. ' *************************************************************************
  1877. ' JP's Reduced Display Driver Functions (based on script by Black)
  1878. ' only 5 effects: none, scroll left, scroll right, blink and blinkfast
  1879. ' 3 Lines, treats all 3 lines as text.
  1880. ' 1st and 2nd lines are 20 characters long
  1881. ' 3rd line is just 1 character
  1882. ' Example format:
  1883. ' DMD "text1","text2","backpicture", eNone, eNone, eNone, 250, True, "sound"
  1884. ' Short names:
  1885. ' dq = display queue
  1886. ' de = display effect
  1887. ' *************************************************************************
  1888.  
  1889. Const eNone = 0 ' Instantly displayed
  1890. Const eScrollLeft = 1 ' scroll on from the right
  1891. Const eScrollRight = 2 ' scroll on from the left
  1892. Const eBlink = 3 ' Blink (blinks for 'TimeOn')
  1893. Const eBlinkFast = 4 ' Blink (blinks for 'TimeOn') at user specified intervals (fast speed)
  1894.  
  1895. Const dqSize = 64
  1896.  
  1897. Dim dqHead
  1898. Dim dqTail
  1899. Dim deSpeed
  1900. Dim deBlinkSlowRate
  1901. Dim deBlinkFastRate
  1902.  
  1903. Dim dLine(2)
  1904. Dim deCount(2)
  1905. Dim deCountEnd(2)
  1906. Dim deBlinkCycle(2)
  1907.  
  1908. Dim dqText(2, 64)
  1909. Dim dqEffect(2, 64)
  1910. Dim dqTimeOn(64)
  1911. Dim dqbFlush(64)
  1912. Dim dqSound(64)
  1913.  
  1914. Dim FlexDMD
  1915. Dim DMDScene
  1916.  
  1917. Sub DMD_Init() 'default/startup values
  1918. If UseFlexDMD Then
  1919. Set FlexDMD = CreateObject("FlexDMD.FlexDMD")
  1920. If Not FlexDMD is Nothing Then
  1921. If FlexDMDHighQuality Then
  1922. FlexDMD.TableFile = Table1.Filename & ".vpx"
  1923. FlexDMD.RenderMode = 2
  1924. FlexDMD.Width = 256
  1925. FlexDMD.Height = 64
  1926. FlexDMD.Clear = True
  1927. FlexDMD.GameName = cGameName
  1928. FlexDMD.Run = True
  1929. Set DMDScene = FlexDMD.NewGroup("Scene")
  1930. DMDScene.AddActor FlexDMD.NewImage("Back", "VPX.d_border")
  1931. DMDScene.GetImage("Back").SetSize FlexDMD.Width, FlexDMD.Height
  1932. For i = 0 to 40
  1933. DMDScene.AddActor FlexDMD.NewImage("Dig" & i, "VPX.d_empty&dmd=2")
  1934. Digits(i).Visible = False
  1935. Next
  1936. digitgrid.Visible = False
  1937. For i = 0 to 19 ' Top
  1938. DMDScene.GetImage("Dig" & i).SetBounds 8 + i * 12, 6, 12, 22
  1939. Next
  1940. For i = 20 to 39 ' Bottom
  1941. DMDScene.GetImage("Dig" & i).SetBounds 8 + (i - 20) * 12, 34, 12, 22
  1942. Next
  1943. FlexDMD.LockRenderThread
  1944. FlexDMD.Stage.AddActor DMDScene
  1945. FlexDMD.UnlockRenderThread
  1946. Else
  1947. FlexDMD.TableFile = Table1.Filename & ".vpx"
  1948. FlexDMD.RenderMode = 2
  1949. FlexDMD.Width = 128
  1950. FlexDMD.Height = 32
  1951. FlexDMD.Clear = True
  1952. FlexDMD.GameName = cGameName
  1953. FlexDMD.Run = True
  1954. Set DMDScene = FlexDMD.NewGroup("Scene")
  1955. DMDScene.AddActor FlexDMD.NewImage("Back", "VPX.d_border")
  1956. DMDScene.GetImage("Back").SetSize FlexDMD.Width, FlexDMD.Height
  1957. For i = 0 to 40
  1958. DMDScene.AddActor FlexDMD.NewImage("Dig" & i, "VPX.d_empty&dmd=2")
  1959. Digits(i).Visible = False
  1960. Next
  1961. digitgrid.Visible = False
  1962. For i = 0 to 19 ' Top
  1963. DMDScene.GetImage("Dig" & i).SetBounds 4 + i * 6, 3, 6, 11
  1964. Next
  1965. For i = 20 to 39 ' Bottom
  1966. DMDScene.GetImage("Dig" & i).SetBounds 4 + (i - 20) * 6, 17, 6, 11
  1967. Next
  1968. FlexDMD.LockRenderThread
  1969. FlexDMD.Stage.AddActor DMDScene
  1970. FlexDMD.UnlockRenderThread
  1971. End If
  1972. End If
  1973. End If
  1974.  
  1975. Dim i, j
  1976. DMDFlush()
  1977. deSpeed = 20
  1978. deBlinkSlowRate = 10
  1979. deBlinkFastRate = 5
  1980. For i = 0 to 2
  1981. dLine(i) = Space(20)
  1982. deCount(i) = 0
  1983. deCountEnd(i) = 0
  1984. deBlinkCycle(i) = 0
  1985. dqTimeOn(i) = 0
  1986. dqbFlush(i) = True
  1987. dqSound(i) = ""
  1988. Next
  1989. dLine(2) = " "
  1990. For i = 0 to 2
  1991. For j = 0 to 64
  1992. dqText(i, j) = ""
  1993. dqEffect(i, j) = eNone
  1994. Next
  1995. Next
  1996. DMD dLine(0), dLine(1), dLine(2), eNone, eNone, eNone, 25, True, ""
  1997. End Sub
  1998.  
  1999. Sub DMDFlush()
  2000. Dim i
  2001. DMDTimer.Enabled = False
  2002. DMDEffectTimer.Enabled = False
  2003. dqHead = 0
  2004. dqTail = 0
  2005. For i = 0 to 2
  2006. deCount(i) = 0
  2007. deCountEnd(i) = 0
  2008. deBlinkCycle(i) = 0
  2009. Next
  2010. End Sub
  2011.  
  2012. Sub DMDScore()
  2013. Dim tmp, tmp1, tmp1a, tmp1b, tmp2
  2014. if(dqHead = dqTail) Then
  2015. 'tmp = FL("P" &CurrentPlayer& " B" &Balls, FormatScore(Score(Currentplayer) ) )
  2016. 'tmp = CL(FormatScore(Score(Currentplayer) ) )
  2017. 'tmp1 = CL("PLAYER " & CurrentPlayer & " BALL " & Balls)
  2018. 'tmp1 = FormatScore(Bonuspoints(Currentplayer) ) & " X" &BonusMultiplier(Currentplayer)
  2019. If bJasonMBStarted Then
  2020. tmp2 = "d_jason"
  2021. ElseIf bFreddyMBStarted Then
  2022. tmp2 = "d_freddy"
  2023. ElseIf bMichaelMBStarted Then
  2024. tmp2 = "d_michael"
  2025. Else
  2026. tmp2 = "d_border"
  2027. End If
  2028. Select Case Mode(CurrentPlayer, 0)
  2029. Case 0: 'no Mode active
  2030. tmp = RL(FormatScore(Score(Currentplayer) ) )
  2031. tmp1 = FL("PLAYER " &CurrentPlayer, "BALL " & Balls)
  2032. End Select
  2033. End If
  2034. DMD tmp, tmp1, tmp2, eNone, eNone, eNone, 25, True, ""
  2035. End Sub
  2036.  
  2037. Sub DMDScoreNow
  2038. DMDFlush
  2039. DMDScore
  2040. End Sub
  2041.  
  2042. Sub DMD(Text0, Text1, Text2, Effect0, Effect1, Effect2, TimeOn, bFlush, Sound)
  2043. if(dqTail < dqSize) Then
  2044. if(Text0 = "_") Then
  2045. dqEffect(0, dqTail) = eNone
  2046. dqText(0, dqTail) = "_"
  2047. Else
  2048. dqEffect(0, dqTail) = Effect0
  2049. dqText(0, dqTail) = ExpandLine(Text0)
  2050. End If
  2051.  
  2052. if(Text1 = "_") Then
  2053. dqEffect(1, dqTail) = eNone
  2054. dqText(1, dqTail) = "_"
  2055. Else
  2056. dqEffect(1, dqTail) = Effect1
  2057. dqText(1, dqTail) = ExpandLine(Text1)
  2058. End If
  2059.  
  2060. if(Text2 = "_") Then
  2061. dqEffect(2, dqTail) = eNone
  2062. dqText(2, dqTail) = "_"
  2063. Else
  2064. dqEffect(2, dqTail) = Effect2
  2065. dqText(2, dqTail) = Text2 'it is always 1 letter in this table
  2066. End If
  2067.  
  2068. dqTimeOn(dqTail) = TimeOn
  2069. dqbFlush(dqTail) = bFlush
  2070. dqSound(dqTail) = Sound
  2071. dqTail = dqTail + 1
  2072. if(dqTail = 1) Then
  2073. DMDHead()
  2074. End If
  2075. End If
  2076. End Sub
  2077.  
  2078. Sub DMDHead()
  2079. Dim i
  2080. deCount(0) = 0
  2081. deCount(1) = 0
  2082. deCount(2) = 0
  2083. DMDEffectTimer.Interval = deSpeed
  2084.  
  2085. For i = 0 to 2
  2086. Select Case dqEffect(i, dqHead)
  2087. Case eNone:deCountEnd(i) = 1
  2088. Case eScrollLeft:deCountEnd(i) = Len(dqText(i, dqHead) )
  2089. Case eScrollRight:deCountEnd(i) = Len(dqText(i, dqHead) )
  2090. Case eBlink:deCountEnd(i) = int(dqTimeOn(dqHead) / deSpeed)
  2091. deBlinkCycle(i) = 0
  2092. Case eBlinkFast:deCountEnd(i) = int(dqTimeOn(dqHead) / deSpeed)
  2093. deBlinkCycle(i) = 0
  2094. End Select
  2095. Next
  2096. if(dqSound(dqHead) <> "") Then
  2097. PlaySound(dqSound(dqHead) )
  2098. End If
  2099. DMDEffectTimer.Enabled = True
  2100. End Sub
  2101.  
  2102. Sub DMDEffectTimer_Timer()
  2103. DMDEffectTimer.Enabled = False
  2104. DMDProcessEffectOn()
  2105. End Sub
  2106.  
  2107. Sub DMDTimer_Timer()
  2108. Dim Head
  2109. DMDTimer.Enabled = False
  2110. Head = dqHead
  2111. dqHead = dqHead + 1
  2112. if(dqHead = dqTail) Then
  2113. if(dqbFlush(Head) = True) Then
  2114. DMDScoreNow()
  2115. Else
  2116. dqHead = 0
  2117. DMDHead()
  2118. End If
  2119. Else
  2120. DMDHead()
  2121. End If
  2122. End Sub
  2123.  
  2124. Sub DMDProcessEffectOn()
  2125. Dim i
  2126. Dim BlinkEffect
  2127. Dim Temp
  2128.  
  2129. BlinkEffect = False
  2130.  
  2131. For i = 0 to 2
  2132. if(deCount(i) <> deCountEnd(i) ) Then
  2133. deCount(i) = deCount(i) + 1
  2134.  
  2135. select case(dqEffect(i, dqHead) )
  2136. case eNone:
  2137. Temp = dqText(i, dqHead)
  2138. case eScrollLeft:
  2139. Temp = Right(dLine(i), 19)
  2140. Temp = Temp & Mid(dqText(i, dqHead), deCount(i), 1)
  2141. case eScrollRight:
  2142. Temp = Mid(dqText(i, dqHead), 21 - deCount(i), 1)
  2143. Temp = Temp & Left(dLine(i), 19)
  2144. case eBlink:
  2145. BlinkEffect = True
  2146. if((deCount(i) MOD deBlinkSlowRate) = 0) Then
  2147. deBlinkCycle(i) = deBlinkCycle(i) xor 1
  2148. End If
  2149.  
  2150. if(deBlinkCycle(i) = 0) Then
  2151. Temp = dqText(i, dqHead)
  2152. Else
  2153. Temp = Space(20)
  2154. End If
  2155. case eBlinkFast:
  2156. BlinkEffect = True
  2157. if((deCount(i) MOD deBlinkFastRate) = 0) Then
  2158. deBlinkCycle(i) = deBlinkCycle(i) xor 1
  2159. End If
  2160.  
  2161. if(deBlinkCycle(i) = 0) Then
  2162. Temp = dqText(i, dqHead)
  2163. Else
  2164. Temp = Space(20)
  2165. End If
  2166. End Select
  2167.  
  2168. if(dqText(i, dqHead) <> "_") Then
  2169. dLine(i) = Temp
  2170. DMDUpdate i
  2171. End If
  2172. End If
  2173. Next
  2174.  
  2175. if(deCount(0) = deCountEnd(0) ) and(deCount(1) = deCountEnd(1) ) and(deCount(2) = deCountEnd(2) ) Then
  2176.  
  2177. if(dqTimeOn(dqHead) = 0) Then
  2178. DMDFlush()
  2179. Else
  2180. if(BlinkEffect = True) Then
  2181. DMDTimer.Interval = 10
  2182. Else
  2183. DMDTimer.Interval = dqTimeOn(dqHead)
  2184. End If
  2185.  
  2186. DMDTimer.Enabled = True
  2187. End If
  2188. Else
  2189. DMDEffectTimer.Enabled = True
  2190. End If
  2191. End Sub
  2192.  
  2193. Function ExpandLine(TempStr) 'id is the number of the dmd line
  2194. If TempStr = "" Then
  2195. TempStr = Space(20)
  2196. Else
  2197. if Len(TempStr) > Space(20) Then
  2198. TempStr = Left(TempStr, Space(20) )
  2199. Else
  2200. if(Len(TempStr) < 20) Then
  2201. TempStr = TempStr & Space(20 - Len(TempStr) )
  2202. End If
  2203. End If
  2204. End If
  2205. ExpandLine = TempStr
  2206. End Function
  2207.  
  2208. Function FormatScore(ByVal Num) 'it returns a string with commas (as in Black's original font)
  2209. dim i
  2210. dim NumString
  2211.  
  2212. NumString = CStr(abs(Num) )
  2213.  
  2214. For i = Len(NumString) -3 to 1 step -3
  2215. if IsNumeric(mid(NumString, i, 1) ) then
  2216. NumString = left(NumString, i-1) & chr(asc(mid(NumString, i, 1) ) + 48) & right(NumString, Len(NumString) - i)
  2217. end if
  2218. Next
  2219. FormatScore = NumString
  2220. End function
  2221.  
  2222. Function FL(NumString1, NumString2) 'Fill line
  2223. Dim Temp, TempStr
  2224. Temp = 20 - Len(NumString1) - Len(NumString2)
  2225. TempStr = NumString1 & Space(Temp) & NumString2
  2226. FL = TempStr
  2227. End Function
  2228.  
  2229. Function CL(NumString) 'center line
  2230. Dim Temp, TempStr
  2231. Temp = (20 - Len(NumString) ) \ 2
  2232. TempStr = Space(Temp) & NumString & Space(Temp)
  2233. CL = TempStr
  2234. End Function
  2235.  
  2236. Function RL(NumString) 'right line
  2237. Dim Temp, TempStr
  2238. Temp = 20 - Len(NumString)
  2239. TempStr = Space(Temp) & NumString
  2240. RL = TempStr
  2241. End Function
  2242.  
  2243. '**************
  2244. ' Update DMD
  2245. '**************
  2246.  
  2247. Sub DMDUpdate(id)
  2248. Dim digit, value
  2249. If UseFlexDMD Then FlexDMD.LockRenderThread
  2250. Select Case id
  2251. Case 0 'top text line
  2252. For digit = 0 to 19
  2253. DMDDisplayChar mid(dLine(0), digit + 1, 1), digit
  2254. Next
  2255. Case 1 'bottom text line
  2256. For digit = 20 to 39
  2257. DMDDisplayChar mid(dLine(1), digit -19, 1), digit
  2258. Next
  2259. Case 2 ' back image - back animations
  2260. If dLine(2) = "" OR dLine(2) = " " Then dLine(2) = "d_border"
  2261. Digits(40).ImageA = dLine(2)
  2262. If UseFlexDMD Then DMDScene.GetImage("Back").Bitmap = FlexDMD.NewImage("", "VPX." & dLine(2) & "&dmd=2").Bitmap
  2263. End Select
  2264. If UseFlexDMD Then FlexDMD.UnlockRenderThread
  2265. End Sub
  2266.  
  2267. Sub DMDDisplayChar(achar, adigit)
  2268. If achar = "" Then achar = " "
  2269. achar = ASC(achar)
  2270. Digits(adigit).ImageA = Chars(achar)
  2271. If UseFlexDMD Then DMDScene.GetImage("Dig" & adigit).Bitmap = FlexDMD.NewImage("", "VPX." & Chars(achar) & "&dmd=2&add").Bitmap
  2272. End Sub
  2273.  
  2274. '****************************
  2275. ' JP's new DMD using flashers
  2276. '****************************
  2277.  
  2278. Dim Digits, Chars(255), Images(255)
  2279.  
  2280. DMDInit
  2281.  
  2282. Sub DMDInit
  2283. Dim i
  2284. Digits = Array(digit001, digit002, digit003, digit004, digit005, digit006, digit007, digit008, digit009, digit010, _
  2285. digit011, digit012, digit013, digit014, digit015, digit016, digit017, digit018, digit019, digit020, _
  2286. digit021, digit022, digit023, digit024, digit025, digit026, digit027, digit028, digit029, digit030, _
  2287. digit031, digit032, digit033, digit034, digit035, digit036, digit037, digit038, digit039, digit040, _
  2288. digit041)
  2289. For i = 0 to 255:Chars(i) = "d_empty":Next
  2290.  
  2291. Chars(32) = "d_empty"
  2292. Chars(33) = "" '!
  2293. Chars(34) = "" '"
  2294. Chars(35) = "" '#
  2295. Chars(36) = "" '$
  2296. Chars(37) = "" '%
  2297. Chars(38) = "" '&
  2298. Chars(39) = "" ''
  2299. Chars(40) = "" '(
  2300. Chars(41) = "" ')
  2301. Chars(42) = "" '*
  2302. Chars(43) = "" '+
  2303. Chars(44) = "" '
  2304. Chars(45) = "" '-
  2305. Chars(46) = "d_dot" '.
  2306. Chars(47) = "" '/
  2307. Chars(48) = "d_0" '0
  2308. Chars(49) = "d_1" '1
  2309. Chars(50) = "d_2" '2
  2310. Chars(51) = "d_3" '3
  2311. Chars(52) = "d_4" '4
  2312. Chars(53) = "d_5" '5
  2313. Chars(54) = "d_6" '6
  2314. Chars(55) = "d_7" '7
  2315. Chars(56) = "d_8" '8
  2316. Chars(57) = "d_9" '9
  2317. Chars(60) = "d_less" '<
  2318. Chars(61) = "" '=
  2319. Chars(62) = "d_more" '>
  2320. Chars(64) = "" '@
  2321. Chars(65) = "d_a" 'A
  2322. Chars(66) = "d_b" 'B
  2323. Chars(67) = "d_c" 'C
  2324. Chars(68) = "d_d" 'D
  2325. Chars(69) = "d_e" 'E
  2326. Chars(70) = "d_f" 'F
  2327. Chars(71) = "d_g" 'G
  2328. Chars(72) = "d_h" 'H
  2329. Chars(73) = "d_i" 'I
  2330. Chars(74) = "d_j" 'J
  2331. Chars(75) = "d_k" 'K
  2332. Chars(76) = "d_l" 'L
  2333. Chars(77) = "d_m" 'M
  2334. Chars(78) = "d_n" 'N
  2335. Chars(79) = "d_o" 'O
  2336. Chars(80) = "d_p" 'P
  2337. Chars(81) = "d_q" 'Q
  2338. Chars(82) = "d_r" 'R
  2339. Chars(83) = "d_s" 'S
  2340. Chars(84) = "d_t" 'T
  2341. Chars(85) = "d_u" 'U
  2342. Chars(86) = "d_v" 'V
  2343. Chars(87) = "d_w" 'W
  2344. Chars(88) = "d_x" 'X
  2345. Chars(89) = "d_y" 'Y
  2346. Chars(90) = "d_z" 'Z
  2347. Chars(94) = "d_up" '^
  2348. ' Chars(95) = '_
  2349. Chars(96) = "d_0a" '0.
  2350. Chars(97) = "d_1a" '1. 'a
  2351. Chars(98) = "d_2a" '2. 'b
  2352. Chars(99) = "d_3a" '3. 'c
  2353. Chars(100) = "d_4a" '4. 'd
  2354. Chars(101) = "d_5a" '5. 'e
  2355. Chars(102) = "d_6a" '6. 'f
  2356. Chars(103) = "d_7a" '7. 'g
  2357. Chars(104) = "d_8a" '8. 'h
  2358. Chars(105) = "d_9a" '9. 'i
  2359. Chars(106) = "" 'j
  2360. Chars(107) = "" 'k
  2361. Chars(108) = "" 'l
  2362. Chars(109) = "" 'm
  2363. Chars(110) = "" 'n
  2364. Chars(111) = "" 'o
  2365. Chars(112) = "" 'p
  2366. Chars(113) = "" 'q
  2367. Chars(114) = "" 'r
  2368. Chars(115) = "" 's
  2369. Chars(116) = "" 't
  2370. Chars(117) = "" 'u
  2371. Chars(118) = "" 'v
  2372. Chars(119) = "" 'w
  2373. Chars(120) = "" 'x
  2374. Chars(121) = "" 'y
  2375. Chars(122) = "" 'z
  2376. Chars(123) = "" '{
  2377. Chars(124) = "" '|
  2378. Chars(125) = "" '}
  2379. Chars(126) = "" '~
  2380. End Sub
  2381.  
  2382. '********************
  2383. ' Real Time updates
  2384. '********************
  2385. 'used for all the real time updates
  2386.  
  2387. Sub Realtime_Timer
  2388. RollingUpdate
  2389. LeftFlipperTop.RotZ = LeftFlipper.CurrentAngle
  2390. LeftFlipperTop001.RotZ = LeftFlipper001.CurrentAngle
  2391. RightFlipperTop.RotZ = RightFlipper.CurrentAngle
  2392. ' add any other real time update subs, like gates or diverters, flippers
  2393. End Sub
  2394.  
  2395. '********************************************************************************************
  2396. ' Only for VPX 10.2 and higher.
  2397. ' FlashForMs will blink light or a flasher for TotalPeriod(ms) at rate of BlinkPeriod(ms)
  2398. ' When TotalPeriod done, light or flasher will be set to FinalState value where
  2399. ' Final State values are: 0=Off, 1=On, 2=Return to previous State
  2400. '********************************************************************************************
  2401.  
  2402. Sub FlashForMs(MyLight, TotalPeriod, BlinkPeriod, FinalState) 'thanks gtxjoe for the first version
  2403.  
  2404. If TypeName(MyLight) = "Light" Then
  2405.  
  2406. If FinalState = 2 Then
  2407. FinalState = MyLight.State 'Keep the current light state
  2408. End If
  2409. MyLight.BlinkInterval = BlinkPeriod
  2410. MyLight.Duration 2, TotalPeriod, FinalState
  2411. ElseIf TypeName(MyLight) = "Flasher" Then
  2412.  
  2413. Dim steps
  2414.  
  2415. ' Store all blink information
  2416. steps = Int(TotalPeriod / BlinkPeriod + .5) 'Number of ON/OFF steps to perform
  2417. If FinalState = 2 Then 'Keep the current flasher state
  2418. FinalState = ABS(MyLight.Visible)
  2419. End If
  2420. MyLight.UserValue = steps * 10 + FinalState 'Store # of blinks, and final state
  2421.  
  2422. ' Start blink timer and create timer subroutine
  2423. MyLight.TimerInterval = BlinkPeriod
  2424. MyLight.TimerEnabled = 0
  2425. MyLight.TimerEnabled = 1
  2426. ExecuteGlobal "Sub " & MyLight.Name & "_Timer:" & "Dim tmp, steps, fstate:tmp=me.UserValue:fstate = tmp MOD 10:steps= tmp\10 -1:Me.Visible = steps MOD 2:me.UserValue = steps *10 + fstate:If Steps = 0 then Me.Visible = fstate:Me.TimerEnabled=0:End if:End Sub"
  2427. End If
  2428. End Sub
  2429.  
  2430. '******************************************
  2431. ' Change light color - simulate color leds
  2432. ' changes the light color and state
  2433. ' 11 colors: red, orange, amber, yellow...
  2434. '******************************************
  2435.  
  2436. 'colors
  2437. Const red = 5
  2438. Const orange = 4
  2439. Const amber = 6
  2440. Const yellow = 3
  2441. Const darkgreen = 7
  2442. Const green = 2
  2443. Const blue = 1
  2444. Const darkblue = 8
  2445. Const purple = 9
  2446. Const white = 11
  2447. Const teal = 10
  2448.  
  2449. Sub SetLightColor(n, col, stat) 'stat 0 = off, 1 = on, 2 = blink, -1= no change
  2450. Select Case col
  2451. Case red
  2452. n.color = RGB(18, 0, 0)
  2453. n.colorfull = RGB(255, 0, 0)
  2454. Case orange
  2455. n.color = RGB(18, 3, 0)
  2456. n.colorfull = RGB(255, 64, 0)
  2457. Case amber
  2458. n.color = RGB(193, 49, 0)
  2459. n.colorfull = RGB(255, 153, 0)
  2460. Case yellow
  2461. n.color = RGB(18, 18, 0)
  2462. n.colorfull = RGB(255, 255, 0)
  2463. Case darkgreen
  2464. n.color = RGB(0, 8, 0)
  2465. n.colorfull = RGB(0, 64, 0)
  2466. Case green
  2467. n.color = RGB(0, 16, 0)
  2468. n.colorfull = RGB(0, 128, 0)
  2469. Case blue
  2470. n.color = RGB(0, 18, 18)
  2471. n.colorfull = RGB(0, 255, 255)
  2472. Case darkblue
  2473. n.color = RGB(0, 8, 8)
  2474. n.colorfull = RGB(0, 64, 64)
  2475. Case purple
  2476. n.color = RGB(64, 0, 96)
  2477. n.colorfull = RGB(128, 0, 192)
  2478. Case white
  2479. n.color = RGB(193, 91, 0)
  2480. n.colorfull = RGB(255, 197, 143)
  2481. Case teal
  2482. n.color = RGB(1, 64, 62)
  2483. n.colorfull = RGB(2, 128, 126)
  2484. End Select
  2485. If stat <> -1 Then
  2486. n.State = 0
  2487. n.State = stat
  2488. End If
  2489. End Sub
  2490.  
  2491. Sub SetFlashColor(n, col, stat) 'stat 0 = off, 1 = on, -1= no change - no blink for the flashers, use FlashForMs
  2492. Select Case col
  2493. Case red
  2494. n.color = RGB(255, 0, 0)
  2495. Case orange
  2496. n.color = RGB(255, 64, 0)
  2497. Case amber
  2498. n.color = RGB(255, 153, 0)
  2499. Case yellow
  2500. n.color = RGB(255, 255, 0)
  2501. Case darkgreen
  2502. n.color = RGB(0, 64, 0)
  2503. Case green
  2504. n.color = RGB(0, 128, 0)
  2505. Case blue
  2506. n.color = RGB(0, 255, 255)
  2507. Case darkblue
  2508. n.color = RGB(0, 64, 64)
  2509. Case purple
  2510. n.color = RGB(128, 0, 192)
  2511. Case white
  2512. n.color = RGB(255, 197, 143)
  2513. Case teal
  2514. n.color = RGB(2, 128, 126)
  2515. End Select
  2516. If stat <> -1 Then
  2517. n.Visible = stat
  2518. End If
  2519. End Sub
  2520.  
  2521. '*************************
  2522. ' Rainbow Changing Lights
  2523. '*************************
  2524.  
  2525. Dim RGBStep, RGBFactor, rRed, rGreen, rBlue, RainbowLights
  2526.  
  2527. Sub StartRainbow(n) 'n is a collection
  2528. set RainbowLights = n
  2529. RGBStep = 0
  2530. RGBFactor = 5
  2531. rRed = 255
  2532. rGreen = 0
  2533. rBlue = 0
  2534. RainbowTimer.Enabled = 1
  2535. End Sub
  2536.  
  2537. Sub StopRainbow()
  2538. RainbowTimer.Enabled = 0
  2539. TurnOffArrows
  2540. End Sub
  2541.  
  2542. Sub TurnOffArrows() 'during Modes when changing modes
  2543. For each x in aArrows
  2544. SetLightColor x, white, 0
  2545. Next
  2546. End Sub
  2547.  
  2548. Sub RainbowTimer_Timer 'rainbow led light color changing
  2549. Dim obj
  2550. Select Case RGBStep
  2551. Case 0 'Green
  2552. rGreen = rGreen + RGBFactor
  2553. If rGreen > 255 then
  2554. rGreen = 255
  2555. RGBStep = 1
  2556. End If
  2557. Case 1 'Red
  2558. rRed = rRed - RGBFactor
  2559. If rRed < 0 then
  2560. rRed = 0
  2561. RGBStep = 2
  2562. End If
  2563. Case 2 'Blue
  2564. rBlue = rBlue + RGBFactor
  2565. If rBlue > 255 then
  2566. rBlue = 255
  2567. RGBStep = 3
  2568. End If
  2569. Case 3 'Green
  2570. rGreen = rGreen - RGBFactor
  2571. If rGreen < 0 then
  2572. rGreen = 0
  2573. RGBStep = 4
  2574. End If
  2575. Case 4 'Red
  2576. rRed = rRed + RGBFactor
  2577. If rRed > 255 then
  2578. rRed = 255
  2579. RGBStep = 5
  2580. End If
  2581. Case 5 'Blue
  2582. rBlue = rBlue - RGBFactor
  2583. If rBlue < 0 then
  2584. rBlue = 0
  2585. RGBStep = 0
  2586. End If
  2587. End Select
  2588. For each obj in RainbowLights
  2589. obj.color = RGB(rRed \ 10, rGreen \ 10, rBlue \ 10)
  2590. obj.colorfull = RGB(rRed, rGreen, rBlue)
  2591. Next
  2592. End Sub
  2593.  
  2594. ' ********************************
  2595. ' Table info & Attract Mode
  2596. ' ********************************
  2597.  
  2598. Sub ShowTableInfo
  2599. Dim ii
  2600. 'info goes in a loop only stopped by the credits and the startkey
  2601. If Score(1) Then
  2602. DMD CL("LAST SCORE"), CL("PLAYER 1 " &FormatScore(Score(1) ) ), "", eNone, eNone, eNone, 3000, False, ""
  2603. End If
  2604. If Score(2) Then
  2605. DMD CL("LAST SCORE"), CL("PLAYER 2 " &FormatScore(Score(2) ) ), "", eNone, eNone, eNone, 3000, False, ""
  2606. End If
  2607. If Score(3) Then
  2608. DMD CL("LAST SCORE"), CL("PLAYER 3 " &FormatScore(Score(3) ) ), "", eNone, eNone, eNone, 3000, False, ""
  2609. End If
  2610. If Score(4) Then
  2611. DMD CL("LAST SCORE"), CL("PLAYER 4 " &FormatScore(Score(4) ) ), "", eNone, eNone, eNone, 3000, False, ""
  2612. End If
  2613. DMD "", CL("GAME OVER"), "", eNone, eBlink, eNone, 2000, False, ""
  2614. If bFreePlay Then
  2615. DMD "", CL("FREE PLAY"), "", eNone, eBlink, eNone, 2000, False, ""
  2616. Else
  2617. If Credits > 0 Then
  2618. DMD CL("CREDITS " & Credits), CL("PRESS START"), "", eNone, eBlink, eNone, 2000, False, ""
  2619. Else
  2620. DMD CL("CREDITS " & Credits), CL("INSERT COIN"), "", eNone, eBlink, eNone, 2000, False, ""
  2621. End If
  2622. End If
  2623. DMD " JPSALAS", " PRESENTS", "d_jppresents", eNone, eNone, eNone, 3000, False, ""
  2624. DMD "", "", "d_title", eNone, eNone, eNone, 4000, False, ""
  2625. DMD "", CL("ROM VERSION " &myversion), "", eNone, eNone, eNone, 2000, False, ""
  2626. DMD CL("HIGHSCORES"), Space(20), "", eScrollLeft, eScrollLeft, eNone, 20, False, ""
  2627. DMD CL("HIGHSCORES"), "", "", eBlinkFast, eNone, eNone, 1000, False, ""
  2628. DMD CL("HIGHSCORES"), "1> " &HighScoreName(0) & " " &FormatScore(HighScore(0) ), "", eNone, eScrollLeft, eNone, 2000, False, ""
  2629. DMD "_", "2> " &HighScoreName(1) & " " &FormatScore(HighScore(1) ), "", eNone, eScrollLeft, eNone, 2000, False, ""
  2630. DMD "_", "3> " &HighScoreName(2) & " " &FormatScore(HighScore(2) ), "", eNone, eScrollLeft, eNone, 2000, False, ""
  2631. DMD "_", "4> " &HighScoreName(3) & " " &FormatScore(HighScore(3) ), "", eNone, eScrollLeft, eNone, 2000, False, ""
  2632. DMD Space(20), Space(20), "", eScrollLeft, eScrollLeft, eNone, 500, False, ""
  2633. End Sub
  2634.  
  2635. Sub StartAttractMode
  2636. StartLightSeq
  2637. StartRainbow aArrows
  2638. DMDFlush
  2639. ShowTableInfo
  2640. PlaySong "mu_gameover"
  2641. End Sub
  2642.  
  2643. Sub StopAttractMode
  2644. StopRainbow
  2645. DMDScoreNow
  2646. LightSeqAttract.StopPlay
  2647. End Sub
  2648.  
  2649. Sub StartLightSeq()
  2650. 'lights sequences
  2651. LightSeqAttract.UpdateInterval = 10
  2652. 'LightSeqAttract.Play SeqAllOff
  2653. LightSeqAttract.Play SeqDiagUpRightOn, 25, 2
  2654. LightSeqAttract.Play SeqStripe1VertOn, 25
  2655. LightSeqAttract.Play SeqClockRightOn, 180, 2
  2656. LightSeqAttract.Play SeqFanLeftUpOn, 50, 2
  2657. LightSeqAttract.Play SeqFanRightUpOn, 50, 2
  2658. LightSeqAttract.Play SeqScrewRightOn, 50, 2
  2659.  
  2660. LightSeqAttract.Play SeqDiagDownLeftOn, 25, 2
  2661. LightSeqAttract.Play SeqStripe2VertOn, 25, 2
  2662. LightSeqAttract.Play SeqFanLeftDownOn, 50, 2
  2663. LightSeqAttract.Play SeqFanRightDownOn, 50, 2
  2664. End Sub
  2665.  
  2666. Sub LightSeqAttract_PlayDone()
  2667. StartLightSeq()
  2668. End Sub
  2669.  
  2670. Sub LightSeqTilt_PlayDone()
  2671. LightSeqTilt.Play SeqAllOff
  2672. End Sub
  2673.  
  2674. Sub LightSeqSkillshot_PlayDone()
  2675. LightSeqSkillshot.Play SeqAllOff
  2676. End Sub
  2677.  
  2678. '***********************************************************************
  2679. ' *********************************************************************
  2680. ' Table Specific Script Starts Here
  2681. ' *********************************************************************
  2682. '***********************************************************************
  2683.  
  2684. ' droptargets, animations, timers, etc
  2685. Sub VPObjects_Init
  2686. End Sub
  2687.  
  2688. ' tables variables and Mode init
  2689. Dim bRotateLights
  2690. Dim Mode(4, 14) 'the first 4 is the current player, contains status of the Mode, 0 not started, 1 won, 2 started
  2691. Dim Weapons(4) ' collected weapons
  2692. Dim LoopCount
  2693. Dim LoopHits(4)
  2694. Dim LoopValue(4)
  2695. Dim ComboCount
  2696. Dim ComboHits(4)
  2697. Dim ComboValue(4)
  2698. Dim Mystery(4, 4) 'inlane lights for each player
  2699. Dim BumperHits(4)
  2700. Dim BumperNeededHits(4)
  2701. Dim TargetHits(4, 7) '6 targets + the bumper -the blue lights
  2702. Dim WeaponHits(4, 6) '6 lights, lanes and the magnet post
  2703. Dim aWeaponSJactive
  2704. Dim WeaponSJValue(4)
  2705. Dim bPoliceStarted
  2706. Dim PoliceRampHits
  2707. Dim PoliceTargetHits
  2708. Dim PoliceCount 'counts the seconds, used for the police jackpot
  2709. Dim TeensKilled(4)
  2710. Dim TeensKilledValue(4)
  2711. Dim CounselorsKilled(4)
  2712. Dim CenterSpinnerHits(4)
  2713. Dim LeftSpinnerHits(4)
  2714. Dim RightSpinnerHits(4)
  2715. Dim TargetJackpot(4)
  2716. Dim bJasonMBStarted
  2717. Dim bFreddyMBStarted
  2718. Dim bMichaelMBStarted
  2719. Dim ArrowMultiPlier(8) 'used for the Jackpot multiplier and the color for the Jason MB arrow lights
  2720. Dim FreddySJValue
  2721. Dim MichaelSJValue
  2722.  
  2723. Sub Game_Init() 'called at the start of a new game
  2724. Dim i, j
  2725. bExtraBallWonThisBall = False
  2726. TurnOffPlayfieldLights()
  2727.  
  2728. 'Init Variables
  2729. bRotateLights = True
  2730. aWeaponSJactive = False
  2731. bPoliceStarted = False
  2732. PoliceRampHits = 0
  2733. PoliceTargetHits = 0
  2734. bJasonMBStarted = False
  2735. bFreddyMBStarted = False
  2736. bMichaelMBStarted = False
  2737. FreddySJValue = 1000000
  2738. MichaelSJValue = 1000000
  2739. For i = 0 to 4
  2740. SkillShotValue(i) = 500000
  2741. SuperSkillShotValue(i) = 1000000
  2742. LoopValue(i) = 500000
  2743. ComboValue(i) = 500000
  2744. BumperHits(i) = 0
  2745. BumperNeededHits(i) = 10
  2746. Weapons(i) = 0
  2747. WeaponSJValue(i) = 3500000
  2748. TeensKilled(i) = 0
  2749. TeensKilledValue(i) = 250000
  2750. CounselorsKilled(i) = 0
  2751. LoopHits(i) = 0
  2752. ComboHits(i) = 0
  2753. CenterSpinnerHits(i) = 0
  2754. LeftSpinnerHits(i) = 0
  2755. RightSpinnerHits(i) = 0
  2756. TargetJackpot(i) = 500000
  2757. BallsInLock(i) = 0
  2758. ArrowMultiPlier(i) = 1
  2759. Next
  2760. For i = 0 to 4
  2761. For j = 0 to 4
  2762. Mystery(i, j) = 0
  2763. Next
  2764. Next
  2765. For i = 0 to 4
  2766. For j = 0 to 14
  2767. Mode(i, j) = 0
  2768. Next
  2769. Next
  2770. For i = 0 to 4
  2771. For j = 0 to 7
  2772. TargetHits(i, j) = 1
  2773. Next
  2774. Next
  2775. For i = 0 to 4
  2776. For j = 0 to 6
  2777. WeaponHits(i, j) = 1
  2778. Next
  2779. Next
  2780. LoopCount = 0
  2781. ComboCount = 0
  2782. TeenTimer.Enabled = 1
  2783. End Sub
  2784.  
  2785. Sub InstantInfo
  2786. Dim tmp
  2787. DMD CL("INSTANT INFO"), "", "", eNone, eNone, eNone, 1000, False, ""
  2788. DMD CL("YOUR SCORE"), CL(FormatScore(Score(CurrentPlayer) ) ), "", eNone, eNone, eNone, 2000, False, ""
  2789. DMD CL("EXTRA BALLS"), CL(ExtraBallsAwards(CurrentPlayer) ), "", eNone, eNone, eNone, 2000, False, ""
  2790. DMD CL("PLAYFIELD MULT"), CL("X " &PlayfieldMultiplier(CurrentPlayer) ), "", eNone, eNone, eNone, 2000, False, ""
  2791. DMD CL("BONUS MULT"), CL("X " &BonusMultiplier(CurrentPlayer) ), "", eNone, eNone, eNone, 2000, False, ""
  2792. DMD CL("SKILLSHOT VALUE"), CL(FormatScore(SkillshotValue(CurrentPlayer) ) ), "", eNone, eNone, eNone, 2000, False, ""
  2793. DMD CL("SUPR SKILLSHOT VALUE"), CL(FormatScore(SuperSkillshotValue(CurrentPlayer) ) ), "", eNone, eNone, eNone, 2000, False, ""
  2794. DMD CL("RAMP COMBO VALUE"), CL(FormatScore(ComboValue(CurrentPlayer) ) ), "", eNone, eNone, eNone, 2000, False, ""
  2795. DMD CL("LOOP COMBO VALUE"), CL(FormatScore(LoopValue(CurrentPlayer) ) ), "", eNone, eNone, eNone, 2000, False, ""
  2796. DMD CL("WEAPONS SUPR JACKPOT"), CL(FormatScore(WeaponSJValue(CurrentPlayer) ) ), "", eNone, eNone, eNone, 2000, False, ""
  2797. DMD CL("TARGET JACKPOT"), CL(FormatScore(TargetJackpot(CurrentPlayer) ) ), "", eNone, eNone, eNone, 2000, False, ""
  2798. If Score(1) Then
  2799. DMD CL("PLAYER 1 SCORE"), CL(FormatScore(Score(1) ) ), "", eNone, eNone, eNone, 2000, False, ""
  2800. End If
  2801. If Score(2) Then
  2802. DMD CL("PLAYER 2 SCORE"), CL(FormatScore(Score(2) ) ), "", eNone, eNone, eNone, 2000, False, ""
  2803. End If
  2804. If Score(3) Then
  2805. DMD CL("PLAYER 3 SCORE"), CL(FormatScore(Score(3) ) ), "", eNone, eNone, eNone, 2000, False, ""
  2806. End If
  2807. If Score(4) Then
  2808. DMD CL("PLAYER 4 SCORE"), CL(FormatScore(Score(4) ) ), "", eNone, eNone, eNone, 2000, False, ""
  2809. End If
  2810. End Sub
  2811.  
  2812. Sub StopMBmodes 'stop multiball modes after loosing the last multibal
  2813. If bJasonMBStarted Then StopJasonMultiball
  2814. If bFreddyMBStarted Then StopFreddyMultiball
  2815. End Sub
  2816.  
  2817. Sub StopEndOfBallMode() 'this sub is called after the last ball in play is drained, reset skillshot, modes, timers
  2818. If li048.State then SuperJackpotTimer_Timer 'to turn off the timer
  2819. If bPoliceStarted Then StopPolice
  2820. End Sub
  2821.  
  2822. Sub ResetNewBallVariables() 'reset variables and lights for a new ball or player
  2823. 'turn on or off the needed lights before a new ball is released
  2824. TurnOffPlayfieldLights
  2825. 'set up the lights according to the player achievments
  2826. BonusMultiplier(CurrentPlayer) = 1 'no need to update light as the 1x light do not exists
  2827. UpdateTargetLights
  2828. UpdateWeaponLights ' the W lights
  2829. UpdateWeaponLights2 ' the collected weapons
  2830. aWeaponSJactive = False
  2831. UpdateLockLights ' turn on the lock lights for the current player
  2832. End Sub
  2833.  
  2834. Sub TurnOffPlayfieldLights()
  2835. Dim a
  2836. For each a in aLights
  2837. a.State = 0
  2838. Next
  2839. End Sub
  2840.  
  2841. Sub UpdateModeLights 'update Mode lights for the currentplayer
  2842. li014.State = Mode(CurrentPlayer, 1)
  2843. li013.State = Mode(CurrentPlayer, 2)
  2844. li012.State = Mode(CurrentPlayer, 3)
  2845. li011.State = Mode(CurrentPlayer, 4)
  2846. li010.State = Mode(CurrentPlayer, 5)
  2847. li009.State = Mode(CurrentPlayer, 6)
  2848. li008.State = Mode(CurrentPlayer, 7)
  2849. li007.State = Mode(CurrentPlayer, 8)
  2850. li006.State = Mode(CurrentPlayer, 9)
  2851. li005.State = Mode(CurrentPlayer, 10)
  2852. li004.State = Mode(CurrentPlayer, 11)
  2853. li001.State = Mode(CurrentPlayer, 12)
  2854. li002.State = Mode(CurrentPlayer, 13)
  2855. li003.State = Mode(CurrentPlayer, 14)
  2856. End Sub
  2857.  
  2858. Sub UpdateTargetLights 'CurrentPlayer
  2859. Li031.State = TargetHits(CurrentPlayer, 1)
  2860. Li049.State = TargetHits(CurrentPlayer, 2)
  2861. Li050.State = TargetHits(CurrentPlayer, 3)
  2862. Li051.State = TargetHits(CurrentPlayer, 4)
  2863. Li058.State = TargetHits(CurrentPlayer, 5)
  2864. Li057.State = TargetHits(CurrentPlayer, 6)
  2865. Li079.State = TargetHits(CurrentPlayer, 7)
  2866. End Sub
  2867.  
  2868. Sub ResetTargetLights 'CurrentPlayer
  2869. Dim j
  2870. For j = 0 to 7
  2871. TargetHits(CurrentPlayer, j) = 1
  2872. Next
  2873. UpdateTargetLights
  2874. End Sub
  2875.  
  2876. Sub UpdateSkillShot() 'Setup and updates the skillshot lights
  2877. LightSeqSkillshot.Play SeqAllOff
  2878. DMD CL("HIT LIT LIGHT"), CL("FOR SKILLSHOT"), "", eNone, eNone, eNone, 3000, True, ""
  2879. li034.State = 2
  2880. li063.State = 2
  2881. End Sub
  2882.  
  2883. Sub ResetSkillShotTimer_Timer 'timer to reset the skillshot lights & variables
  2884. ResetSkillShotTimer.Enabled = 0
  2885. bSkillShotReady = False
  2886. bRotateLights = True
  2887. LightSeqSkillshot.StopPlay
  2888. Li034.State = 0
  2889. li063.State = 0
  2890. DMDScoreNow
  2891. End Sub
  2892.  
  2893. ' *********************************************************************
  2894. ' Table Object Hit Events
  2895. '
  2896. ' Any target hit Sub will follow this:
  2897. ' - play a sound
  2898. ' - do some physical movement
  2899. ' - add a score, bonus
  2900. ' - check some variables/Mode this trigger is a member of
  2901. ' - set the "LastSwitchHit" variable in case it is needed later
  2902. ' *********************************************************************
  2903.  
  2904. '*********************************************************
  2905. ' Slingshots has been hit
  2906. ' In this table the slingshots change the outlanes lights
  2907.  
  2908. Dim LStep, RStep
  2909.  
  2910. Sub LeftSlingShot_Slingshot
  2911. If Tilted Then Exit Sub
  2912. PlaySoundAt SoundFXDOF("fx_slingshot", 103, DOFPulse, DOFcontactors), Lemk
  2913. DOF 105, DOFPulse
  2914. LeftSling004.Visible = 1
  2915. Lemk.RotX = 26
  2916. LStep = 0
  2917. LeftSlingShot.TimerEnabled = True
  2918. ' add some points
  2919. AddScore 530
  2920. ' check modes
  2921. ' add some effect to the table?
  2922. ' remember last trigger hit by the ball
  2923. LastSwitchHit = "LeftSlingShot"
  2924. End Sub
  2925.  
  2926. Sub LeftSlingShot_Timer
  2927. Select Case LStep
  2928. Case 1:LeftSLing004.Visible = 0:LeftSLing003.Visible = 1:Lemk.RotX = 14
  2929. Case 2:LeftSLing003.Visible = 0:LeftSLing002.Visible = 1:Lemk.RotX = 2
  2930. Case 3:LeftSLing002.Visible = 0:Lemk.RotX = -20:LeftSlingShot.TimerEnabled = 0
  2931. End Select
  2932. LStep = LStep + 1
  2933. End Sub
  2934.  
  2935. Sub RightSlingShot_Slingshot
  2936. If Tilted Then Exit Sub
  2937. PlaySoundAt SoundFXDOF("fx_slingshot", 104, DOFPulse, DOFcontactors), Remk
  2938. DOF 106, DOFPulse
  2939. RightSling004.Visible = 1
  2940. Remk.RotX = 26
  2941. RStep = 0
  2942. RightSlingShot.TimerEnabled = True
  2943. ' add some points
  2944. AddScore 530
  2945. ' check modes
  2946. ' add some effect to the table?
  2947. ' remember last trigger hit by the ball
  2948. LastSwitchHit = "RightSlingShot"
  2949. End Sub
  2950.  
  2951. Sub RightSlingShot_Timer
  2952. Select Case RStep
  2953. Case 1:RightSLing004.Visible = 0:RightSLing003.Visible = 1:Remk.RotX = 14
  2954. Case 2:RightSLing003.Visible = 0:RightSLing002.Visible = 1:Remk.RotX = 2
  2955. Case 3:RightSLing002.Visible = 0:Remk.RotX = -20:RightSlingShot.TimerEnabled = 0
  2956. End Select
  2957. RStep = RStep + 1
  2958. End Sub
  2959.  
  2960. '***********************
  2961. ' Bumper
  2962. '***********************
  2963. ' Bumper Jackpot is scored when the bumper light is on
  2964. ' the value is always 200.000 + 20% of the score
  2965.  
  2966. Sub Bumper1_Hit ' W6
  2967. If Tilted Then Exit Sub
  2968. Dim tmp
  2969. If bSkillShotReady Then ResetSkillShotTimer_Timer
  2970. PlaySoundAt SoundFXDOF("fx_bumper", 108, DOFPulse, DOFContactors), Bumper1
  2971. DOF 138, DOFPulse
  2972. ' add some points
  2973. If libumper.State Then 'the light is on so give the bumper Jackpot
  2974. FlashForms libumper, 1500, 75, 0
  2975. FlashForms Flasher002, 1500, 75, 0
  2976. tmp = 100000 + INT(Score(CurrentPlayer) * 0.01) * 10 'the bumper jackpot is 100.000 + 10% of the score
  2977. DMD CL("BUMPER JACKPOT"), CL(FormatScore(tmp) ), "", eNone, eNone, eNone, 1500, True, "vo_jackpot" &RndNbr(6)
  2978. AddScore2 tmp
  2979. Else 'score normal points
  2980. AddScore 1000
  2981. End If
  2982. ' check for modes
  2983. TargetHits(CurrentPlayer, 7) = 0
  2984. CheckTargets
  2985. ' remember last trigger hit by the ball
  2986. LastSwitchHit = "Bumper1"
  2987. ' increase the bumper hit count and increase the bumper value after each 30 hits
  2988. BumperHits(CurrentPlayer) = BumperHits(CurrentPlayer) + 1
  2989. ' Check the bumper hits to lit the bumper to collect the bumper jackpot
  2990. If BumperHits(CurrentPlayer) = BumperNeededHits(CurrentPlayer) Then
  2991. libumper.State = 1
  2992. Flasher002.Visible = 1
  2993. BumperNeededHits(CurrentPlayer) = BumperNeededHits(CurrentPlayer) + 10 + RndNbr(10)
  2994. End If
  2995. End Sub
  2996.  
  2997. '*********
  2998. ' Lanes
  2999. '*********
  3000. ' in and outlanes - mystery ?
  3001. Sub Trigger001_Hit
  3002. PLaySoundAt "fx_sensor", Trigger001
  3003. If Tilted Then Exit Sub
  3004. Addscore 5000
  3005. Mystery(CurrentPlayer, 1) = 1
  3006. CheckMystery
  3007. End Sub
  3008.  
  3009. Sub Trigger002_Hit
  3010. PLaySoundAt "fx_sensor", Trigger002
  3011. If Tilted Then Exit Sub
  3012. Addscore 1000
  3013. Mystery(CurrentPlayer, 2) = 1
  3014. CheckMystery
  3015. End Sub
  3016.  
  3017. Sub Trigger003_Hit
  3018. PLaySoundAt "fx_sensor", Trigger003
  3019. If Tilted Then Exit Sub
  3020. Addscore 1000
  3021. Mystery(CurrentPlayer, 3) = 1
  3022. CheckMystery
  3023. End Sub
  3024.  
  3025. Sub Trigger004_Hit
  3026. PLaySoundAt "fx_sensor", Trigger004
  3027. If Tilted Then Exit Sub
  3028. Addscore 5000
  3029. Mystery(CurrentPlayer, 4) = 1
  3030. CheckMystery
  3031. End Sub
  3032.  
  3033. Sub UpdateMysteryLights
  3034. 'update lane lights
  3035. li017.State = Mystery(CurrentPlayer, 1)
  3036. li018.State = Mystery(CurrentPlayer, 2)
  3037. li019.State = Mystery(CurrentPlayer, 3)
  3038. li020.State = Mystery(CurrentPlayer, 4)
  3039. If Mystery(CurrentPlayer, 1) + Mystery(CurrentPlayer, 2) + Mystery(CurrentPlayer, 3) + Mystery(CurrentPlayer, 4) = 4 Then
  3040. li078.State = 1
  3041. End If
  3042. End Sub
  3043.  
  3044. Sub RotateLaneLights(n) 'n is the direction, 1 or 0, left or right. They are rotated by the flippers
  3045. Dim tmp
  3046. If bRotateLights Then
  3047. If n = 1 Then
  3048. tmp = Mystery(CurrentPlayer, 1)
  3049. Mystery(CurrentPlayer, 1) = Mystery(CurrentPlayer, 2)
  3050. Mystery(CurrentPlayer, 2) = Mystery(CurrentPlayer, 3)
  3051. Mystery(CurrentPlayer, 3) = Mystery(CurrentPlayer, 4)
  3052. Mystery(CurrentPlayer, 4) = tmp
  3053. Else
  3054. tmp = Mystery(CurrentPlayer, 4)
  3055. Mystery(CurrentPlayer, 4) = Mystery(CurrentPlayer, 3)
  3056. Mystery(CurrentPlayer, 3) = Mystery(CurrentPlayer, 2)
  3057. Mystery(CurrentPlayer, 2) = Mystery(CurrentPlayer, 1)
  3058. Mystery(CurrentPlayer, 1) = tmp
  3059. End If
  3060. End If
  3061. UpdateMysteryLights
  3062. End Sub
  3063.  
  3064. 'table lanes
  3065. Sub Trigger005_Hit
  3066. PLaySoundAt "fx_sensor", Trigger005
  3067. If Tilted Then Exit Sub
  3068. Addscore 1000
  3069. If bSkillShotReady Then li034.State = 0
  3070. If bMichaelMBStarted AND li032.State Then 'award the michael super jackpot
  3071. DMD CL("SUPER JACKPOT"), CL(FormatScore(MichaelSJValue) ), "_", eBlink, eNone, eNone, 1000, True, "vo_superjackpot"
  3072. Addscore2 MichaelSJValue
  3073. MichaelSJValue = 1000000
  3074. li032.State = 0
  3075. LightEffect 2
  3076. GiEffect 2
  3077. End If
  3078. End Sub
  3079.  
  3080. Sub Trigger006_Hit 'skillshot 1
  3081. PLaySoundAt "fx_sensor", Trigger006
  3082. If Tilted Then Exit Sub
  3083. Addscore 1000
  3084. If bSkillShotReady AND li034.State Then AwardSkillshot
  3085. End Sub
  3086.  
  3087. Sub Trigger008_Hit 'end top loop
  3088. PLaySoundAt "fx_sensor", Trigger008
  3089. If Tilted Then Exit Sub
  3090. Addscore 5000
  3091. ' remember last trigger hit by the ball
  3092. LastSwitchHit = "Trigger008"
  3093. End Sub
  3094.  
  3095. Sub Trigger009_Hit 'right loop
  3096. PLaySoundAt "fx_sensor", Trigger009
  3097. If Tilted Then Exit Sub
  3098. Addscore 10000
  3099. Flashforms f2A, 800, 50, 0
  3100. Flashforms F2B, 800, 50, 0
  3101. Flashforms Flasher004, 800, 50, 0
  3102. Flashforms Flasher005, 800, 50, 0
  3103. If LastSwitchHit = "Trigger008" Then
  3104. AwardLoop
  3105. Else
  3106. li061.State = 2 'super loops light
  3107. LoopCount = 1
  3108. End If
  3109. If F002.State Then TeenKilled:F002.State = 0
  3110. ' Weapons Super Jackpot
  3111. If aWeaponSJactive AND li060.State Then AwardWeaponsSuperJackpot
  3112. 'Jason multiball
  3113. If bJasonMBStarted Then
  3114. DMD CL("JACKPOT"), CL(FormatScore(ArrowMultiPlier(7) * 1000000) ), "_", eBlink, eNone, eNone, 1000, True, "vo_jackpot" &RndNbr(6)
  3115. LightEffect 2
  3116. GiEffect 2
  3117. Addscore2 ArrowMultiPlier(7) * 1000000
  3118. If ArrowMultiPlier(7) < 5 Then
  3119. ArrowMultiPlier(7) = ArrowMultiPlier(7) + 1
  3120. UpdateArrowLights
  3121. End If
  3122. End If
  3123. 'Freddy multiball
  3124. If bFreddyMBStarted and li060.State Then
  3125. DMD CL("SUPER JACKPOT"), CL(FormatScore(FreddySJValue) ), "_", eBlink, eNone, eNone, 1000, True, "vo_superjackpot"
  3126. Addscore2 FreddySJValue
  3127. FreddySJValue = 1000000
  3128. li060.State = 0
  3129. LightEffect 2
  3130. GiEffect 2
  3131. End If
  3132. ' remember last trigger hit by the ball
  3133. LastSwitchHit = "Trigger009"
  3134. End Sub
  3135.  
  3136. '****************************
  3137. ' extra triggers - no sound
  3138. '****************************
  3139.  
  3140. Sub Trigger010_Hit 'superskillshot
  3141. If Tilted Then Exit Sub
  3142. Addscore 1000
  3143. If bSkillShotReady Then AwardSuperSkillshot
  3144. End Sub
  3145.  
  3146. Sub Trigger011_Hit 'cabin playfield
  3147. If Tilted Then Exit Sub
  3148. Addscore 5000
  3149. If aWeaponSJactive Then 'the lit Super Jackpot light is lit, so lit the Super Jackpot Light at the right loop
  3150. SuperJackpotTimer_Timer 'call the timer to stop the 30s timer and blinking light at the cabin
  3151. li060.State = 2
  3152. End If
  3153. 'Jason multiball
  3154. If bJasonMBStarted Then
  3155. DMD CL("JACKPOT"), CL(FormatScore(ArrowMultiPlier(4) * 1000000) ), "_", eBlink, eNone, eNone, 1000, True, "vo_jackpot" &RndNbr(6)
  3156. LightEffect 2
  3157. GiEffect 2
  3158. Addscore2 ArrowMultiPlier(4) * 1000000
  3159. If ArrowMultiPlier(4) < 5 Then
  3160. ArrowMultiPlier(4) = ArrowMultiPlier(4) + 1
  3161. UpdateArrowLights
  3162. End If
  3163. End If
  3164. ' lock balls
  3165. Select Case BallsInLock(CurrentPlayer)
  3166. Case 0: 'enabled the first lock
  3167. DMD "_", CL("LOCK IS LIT"), "_", eNone, eNone, eNone, 1000, True, "vo_lockislit"
  3168. BallsInLock(CurrentPlayer) = 1
  3169. UpdateLockLights
  3170. Case 1: 'lock 1
  3171. DMD "_", CL("BALL 1 LOCKED"), "_", eNone, eNone, eNone, 1000, True, "vo_ball1locked"
  3172. BallsInLock(CurrentPlayer) = 2
  3173. UpdateLockLights
  3174. Case 2: 'lock 2
  3175. DMD "_", CL("BALL 2 LOCKED"), "_", eNone, eNone, eNone, 1000, True, "vo_ball2locked"
  3176. BallsInLock(CurrentPlayer) = 3
  3177. UpdateLockLights
  3178. Case 3 'lock 3 - start multiball if there is not a multiball already
  3179. If NOT bMultiBallMode Then
  3180. DMD "_", CL("BALL 3 LOCKED"), "_", eNone, eNone, eNone, 1000, True, "vo_ball3locked"
  3181. BallsInLock(CurrentPlayer) = 4
  3182. UpdateLockLights
  3183. lighteffect 2
  3184. Flasheffect 5
  3185. StartJasonMultiball
  3186. End If
  3187. End Select
  3188. End Sub
  3189.  
  3190. Sub UpdateLockLights
  3191. Select Case BallsInLock(CurrentPlayer)
  3192. Case 0:li071.State = 0:li072.State = 0:li073.State = 0
  3193. Case 1:li073.State = 2 'enabled the first lock
  3194. Case 2:li073.State = 1:li072.State = 2 'lock 1
  3195. Case 3:li072.State = 1:li071.State = 2 'lock 2
  3196. Case 4:li071.State = 0:li072.State = 0:li073.State = 0 'lock 3
  3197. End Select
  3198. End Sub
  3199.  
  3200. Sub Trigger012_Hit 'left spinner - W1
  3201. If Tilted Then Exit Sub
  3202. 'weapon hit
  3203. If WeaponHits(CurrentPlayer, 1) Then 'if the light is lit then turn it off
  3204. WeaponHits(CurrentPlayer, 1) = 0
  3205. CheckWeapons
  3206. End If
  3207. 'teen killed
  3208. If F001.State Then TeenKilled:F001.State = 0
  3209. 'Jason multiball
  3210. If bJasonMBStarted Then
  3211. DMD CL("JACKPOT"), CL(FormatScore(ArrowMultiPlier(1) * 1000000) ), "_", eBlink, eNone, eNone, 1000, True, "vo_jackpot" &RndNbr(6)
  3212. LightEffect 2
  3213. GiEffect 2
  3214. Addscore2 ArrowMultiPlier(1) * 1000000
  3215. If ArrowMultiPlier(1) < 5 Then
  3216. ArrowMultiPlier(1) = ArrowMultiPlier(1) + 1
  3217. UpdateArrowLights
  3218. End If
  3219. End If
  3220. 'Michael multiball
  3221. If bMichaelMBStarted Then
  3222. DMD CL("JACKPOT"), CL(FormatScore(1000000) ), "_", eBlink, eNone, eNone, 1000, True, "vo_jackpot" &RndNbr(6)
  3223. Addscore2 1000000
  3224. MichaelSJValue = MichaelSJValue + 2000000
  3225. If MichaelSJValue >= 5000000 Then
  3226. li032.State = 2
  3227. Select Case RndNbr(10)
  3228. Case 1:DMD "_", "SPINNER JACKPOTS LIT", "_", eBlink, eNone, eNone, 1000, True, "vo_getthestupidjackpot"
  3229. Case Else:DMD "_", "SPINNER JACKPOTS LIT", "_", eBlink, eNone, eNone, 1000, True, "vo_getthesuperjackpot"
  3230. End Select
  3231. LightEffect 2
  3232. GiEffect 2
  3233. End If
  3234. End If
  3235. End Sub
  3236.  
  3237. Sub Trigger013_Hit 'behind right spinner
  3238. If Tilted Then Exit Sub
  3239. 'weapon Hit
  3240. If WeaponHits(CurrentPlayer, 6) Then 'if the light is lit then turn it off
  3241. WeaponHits(CurrentPlayer, 6) = 0
  3242. CheckWeapons
  3243. End If
  3244. If li077.State Then 'give the special, which in this table is an add-a-ball
  3245. PlaySound "vo_special"
  3246. AddMultiball 1
  3247. li077.State = 0
  3248. End If
  3249. 'Jason multiball
  3250. If bJasonMBStarted Then
  3251. DMD CL("JACKPOT"), CL(FormatScore(ArrowMultiPlier(8) * 1000000) ), "_", eBlink, eNone, eNone, 1000, True, "vo_jackpot" &RndNbr(6)
  3252. LightEffect 2
  3253. GiEffect 2
  3254. Addscore2 ArrowMultiPlier(8) * 1000000
  3255. If ArrowMultiPlier(8) < 5 Then
  3256. ArrowMultiPlier(8) = ArrowMultiPlier(8) + 1
  3257. UpdateArrowLights
  3258. End If
  3259. End If
  3260. 'Michael multiball
  3261. If bMichaelMBStarted Then
  3262. DMD CL("JACKPOT"), CL(FormatScore(1000000) ), "_", eBlink, eNone, eNone, 1000, True, "vo_jackpot" &RndNbr(6)
  3263. Addscore2 1000000
  3264. MichaelSJValue = MichaelSJValue + 2000000
  3265. If MichaelSJValue >= 5000000 Then
  3266. li032.State = 2
  3267. Select Case RndNbr(10)
  3268. Case 1:DMD "_", "SPINNER JACKPOTS LIT", "_", eBlink, eNone, eNone, 1000, True, "vo_getthestupidjackpot"
  3269. Case Else:DMD "_", "SPINNER JACKPOTS LIT", "_", eBlink, eNone, eNone, 1000, True, "vo_getthesuperjackpot"
  3270. End Select
  3271. LightEffect 2
  3272. GiEffect 2
  3273. End If
  3274. End If
  3275. End Sub
  3276.  
  3277. Sub Trigger014_Hit 'center spinner for loop awards - W4
  3278. If Tilted Then Exit Sub
  3279. If LastSwitchHit = "Trigger008" Then
  3280. AwardLoop
  3281. Else
  3282. li061.State = 2 'super loops light
  3283. LoopCount = 1
  3284. End If
  3285. If F005.State Then TeenKilled:F005.State = 0
  3286. 'weapon hit
  3287. If WeaponHits(CurrentPlayer, 4) Then 'if the light is lit then turn it off
  3288. WeaponHits(CurrentPlayer, 4) = 0
  3289. CheckWeapons
  3290. End If
  3291. 'Jason multiball
  3292. If bJasonMBStarted Then
  3293. DMD CL("JACKPOT"), CL(FormatScore(ArrowMultiPlier(5) * 1000000) ), "_", eBlink, eNone, eNone, 1000, True, "vo_jackpot" &RndNbr(6)
  3294. LightEffect 2
  3295. GiEffect 2
  3296. Addscore2 ArrowMultiPlier(5) * 1000000
  3297. If ArrowMultiPlier(5) < 5 Then
  3298. ArrowMultiPlier(5) = ArrowMultiPlier(5) + 1
  3299. UpdateArrowLights
  3300. End If
  3301. End If
  3302. 'Michael multiball
  3303. If bMichaelMBStarted Then
  3304. DMD CL("JACKPOT"), CL(FormatScore(1000000) ), "_", eBlink, eNone, eNone, 1000, True, "vo_jackpot" &RndNbr(6)
  3305. Addscore2 1000000
  3306. MichaelSJValue = MichaelSJValue + 2000000
  3307. If MichaelSJValue >= 5000000 Then
  3308. li032.State = 2
  3309. Select Case RndNbr(10)
  3310. Case 1:DMD "_", "SPINNER JACKPOTS LIT", "_", eBlink, eNone, eNone, 1000, True, "vo_getthestupidjackpot"
  3311. Case Else:DMD "_", "SPINNER JACKPOTS LIT", "_", eBlink, eNone, eNone, 1000, True, "vo_getthesuperjackpot"
  3312. End Select
  3313. LightEffect 2
  3314. GiEffect 2
  3315. End If
  3316. End If
  3317. ' remember last trigger hit by the ball
  3318. LastSwitchHit = "Trigger014"
  3319. End Sub
  3320.  
  3321. Sub Trigger015_Hit 'right ramp done - W5
  3322. If Tilted Then Exit Sub
  3323. Addscore 5000
  3324. If LastSwitchHit = "Trigger017" Then
  3325. AwardCombo
  3326. Else
  3327. ComboCount = 1
  3328. End If
  3329. If F003.State Then TeenKilled:F003.State = 0
  3330. 'weapon hit
  3331. If WeaponHits(CurrentPlayer, 5) Then 'if the light is lit then turn it off
  3332. WeaponHits(CurrentPlayer, 5) = 0
  3333. CheckWeapons
  3334. End If
  3335. If bPoliceStarted Then 'the police hurry up is started
  3336. PoliceRampHits = PoliceRampHits + 1
  3337. If PoliceRampHits = 3 Then
  3338. AwardPoliceJackpot
  3339. StopPolice
  3340. End If
  3341. End If
  3342. 'Jason multiball
  3343. If bJasonMBStarted Then
  3344. DMD CL("JACKPOT"), CL(FormatScore(ArrowMultiPlier(6) * 1000000) ), "_", eBlink, eNone, eNone, 1000, True, "vo_jackpot" &RndNbr(6)
  3345. LightEffect 2
  3346. GiEffect 2
  3347. Addscore2 ArrowMultiPlier(6) * 1000000
  3348. If ArrowMultiPlier(6) < 5 Then
  3349. ArrowMultiPlier(6) = ArrowMultiPlier(6) + 1
  3350. UpdateArrowLights
  3351. End If
  3352. End If
  3353. 'Freddy multiball
  3354. If bFreddyMBStarted Then
  3355. DMD CL("JACKPOT"), CL(FormatScore(1000000) ), "_", eBlink, eNone, eNone, 1000, True, "vo_jackpot" &RndNbr(6)
  3356. Addscore2 1000000
  3357. FreddySJValue = FreddySJValue + 2000000
  3358. If FreddySJValue >= 5000000 Then
  3359. li060.State = 2
  3360. Select Case RndNbr(10)
  3361. Case 1:DMD "_", CL("SUPERJACKPOT IS LIT"), "_", eBlink, eNone, eNone, 1000, True, "vo_getthestupidjackpot"
  3362. Case Else:DMD "_", CL("SUPERJACKPOT IS LIT"), "_", eBlink, eNone, eNone, 1000, True, "vo_getthesuperjackpot"
  3363. End Select
  3364. LightEffect 2
  3365. GiEffect 2
  3366. End If
  3367. End If
  3368. ' remember last trigger hit by the ball
  3369. LastSwitchHit = "Trigger015"
  3370. End Sub
  3371.  
  3372. Sub Trigger016_Hit 'left ramp done - W2
  3373. If Tilted Then Exit Sub
  3374. Addscore 5000
  3375. If LastSwitchHit = "Trigger017" Then
  3376. AwardCombo
  3377. Else
  3378. ComboCount = 1
  3379. End If
  3380. If F004.State Then TeenKilled:F004.State = 0
  3381. If li069.State Then AwardTargetJackpot
  3382. 'weapon hit
  3383. If WeaponHits(CurrentPlayer, 2) Then 'if the light is lit then turn it off
  3384. WeaponHits(CurrentPlayer, 2) = 0
  3385. CheckWeapons
  3386. End If
  3387. If bPoliceStarted Then 'the police hurry up is started
  3388. PoliceRampHits = PoliceRampHits + 1
  3389. If PoliceRampHits = 3 Then
  3390. AwardPoliceJackpot
  3391. StopPolice
  3392. End If
  3393. End If
  3394. 'Jason multiball
  3395. If bJasonMBStarted Then
  3396. DMD CL("JACKPOT"), CL(FormatScore(ArrowMultiPlier(2) * 1000000) ), "_", eBlink, eNone, eNone, 1000, True, "vo_jackpot" &RndNbr(6)
  3397. LightEffect 2
  3398. GiEffect 2
  3399. Addscore2 ArrowMultiPlier(2) * 1000000
  3400. If ArrowMultiPlier(2) < 5 Then
  3401. ArrowMultiPlier(2) = ArrowMultiPlier(2) + 1
  3402. UpdateArrowLights
  3403. End If
  3404. End If
  3405. 'Freddy multiball
  3406. If bFreddyMBStarted Then
  3407. DMD CL("JACKPOT"), CL(FormatScore(1000000) ), "_", eBlink, eNone, eNone, 1000, True, "vo_jackpot" &RndNbr(6)
  3408. Addscore2 1000000
  3409. FreddySJValue = FreddySJValue + 2000000
  3410. If FreddySJValue >= 5000000 Then
  3411. li060.State = 2
  3412. Select Case RndNbr(10)
  3413. Case 1:DMD "_", CL("SUPERJACKPOT IS LIT"), "_", eBlink, eNone, eNone, 1000, True, "vo_getthestupidjackpot"
  3414. Case Else:DMD "_", CL("SUPERJACKPOT IS LIT"), "_", eBlink, eNone, eNone, 1000, True, "vo_getthesuperjackpot"
  3415. End Select
  3416. LightEffect 2
  3417. GiEffect 2
  3418. End If
  3419. End If
  3420. ' remember last trigger hit by the ball
  3421. LastSwitchHit = "Trigger016"
  3422. End Sub
  3423.  
  3424. Sub Trigger017_Hit 'cabin top
  3425. If Tilted Then Exit Sub
  3426. ChangeGi red
  3427. GiEffect 1
  3428. FlashEffect 1
  3429. PlaySound "mu_kikimama"
  3430. vpmTimer.AddTimer 2500, "ChangeGi white '"
  3431. ' remember last trigger hit by the ball
  3432. LastSwitchHit = "Trigger017"
  3433. End Sub
  3434.  
  3435. Sub Trigger018_Hit 'left loop - only light effect
  3436. If Tilted Then Exit Sub
  3437. Flashforms f1A, 800, 50, 0
  3438. Flashforms F1B, 800, 50, 0
  3439. Flashforms Flasher006, 800, 50, 0
  3440. Flashforms Flasher007, 800, 50, 0
  3441. End Sub
  3442.  
  3443. '************
  3444. ' Targets
  3445. '************
  3446.  
  3447. Sub Target001_Hit 'police
  3448. PLaySoundAtBall "fx_Target"
  3449. If Tilted Then Exit Sub
  3450. Addscore 5000
  3451. Flashforms f5, 800, 50, 0
  3452. Flashforms Flasher001, 800, 50, 0
  3453. PlayElectro
  3454. TargetHits(CurrentPlayer, 1) = 0
  3455. CheckTargets
  3456. If NOT bPoliceStarted Then
  3457. PoliceTargetHits = PoliceTargetHits + 1
  3458. If PoliceTargetHits = 5 Then
  3459. StartPolice
  3460. End If
  3461. Else 'the police hurry up is started
  3462. PoliceTargetHits = PoliceTargetHits + 1
  3463. If PoliceTargetHits = 3 Then
  3464. AwardPoliceJackpot
  3465. StopPolice
  3466. End If
  3467. End If
  3468. End Sub
  3469.  
  3470. Sub Target002_Hit 'right target 1
  3471. PLaySoundAtBall "fx_Target"
  3472. If Tilted Then Exit Sub
  3473. Addscore 1000
  3474. PlayElectro
  3475. TargetHits(CurrentPlayer, 6) = 0
  3476. CheckTargets
  3477. End Sub
  3478.  
  3479. Sub Target003_Hit 'right target 2
  3480. PLaySoundAtBall "fx_Target"
  3481. Addscore 5000
  3482. If Tilted Then Exit Sub
  3483. PlayElectro
  3484. TargetHits(CurrentPlayer, 5) = 0
  3485. CheckTargets
  3486. End Sub
  3487.  
  3488. Sub Target004_Hit 'cabin target 1
  3489. PLaySoundAtBall "fx_Target"
  3490. If Tilted Then Exit Sub
  3491. Addscore 1000
  3492. PlayElectro
  3493. TargetHits(CurrentPlayer, 2) = 0
  3494. CheckTargets
  3495. End Sub
  3496.  
  3497. Sub Target005_Hit 'cabin target 2
  3498. PLaySoundAtBall "fx_Target"
  3499. If Tilted Then Exit Sub
  3500. Addscore 1000
  3501. PlayElectro
  3502. TargetHits(CurrentPlayer, 3) = 0
  3503. CheckTargets
  3504. End Sub
  3505.  
  3506. Sub Target006_Hit 'loop target
  3507. PLaySoundAtBall "fx_Target"
  3508. If Tilted Then Exit Sub
  3509. Addscore 5000
  3510. PlayElectro
  3511. TargetHits(CurrentPlayer, 4) = 0
  3512. CheckTargets
  3513. End Sub
  3514.  
  3515. Sub MagnetPost_Hit 'magnet post - W3
  3516. If Tilted Then Exit Sub
  3517. Addscore 1000
  3518. 'weapon hit
  3519. If WeaponHits(CurrentPlayer, 3) Then 'if the light is lit then turn it off
  3520. WeaponHits(CurrentPlayer, 3) = 0
  3521. CheckWeapons
  3522. End If
  3523. 'extra ball
  3524. If li070.State Then AwardExtraBall:li070.State = 0
  3525. End Sub
  3526.  
  3527. Sub CheckTargets
  3528. Dim tmp, i
  3529. tmp = 0
  3530. UpdateTargetLights
  3531. For i = 1 to 6
  3532. tmp = tmp + TargetHits(CurrentPlayer, i)
  3533. Next
  3534. If tmp = 0 then 'all targets are hit so turn on the target Jackpot
  3535. PlaySound "vo_excellent"
  3536. li069.State = 1
  3537. LightSeqBLueTargets.Play SeqBlinking, , 15, 25
  3538. For i = 1 to 6
  3539. TargetHits(CurrentPlayer, i) = 1
  3540. Next
  3541. UpdateTargetLights
  3542. End If
  3543. End Sub
  3544.  
  3545. '*************
  3546. ' Spinners
  3547. '*************
  3548.  
  3549. Sub Spinner001_Spin 'right
  3550. PlaySoundAt "fx_spinner", Spinner001
  3551. If Tilted Then Exit Sub
  3552. Addscore 1000
  3553. RightSpinnerHits(CurrentPlayer) = RightSpinnerHits(CurrentPlayer) + 1
  3554. ' check for add-a-aball during multiballs or during normal play
  3555. If RightSpinnerHits(CurrentPlayer) >= 100 Then
  3556. LitSpecial
  3557. RightSpinnerHits(CurrentPlayer) = 0
  3558. End If
  3559. 'check modes
  3560. CheckSpinners
  3561. End Sub
  3562.  
  3563. Sub LitSpecial
  3564. DMD "_", CL("SPECIAL IS LIT"), "", eNone, eNone, eNone, 1000, True, "vo_specialislit"
  3565. li077.State = 1
  3566. End Sub
  3567.  
  3568. Sub Spinner002_Spin 'center
  3569. PlaySoundAt "fx_spinner", Spinner002
  3570. If Tilted Then Exit Sub
  3571. Addscore 1000
  3572. CenterSpinnerHits(CurrentPlayer) = CenterSpinnerHits(CurrentPlayer) + 1
  3573. ' check for Bonus multiplier
  3574. If CenterSpinnerHits(CurrentPlayer) >= 30 Then
  3575. li074.State = 1
  3576. End If
  3577. If CenterSpinnerHits(CurrentPlayer) >= 40 Then
  3578. AddBonusMultiplier 1
  3579. CenterSpinnerHits(CurrentPlayer) = 0
  3580. li074.State = 0
  3581. End If
  3582. 'chek modes
  3583. CheckSpinners
  3584. End Sub
  3585.  
  3586. Sub Spinner003_Spin 'left
  3587. PlaySoundAt "fx_spinner", Spinner003
  3588. If Tilted Then Exit Sub
  3589. Addscore 1000
  3590. LeftSpinnerHits(CurrentPlayer) = LeftSpinnerHits(CurrentPlayer) + 1
  3591. 'Check modes
  3592. CheckSpinners
  3593. End Sub
  3594.  
  3595. Sub CheckSpinners
  3596. End Sub
  3597.  
  3598. '*********
  3599. ' scoop
  3600. '*********
  3601.  
  3602. Dim aBall
  3603.  
  3604. Sub scoop_Hit
  3605. PlaySoundAt "fx_hole_enter", scoop
  3606. Set aBall = ActiveBall
  3607. Me.TimerEnabled = 1
  3608. If Tilted Then Exit Sub
  3609. If bSkillShotReady Then ResetSkillShotTimer_Timer
  3610. ' check for modes
  3611. Addscore 5000
  3612. Flashforms f4, 800, 50, 0
  3613. Flashforms Flasher003, 800, 50, 0
  3614. ' check modes
  3615. If li078.State Then
  3616. AwardMystery 'after the award theball will be kicked out
  3617. Else
  3618. ' Nothing left to do, so kick out the ball
  3619. vpmtimer.addtimer 1500, "kickBallOut '"
  3620. End If
  3621. End Sub
  3622.  
  3623. Sub scoop_Timer
  3624. If aBall.Z > 0 Then
  3625. aBall.Z = aBall.Z -5
  3626. Else
  3627. BallsinHole = BallsInHole + 1
  3628. scoop.Destroyball
  3629. Me.TimerEnabled = 0
  3630. If Tilted Then kickBallOut
  3631. End If
  3632. End Sub
  3633.  
  3634. Sub kickBallOut
  3635. If BallsinHole > 0 Then
  3636. BallsinHole = BallsInHole - 1
  3637. PlaySoundAt SoundFXDOF("fx_popper", 111, DOFPulse, DOFcontactors), scoop
  3638. scoop.CreateSizedBallWithMass BallSize / 2, BallMass
  3639. scoop.kick 235, 22, 1
  3640. Flashforms F4, 500, 50, 0
  3641. vpmtimer.addtimer 400, "kickBallOut '" 'kick out the rest of the balls, if any
  3642. End If
  3643. End Sub
  3644.  
  3645. '*************
  3646. ' Magnet
  3647. '*************
  3648.  
  3649. Sub Trigger007_Hit
  3650. If Tilted Then Exit Sub
  3651. If ActiveBall.VelY > 10 Then
  3652. ActiveBall.VelY = 10
  3653. End If
  3654. mMagnet.MagnetOn = True
  3655. Me.TimerEnabled = 1 'to turn off the Magnet
  3656. 'Jason multiball
  3657. If bJasonMBStarted Then
  3658. If ActiveBall.VelY < 0 Then 'this means the ball going up
  3659. DMD CL("JACKPOT"), CL(FormatScore(ArrowMultiPlier(3) * 1000000) ), "_", eBlink, eNone, eNone, 1000, True, "vo_jackpot" &RndNbr(6)
  3660. LightEffect 2
  3661. GiEffect 2
  3662. Addscore2 ArrowMultiPlier(3) * 1000000
  3663. If ArrowMultiPlier(3) < 5 Then
  3664. ArrowMultiPlier(3) = ArrowMultiPlier(3) + 1
  3665. UpdateArrowLights
  3666. End If
  3667. End If
  3668. End If
  3669. End Sub
  3670.  
  3671. Sub Trigger007_Timer
  3672. Me.TimerEnabled = 0
  3673. ReleaseMagnetBalls
  3674. End Sub
  3675.  
  3676. Sub ReleaseMagnetBalls 'mMagnet off and release the ball if any
  3677. Dim ball
  3678. mMagnet.MagnetOn = False
  3679. For Each ball In mMagnet.Balls
  3680. With ball
  3681. .VelX = 0
  3682. .VelY = 1
  3683. End With
  3684. Next
  3685. End Sub
  3686.  
  3687. '*******************
  3688. ' RAMP COMBOS
  3689. '*******************
  3690. ' don't time out
  3691. ' starts at 500K for a 2 way combo and it is doubled on each combo
  3692. ' shots that count as ramp combos:
  3693. ' Left Ramp and Right Ramp
  3694. ' shots to the same ramp also count as loops
  3695.  
  3696. Sub AwardCombo
  3697. ComboCount = ComboCount + 1
  3698. Select Case ComboCount
  3699. Case 1: 'just starting
  3700. Case 2:DMD CL("COMBO"), CL(FormatScore(ComboValue(CurrentPlayer) ) ), "", eNone, eNone, eNone, 1500, True, "vo_combo":ComboHits(CurrentPlayer) = ComboHits(CurrentPlayer) + 1
  3701. Case 3:DMD CL("2X COMBO"), CL(FormatScore(ComboValue(CurrentPlayer) * 2) ), "", eNone, eNone, eNone, 1500, True, "vo_2xcombo":ComboHits(CurrentPlayer) = ComboHits(CurrentPlayer) + 1
  3702. Case 4:DMD CL("3X COMBO"), CL(FormatScore(ComboValue(CurrentPlayer) * 3) ), "", eNone, eNone, eNone, 1500, True, "vo_3xcombo":ComboHits(CurrentPlayer) = ComboHits(CurrentPlayer) + 1
  3703. Case 5:DMD CL("4X COMBO"), CL(FormatScore(ComboValue(CurrentPlayer) * 4) ), "", eNone, eNone, eNone, 1500, True, "vo_4xcombo":ComboHits(CurrentPlayer) = ComboHits(CurrentPlayer) + 1
  3704. Case 6:DMD CL("5X COMBO"), CL(FormatScore(ComboValue(CurrentPlayer) * 5) ), "", eNone, eNone, eNone, 1500, True, "vo_5xcombo":ComboHits(CurrentPlayer) = ComboHits(CurrentPlayer) + 1
  3705. Case 7:DMD CL("SUPER COMBO"), CL(FormatScore(ComboValue(CurrentPlayer) * 7) ), "", eNone, eNone, eNone, 1500, True, "vo_supercombo":ComboHits(CurrentPlayer) = ComboHits(CurrentPlayer) + 1
  3706. Case Else:DMD CL("SUPERDUPER COMBO"), CL(FormatScore(ComboValue(CurrentPlayer) * 10) ), "", eNone, eNone, eNone, 1500, True, "vo_superdupercombo":ComboHits(CurrentPlayer) = ComboHits(CurrentPlayer) + 1
  3707. End Select
  3708. AddScore2 ComboValue(CurrentPlayer) * ComboCount
  3709. ComboValue(CurrentPlayer) = ComboValue(CurrentPlayer) + 100000
  3710. End Sub
  3711.  
  3712. Sub aComboTargets_Hit(idx) 'reset the combo count if the ball hits another target/trigger
  3713. ComboCount = 0
  3714. End Sub
  3715.  
  3716. '*******************
  3717. ' LOOP COMBOS
  3718. '*******************
  3719. ' starts at 500K for a 2 way combo and it is doubled on each combo
  3720. ' shots that count as loop combos:
  3721. ' Center loop and Right Loop
  3722. ' shots to the same loop also count as loops
  3723.  
  3724. Sub AwardLoop
  3725. LoopCount = LoopCount + 1
  3726. Select Case LoopCount
  3727. Case 1: 'just starting
  3728. Case 2:DMD CL("COMBO"), CL(FormatScore(LoopValue(CurrentPlayer) ) ), "", eNone, eNone, eNone, 1500, True, "vo_combo":LoopHits(CurrentPlayer) = LoopHits(CurrentPlayer) + 1
  3729. Case 3:DMD CL("2X COMBO"), CL(FormatScore(LoopValue(CurrentPlayer) * 2) ), "", eNone, eNone, eNone, 1500, True, "vo_2xcombo":LoopHits(CurrentPlayer) = LoopHits(CurrentPlayer) + 1
  3730. Case 4:DMD CL("3X COMBO"), CL(FormatScore(LoopValue(CurrentPlayer) * 3) ), "", eNone, eNone, eNone, 1500, True, "vo_3xcombo":LoopHits(CurrentPlayer) = LoopHits(CurrentPlayer) + 1
  3731. Case 5:DMD CL("4X COMBO"), CL(FormatScore(LoopValue(CurrentPlayer) * 4) ), "", eNone, eNone, eNone, 1500, True, "vo_4xcombo":LoopHits(CurrentPlayer) = LoopHits(CurrentPlayer) + 1
  3732. Case 6:DMD CL("5X COMBO"), CL(FormatScore(LoopValue(CurrentPlayer) * 5) ), "", eNone, eNone, eNone, 1500, True, "vo_5xcombo":LoopHits(CurrentPlayer) = LoopHits(CurrentPlayer) + 1
  3733. Case 7:DMD CL("SUPER COMBO"), CL(FormatScore(LoopValue(CurrentPlayer) * 7) ), "", eNone, eNone, eNone, 1500, True, "vo_supercombo":LoopHits(CurrentPlayer) = LoopHits(CurrentPlayer) + 1
  3734. Case Else:DMD CL("SUPERDUPER COMBO"), CL(FormatScore(LoopValue(CurrentPlayer) * 10) ), "", eNone, eNone, eNone, 1500, True, "vo_superdupercombo":LoopHits(CurrentPlayer) = LoopHits(CurrentPlayer) + 1
  3735. End Select
  3736. AddScore2 LoopValue(CurrentPlayer) * LoopCount
  3737. LoopValue(CurrentPlayer) = LoopValue(CurrentPlayer) + 100000
  3738. End Sub
  3739.  
  3740. Sub aLoopTargets_Hit(idx) 'reset the loop count if the ball hits another target/trigger
  3741. li061.State = 0 'turn off also the super loops light
  3742. LoopCount = 0
  3743. End Sub
  3744.  
  3745. '*******************
  3746. ' Teenager kill
  3747. '*******************
  3748.  
  3749. ' the timer will change the current teenager by lighting the light on top of her
  3750.  
  3751. Sub TeenTimer_Timer
  3752. Select Case RndNbr(15)
  3753. Case 1:F001.State = 2:F002.State = 0:F003.State = 0:F004.State = 0:F005.State = 0:PlayQuote
  3754. Case 2:F001.State = 0:F002.State = 2:F003.State = 0:F004.State = 0:F005.State = 0:PlayQuote
  3755. Case 3:F001.State = 0:F002.State = 0:F003.State = 2:F004.State = 0:F005.State = 0:PlayQuote
  3756. Case 4:F001.State = 0:F002.State = 0:F003.State = 0:F004.State = 2:F005.State = 0:PlayQuote
  3757. Case 5:F001.State = 0:F002.State = 0:F003.State = 0:F004.State = 0:F005.State = 2:PlayQuote
  3758. Case Else:F001.State = 0:F002.State = 0:F003.State = 0:F004.State = 0:F005.State = 0
  3759. End Select
  3760. End Sub
  3761.  
  3762. Sub TeenKilled 'a teen has been killed
  3763. 'DMD animation
  3764. DMD "", "", "d_goa", eNone, eNone, eNone, 50, False, "sfx_kill" &RndNbr(10)
  3765. DMD "", "", "d_gob", eNone, eNone, eNone, 50, False, ""
  3766. DMD "", "", "d_goc", eNone, eNone, eNone, 50, False, ""
  3767. DMD "", "", "d_god", eNone, eNone, eNone, 50, False, ""
  3768. DMD "", "", "d_gof", eNone, eNone, eNone, 50, False, ""
  3769. DMD CL("Y"), "", "d_go1", eNone, eNone, eNone, 100, False, ""
  3770. DMD CL("YO"), "", "d_go2", eNone, eNone, eNone, 100, False, ""
  3771. DMD CL("YOU"), "", "d_go3", eNone, eNone, eNone, 100, False, ""
  3772. DMD CL("YOU "), "", "d_go4", eNone, eNone, eNone, 100, False, ""
  3773. DMD CL("YOU K"), "", "d_go5", eNone, eNone, eNone, 100, False, ""
  3774. DMD CL("YOU KI"), "", "d_go6", eNone, eNone, eNone, 100, False, ""
  3775. DMD CL("YOU KIL"), "", "d_go7", eNone, eNone, eNone, 100, False, ""
  3776. DMD CL("YOU KILLE"), "", "d_go8", eNone, eNone, eNone, 100, False, ""
  3777. DMD CL("YOU KILLED"), "", "d_go9", eNone, eNone, eNone, 100, False, ""
  3778. DMD CL("YOU KILLED"), CL("A"), "d_go10", eNone, eNone, eNone, 100, False, ""
  3779. DMD CL("YOU KILLED"), CL("A "), "d_go11", eNone, eNone, eNone, 100, False, ""
  3780. DMD CL("YOU KILLED"), CL("A TE"), "d_go12", eNone, eNone, eNone, 100, False, ""
  3781. DMD CL("YOU KILLED"), CL("A TEE"), "d_go13", eNone, eNone, eNone, 100, False, ""
  3782. DMD CL("YOU KILLED"), CL("A TEEN"), "d_go14", eNone, eNone, eNone, 100, False, ""
  3783. DMD CL("YOU KILLED"), CL("A TEENA"), "d_go15", eNone, eNone, eNone, 100, False, ""
  3784. DMD CL("YOU KILLED"), CL("A TEENAG"), "d_go16", eNone, eNone, eNone, 100, False, ""
  3785. DMD CL("YOU KILLED"), CL("A TEENAGE"), "d_go17", eNone, eNone, eNone, 100, False, ""
  3786. DMD CL("YOU KILLED"), CL("A TEENAGER"), "d_go18", eNone, eNone, eNone, 100, False, ""
  3787. DMD CL("YOU KILLED"), CL("A TEENAGER"), "", eNone, eNone, eNone, 1000, False, ""
  3788. Select Case RndNbr(3)
  3789. Case 1:DMD CL("TEENAGER KILLED"), CL(FormatScore(TeensKilledValue(CurrentPlayer) ) ), "", eNone, eNone, eNone, 1500, True, "vo_excellent"
  3790. Case 2:DMD CL("TEENAGER KILLED"), CL(FormatScore(TeensKilledValue(CurrentPlayer) ) ), "", eNone, eNone, eNone, 1500, True, "vo_greatshot"
  3791. Case 3:DMD CL("TEENAGER KILLED"), CL(FormatScore(TeensKilledValue(CurrentPlayer) ) ), "", eNone, eNone, eNone, 1500, True, "vo_notbad"
  3792. End Select
  3793. TeensKilled(CurrentPlayer) = TeensKilled(CurrentPlayer) + 1
  3794. AddScore2 TeensKilledValue(CurrentPlayer)
  3795. TeensKilledValue(CurrentPlayer) = TeensKilledValue(CurrentPlayer) + 50000
  3796. LightEffect 5
  3797. GiEffect 5
  3798. 'check
  3799. If TeensKilled(CurrentPlayer) MOD 4 = 0 Then StartPolice 'start police after each 4th killed teenager
  3800. If TeensKilled(CurrentPlayer) MOD 10 = 0 Then LitExtraBall 'lit the extra ball
  3801. End Sub
  3802.  
  3803. Sub LitExtraBall
  3804. DMD "_", CL("EXTRA BALL IS LIT"), "", eNone, eNone, eNone, 1500, True, "vo_extraballislit"
  3805. li070.State = 1
  3806. End Sub
  3807.  
  3808. '********************************
  3809. ' Weapons - Playfield multiplier
  3810. '********************************
  3811.  
  3812. Sub CheckWeapons
  3813. Dim a, j
  3814. a = 0
  3815. For j = 1 to 6
  3816. a = a + WeaponHits(CurrentPlayer, j)
  3817. Next
  3818. 'debug.print a
  3819. If a = 0 Then
  3820. UpgradeWeapons
  3821. Else
  3822. LightSeqWeaponLights.UpdateInterval = 25
  3823. LightSeqWeaponLights.Play SeqBlinking, , 15, 25
  3824. UpdateWeaponLights
  3825. PlaySword
  3826. End If
  3827. End Sub
  3828.  
  3829. Sub UpdateWeaponLights 'CurrentPlayer
  3830. Li035.State = WeaponHits(CurrentPlayer, 1)
  3831. li037.State = WeaponHits(CurrentPlayer, 2)
  3832. li038.State = WeaponHits(CurrentPlayer, 3)
  3833. li039.State = WeaponHits(CurrentPlayer, 4)
  3834. li040.State = WeaponHits(CurrentPlayer, 5)
  3835. Li036.State = WeaponHits(CurrentPlayer, 6)
  3836. End Sub
  3837.  
  3838. Sub ResetWeaponLights 'CurrentPlayer
  3839. Dim j
  3840. For j = 1 to 6
  3841. WeaponHits(CurrentPlayer, j) = 1
  3842. Next
  3843. UpdateWeaponLights
  3844. End Sub
  3845.  
  3846. Sub UpgradeWeapons 'increases the playfield multiplier
  3847. Weapons(CurrentPlayer) = Weapons(CurrentPlayer) + 1
  3848. UpdateWeaponLights2
  3849. AddPlayfieldMultiplier 1
  3850. ResetWeaponLights
  3851. aWeaponSJactive = True
  3852. StartSuperJackpot 'turn on the lits SJ at the cabin
  3853. End Sub
  3854.  
  3855. Sub UpdateWeaponLights2 'collected weapons
  3856. Select Case Weapons(CurrentPlayer)
  3857. Case 1:li041.State = 1:li042.State = 0:li043.State = 0:li044.State = 0:li045.State = 0:li046.State = 0:li047.State = 0
  3858. Case 2:li041.State = 1:li042.State = 1:li043.State = 0:li044.State = 0:li045.State = 0:li046.State = 0:li047.State = 0
  3859. Case 3:li041.State = 1:li042.State = 1:li043.State = 1:li044.State = 0:li045.State = 0:li046.State = 0:li047.State = 0
  3860. Case 4:li041.State = 1:li042.State = 1:li043.State = 1:li044.State = 1:li045.State = 0:li046.State = 0:li047.State = 0
  3861. Case 5:li041.State = 1:li042.State = 1:li043.State = 1:li044.State = 1:li045.State = 1:li046.State = 0:li047.State = 0
  3862. Case 6:li041.State = 1:li042.State = 1:li043.State = 1:li044.State = 1:li045.State = 1:li046.State = 1:li047.State = 0
  3863. Case 7:li041.State = 1:li042.State = 1:li043.State = 1:li044.State = 1:li045.State = 1:li046.State = 1:li047.State = 1
  3864. End Select
  3865. End Sub
  3866.  
  3867. '*******************************************
  3868. ' Super Jackpot at the cabin and right Loop
  3869. '*******************************************
  3870.  
  3871. ' 30 seconds timer to lit the Super Jackpot at the right loop
  3872. ' once the Super Jackpot light is lit it will be lit until the end of the ball
  3873.  
  3874. Sub StartSuperJackpot 'lits the cabin's red SJ light
  3875. li048.BlinkInterval = 160
  3876. li048.State = 2
  3877. SuperJackpotTimer.Enabled = 1
  3878. SuperJackpotSpeedTimer.Enabled = 1
  3879. End Sub
  3880.  
  3881. Sub SuperJackpotTimer_Timer '30 seconds hurry up to turn off the red light at the cabin
  3882. SuperJackpotSpeedTimer.Enabled = 0 'to be sure it is stopped
  3883. SuperJackpotTimer.Enabled = 0
  3884. li048.State = 0
  3885. End Sub
  3886.  
  3887. Sub SuperJackpotSpeedTimer_Timer 'after 25 seconds speed opp the blinking of the lit SJ red cabin light
  3888. DMD "_", CL("HURRY UP"), "_", eNone, eBlink, eNone, 1500, True, "vo_hurryup"
  3889. SuperJackpotSpeedTimer.Enabled = 0
  3890. li048.BlinkInterval = 80
  3891. li048.State = 2
  3892. End Sub
  3893.  
  3894. '***********************
  3895. ' The Police - Hurry up
  3896. '***********************
  3897. ' starts after 5 police hits, 2 killed counselors or 4 teenagers
  3898. ' 30 seconds to hit 2 ramps or 3 police targets
  3899. ' scores 500.000 for each left second
  3900. ' fail and your flippers will die for 3 seconds
  3901.  
  3902. Sub StartPolice 'police hurry up
  3903. bPoliceStarted = True
  3904. PoliceL1.BlinkInterval = 160
  3905. PoliceL2.BlinkInterval = 160
  3906. Li033.BlinkInterval = 160
  3907. PoliceL1.State = 2
  3908. PoliceL2.State = 2
  3909. Li033.State = 2
  3910. PlaySound "sfx_siren1", -1
  3911. PoliceCount = 30
  3912. PoliceHurryUpTimer.Enabled = 1
  3913. PoliceRampHits = 0 'reset the count
  3914. PoliceTargetHits = 0 'reset the count
  3915. End Sub
  3916.  
  3917. Sub StopPolice
  3918. PoliceHurryUpTimer.Enabled = 0
  3919. PoliceRecoverTimer.Enabled = 0
  3920. bPoliceStarted = False
  3921. StopSound "sfx_siren1"
  3922. PoliceL1.State = 0
  3923. PoliceL2.State = 0
  3924. Li033.State = 0
  3925. PoliceRampHits = 0 'reset the count
  3926. PoliceTargetHits = 0 'reset the count
  3927. PoliceCount = 0
  3928. End Sub
  3929.  
  3930. Sub PoliceHurryUpTimer_Timer '30 seconds, runs once a second
  3931. PoliceCount = PoliceCount - 1
  3932. If PoliceCount = 8 Then 'speed up the Lights
  3933. DMD "_", CL("HURRY UP"), "d_border", eNone, eBlinkFast, eNone, 2000, True, "vo_timerunningout"
  3934. PoliceL1.BlinkInterval = 80
  3935. PoliceL2.BlinkInterval = 80
  3936. Li033.BlinkInterval = 80
  3937. PoliceL1.State = 2
  3938. PoliceL2.State = 2
  3939. Li033.State = 2
  3940. End If
  3941. If PoliceCount = 0 Then
  3942. PoliceHurryUpTimer.Enabled = 0
  3943. DMD CL("THE POLICE"), CL("SHOT YOU"), "d_border", eNone, eNone, eNone, 2500, True, "vo_holyshityoushootme"
  3944. DisableTable True 'disable the table and...
  3945. PoliceRecoverTimer.Enabled = 1 '... start the 3 seconds timer to enable the table again
  3946. End If
  3947. End Sub
  3948.  
  3949. Sub PoliceRecoverTimer_Timer 'after disabling the table for 3 seconds then enable it
  3950. PoliceRecoverTimer.Enabled = 0
  3951. StopPolice
  3952. DisableTable False
  3953. End Sub
  3954.  
  3955. Sub AwardPoliceJackpot() 'scores the seconds left multiplied by 500.000
  3956. Dim a
  3957. a = PoliceCount * 500000
  3958. Select Case RndNbr(3)
  3959. Case 1:DMD CL("POLICE JACKPOT"), CL(FormatScore(a) ), "d_border", eNone, eBlinkFast, eNone, 2500, True, "vo_waytogo"
  3960. Case 2:DMD CL("POLICE JACKPOT"), CL(FormatScore(a) ), "d_border", eNone, eBlinkFast, eNone, 2500, True, "vo_welldone"
  3961. Case 3:DMD CL("POLICE JACKPOT"), CL(FormatScore(a) ), "d_border", eNone, eBlinkFast, eNone, 2500, True, "vo_younailedit"
  3962. End Select
  3963. DOF 126, DOFPulse
  3964. AddScore2 a
  3965. LightEffect 2
  3966. GiEffect 2
  3967. End Sub
  3968.  
  3969. '***********************************
  3970. ' Jason Multiball - Main multiball
  3971. '***********************************
  3972. ' shoot the cabin to start locking
  3973. ' lock 3 balls under the cabin to start
  3974. ' all main shots are Lit
  3975. ' 15 seconds ball saver
  3976. ' each succesive shot will increase the color and score
  3977. ' Blue shots: 1 million points
  3978. ' Green Shots: 2 million points
  3979. ' Yellow shots: 3 million points
  3980. ' Orange shots: 4 million points
  3981. ' Red shots: 5 million points
  3982.  
  3983. Sub StartJasonMultiball
  3984. Dim i
  3985. If bMultiBallMode Then Exit Sub 'do not start if already in a multiball mode
  3986. bJasonMBStarted = True
  3987. EnableBallSaver 15
  3988. DMD "_", CL("JASON MULTIBALL"), "_", eNone, eNone, eNone, 2500, True, "vo_multiball1"
  3989. AddMultiball 2
  3990. For i = 1 to 8
  3991. ArrowMultiPlier(i) = 1
  3992. Next
  3993. UpdateArrowLights
  3994. li016.State = 2
  3995. ChangeSong
  3996. End Sub
  3997.  
  3998. Sub StopJasonMultiball
  3999. bJasonMBStarted = False
  4000. BallsInLock(CurrentPlayer) = 0
  4001. TurnOffArrows
  4002. li016.State = 0
  4003. End Sub
  4004.  
  4005. Sub UpdateArrowLights 'sets the color of the arrows according to the jackpot multiplier
  4006. SetLightColor li062, ArrowMultiPlier(1), 2
  4007. SetLightColor li064, ArrowMultiPlier(2), 2
  4008. SetLightColor li053, ArrowMultiPlier(3), 2
  4009. SetLightColor li066, ArrowMultiPlier(4), 2
  4010. SetLightColor li067, ArrowMultiPlier(5), 2
  4011. SetLightColor li068, ArrowMultiPlier(6), 2
  4012. SetLightColor li052, ArrowMultiPlier(7), 2
  4013. SetLightColor li059, ArrowMultiPlier(8), 2
  4014. End Sub
  4015.  
  4016. '***********************************
  4017. ' Freddy Kruger Multiball - Ramps
  4018. '***********************************
  4019. ' starts after 3 counselors are killed
  4020. ' shoot the blue arrows at the ramps to collect jackpots
  4021. ' this will build the super jackpot at the right loop, shoot the cabin for a better shot
  4022.  
  4023. Sub StartFreddyMultiball
  4024. Dim i
  4025. If bMultiBallMode Then Exit Sub 'do not start if already in a multiball mode
  4026. bFreddyMBStarted = True
  4027. EnableBallSaver 15
  4028. DMD "_", CL("FREDDY MULTIBALL"), "_", eNone, eNone, eNone, 2500, True, "vo_multiball1"
  4029. AddMultiball 2
  4030. SetLightColor li064, blue, 2
  4031. SetLightColor li068, blue, 2
  4032. li015.State = 2
  4033. ChangeSong
  4034. End Sub
  4035.  
  4036. Sub StopFreddyMultiball
  4037. bFreddyMBStarted = False
  4038. li064.State = 0
  4039. li068.State = 0
  4040. li015.State = 0
  4041. End Sub
  4042.  
  4043. '***********************************
  4044. ' Michael Myers Multiball - Spinners
  4045. '***********************************
  4046. ' starts randomly after 3 counselors are killed
  4047. ' shoot the blue arrows at the spinners to collect jackpots
  4048. ' this will build the super jackpot at the lower right loop
  4049. ' shoot it to collect it
  4050.  
  4051. Sub StartMichaelMultiball
  4052. Dim i
  4053. If bMultiBallMode Then Exit Sub 'do not start if already in a multiball mode
  4054. bMichaelMBStarted = True
  4055. EnableBallSaver 15
  4056. DMD "_", CL("MICHAEL MULTIBALL"), "_", eNone, eNone, eNone, 2500, True, "vo_multiball1"
  4057. AddMultiball 2
  4058. SetLightColor li062, blue, 2
  4059. SetLightColor li067, blue, 2
  4060. SetLightColor li059, blue, 2
  4061. li075.State = 2
  4062. ChangeSong
  4063. End Sub
  4064.  
  4065. Sub StopFreddyMultiball
  4066. bMichaelMBStarted = False
  4067. li062.State = 0
  4068. li067.State = 0
  4069. li059.State = 0
  4070. li075.State = 0
  4071. End Sub
  4072.  
  4073. '****************************
  4074. ' Mystery award at the scoop
  4075. '****************************
  4076. ' this is a kind of award after completing the inlane and outlanes
  4077.  
  4078. Sub CheckMystery 'if all the inlanes and outlanes are lit then lit the mystery award
  4079. dim i
  4080. If Mystery(CurrentPlayer, 1) + Mystery(CurrentPlayer, 2) + Mystery(CurrentPlayer, 3) + Mystery(CurrentPlayer, 4) = 4 Then
  4081. DMD "_", CL("MYSTERY IS LIT"), "", eNone, eNone, eNone, 1000, True, "vo_waytogo"
  4082. li078.State = 1
  4083. ' and reset the lights
  4084. For i = 1 to 4
  4085. Mystery(CurrentPlayer, i) = 0
  4086. Next
  4087. End If
  4088. UpdateMysteryLights
  4089. End Sub
  4090.  
  4091. Sub AwardMystery 'mostly points but sometimes it will lit the special or the extra ball
  4092. Dim tmp
  4093. Select Case RndNbr(20)
  4094. Case 1:LitExtraBall 'lit extra ball
  4095. Case 2:LitSpecial 'lit special
  4096. Case Else:
  4097. tmp = 250000 + RndNbr(25) * 10000 'add from 250.000 to 500.000
  4098. Select Case RndNbr(4)
  4099. Case 1:DMD CL("MYSTERY SCORE"), CL(FormatScore(tmp) ), "", eNone, eNone, eNone, 1000, True, "vo_notbad"
  4100. Case 2:DMD CL("MYSTERY SCORE"), CL(FormatScore(tmp) ), "", eNone, eNone, eNone, 1000, True, "vo_excellentscore"
  4101. Case 3:DMD CL("MYSTERY SCORE"), CL(FormatScore(tmp) ), "", eNone, eNone, eNone, 1000, True, "vo_nowyouaregettinghot"
  4102. Case 4:DMD CL("MYSTERY SCORE"), CL(FormatScore(tmp) ), "", eNone, eNone, eNone, 1000, True, "vo_welldone"
  4103. End Select
  4104. End Select
  4105. vpmtimer.addtimer 2500, "kickBallOut '"
  4106. End Sub
  4107.  
  4108. 'DMD CL(""), CL(""), "", eNone, eNone, eNone, 1000, True, ""
  4109.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement