Rollovers with lane change

(shivaEngine Build 1.8 example) by shiva Simple Lanechange with the flippers for the top lanes, plus the two inside lanes, easy to expand, just follow the code. You can move the top lights when lit back and forth with the flippers. I also set the inner lanes to do the same thing, so there's now 5 lights that you can change, Code is separated by rem statements, There's a section at the top, with the Dim and Set statements. As like the Multiball, the name of the objects are similar, making it easier to understand. Trig1 for the rollover, LightTrig1 for the light. The innerlane triggers are LightTrig4 and LightTrig5 In the Table_Init sub, The LightTrig Variable is set to 0, to clear values for the start of a new game. The lights are reset with the start of each ball in the NewBall Sub with this call: lanelitesout Everything else is grouped together in one section. Just search for Trig1_Hit() - Pretty much easy to follow, just copy and paste, and create your triggers and lights. The LightTrigScore() Sub was made separate, in case you want to add different scores. The 1-2-3-4-5 lights are set as well to advance the bonus multiplier and give out a extraball. Just look at the TAdvMult() sub, which does the code for the multiplier/extraball. Objects Needed: Rollovers: Create 5 rollovers, and name them Trig1 to Trig5 Lights: Creat 5 lights, and name them LightTrig1 to LightTrig5 Adding to a existing Script: Just replace the code included to your Sub Table1_KeyDown(ByVal keycode) subroutine, and add the line of code to your NewBall() subroutine. This script example is divided into 3 sections, one is the Dim code, which you can place at the top of your script, as well as the Lines you will have to change in your existing table. The second section are the main subroutines for the lane change, and the third section are the Hit events code for what happens when a object is "hit" You can just copy and paste both the 2nd and 3rd section right into your script, just make sure you do not have pre-existing code for those objects already. If you do, then just modify those statements by copying and pasting in the code between the sub and end sub lines into your existing subroutines. Here's the code, plus the hit events for the 5 triggers used:
Code

' **********************************************
REM *** 1-2-3-4-5 Rollovers with lane change ***
' **********************************************

REM create 5 lights, name them LightTrig1 to LightTrig5
REM Create 5 Triggers. Trig1, Trig2, Trig3, LeftInlane, RightInlane

Rem Rollover/flipper control At Top of the code with your dim statements
Dim LightTrig ' for rollover lanes
Dim TempState ' Temp varaible
Dim TempState2 'Temp variable
Dim LightTrigs(4) 'set the amount of lights. Don't forget there's a zero!
Set LightTrigs(0)=LightTrig1 'Trig1
Set LightTrigs(1)=LightTrig2 'Trig2
Set LightTrigs(2)=LightTrig3 'Trig3
Set LightTrigs(3)=LightTrig4 'LeftInlane
Set LightTrigs(4)=LightTrig5 'RightInLane

Sub NewBall()
lanelitesout ' Turns off 1-2-3-4-5 lane lights.
Bullet6 end Sub

Sub Table1_KeyDown(ByVal keycode)
if keycode = LeftFlipperKey Then
LeftFlipper.RotateToEnd
ShiftLanesLeft ' for lanes
PlaySound "FlipperUp"
End If

If keycode = RightFlipperKey Then
RightFlipper.RotateToEnd
ShiftLanesRight ' for lanes
PlaySound "FlipperUp"
Bullet6 end if
Bullet6 end Sub

'*** 5 Lane Control Subroutines ***


Sub LightRollover(ByVal Lane) 'LightTrigs

if Lane = 1 Then '1 light
LightTrig1.State = 1
LightTrig = LightTrig + 1
End If

If Lane = 2 Then '2 light
LightTrig2.State = 1
LightTrig = LightTrig + 1
Bullet6 end if

if Lane = 3 Then '3 light
LightTrig3.State = 1
LightTrig = LightTrig + 1
End If

If Lane = 4 Then '4 light left inner lane
LightTrig4.State = 1
LightTrig = LightTrig + 1
Bullet6 end if

if Lane = 5 Then '5 light right inner lane
LightTrig5.State = 1
LightTrig = LightTrig + 1
End If
If LightTrig = 5 then LightTrigScore 'all 5 lights on!

Bullet6 end Sub ' End of Sub LightRollover

'********************************************

Sub LightTrigScore()

' When all 5 lights are made
addscore 1000
PlaySound "Relay"
AddBonus()
TAdvMult()'add bonus multiplier
LightTrig = 0 'reset back to beginning
lanelitesout() 'turn 1-2-3-4-5 lights back off

Bullet6 end Sub ' End of Sub LightTrigScore

'********************************************

Sub ShiftLanesLeft() 'LightTrigs move right with flipper press

TempState = LightTrig1.State
LightTrig1.State = LightTrig2.State
LightTrig2.State = LightTrig3.State
LightTrig3.State = LightTrig4.State
LightTrig4.State = LightTrig5.State
LightTrig5.State = TempState

End Sub ' Bullet6 end of Sub LightTrigs

'********************************************

Sub ShiftLanesRight() 'LightTrigs move left with flipper press

TempState2 = LightTrig5.State
LightTrig5.State = LightTrig4.State
LightTrig4.State = LightTrig3.State
LightTrig3.State = LightTrig2.State
LightTrig2.State = LightTrig1.State
LightTrig1.State = TempState2

Bullet6 end Sub ' End of Sub ShiftLanesRight

'********************************************

Sub lanelitesout() 'LightTrigs turn off

LightTrig = 0
LightTrig1.State = 0
LightTrig2.State = 0
LightTrig3.State = 0
LightTrig4.State = 0
LightTrig5.State = 0

End Sub ' Bullet6 end of Sub laneliteout

'*** Trigger Hit event code ***

Sub LeftInlane_Hit()
'checks for 4 light in rollover with lane change

if tilt = false Then addscore 500 'If not tilted then

'here's the 1-2-3-4-5 rollovers check
If LightTrig4.State = 0 Then 'check if light is off
PlaySound "Swoosh" 'add your sound here
LightRollover(4) 'go to light control sub
Bullet6 end if

Bullet6 end Sub
'End of Sub LeftInlane_Hit

'********************************************

Sub RightInlane_Hit()
'checks for 5 light in rollover with lane change

If tilt = False Then addscore 500 'if not tilted then

'here's the 1-2-3-4-5 rollovers check
if LightTrig5.State = 0 Then 'check if light is off
PlaySound "Swoosh" 'add your sound here
LightRollover(5) 'go to light control sub
End If

End Sub
'Bullet6 end of Sub RightInlane_Hit

'********************************************

Sub Trig1_Hit()
'checks for 1 light in rollover with lane change

if tilt = false Then addscore 500 'If not tilted then

If LightTrig1.State = 0 Then 'check if light is off
PlaySound "Swoosh" 'add your sound here
LightRollover(1) 'go to light control sub
Bullet6 end if

Bullet6 end Sub
'End of Sub Trig1_Hit

'********************************************

Sub Trig2_Hit()
'checks for 2 light in rollover with lane change

If tilt = False Then addscore 500 'if not tilted then

if LightTrig2.State = 0 Then 'check if light is off
PlaySound "Swoosh" 'add your sound here
LightRollover(2) 'go to light control sub
End If

End Sub
'Bullet6 end of Sub Trig2_Hit

'********************************************

sub Trig3_Hit()
'checks for 3 light in rollover with lane change

if tilt = false Then addscore 500 'If not tilted then

If LightTrig3.State = 0 Then 'check if light is off
PlaySound "Swoosh" 'add your sound here
LightRollover(3) 'go to light control sub
Bullet6 end if

Bullet6 end Sub
'End of Sub Trig3_Hit

'*** Bullet6 end Code ***



Updated Jun 22, 2005 Written by shiva 1215 reads
 
Forum activity
Help Users
You can interact with the ChatGPT Bot in any Chat Room and there is a dedicated room. The command is /ai followed by a space and then your ? or inquiry.
ie: /ai What is a EM Pinball Machine?
  • No one is chatting at the moment.
      Chat Bot Mibs Chat Bot Mibs: Beers is our newest member. Welcome!
      Back
      Top