Author Topic: Itchigo's Multiball Code  (Read 6694 times)

0 Members and 1 Guest are viewing this topic.

Offline Itchigo

  • Victory is mine!!
  • Administrator
  • Pinball Wizard
  • *****
  • Posts: 1,423
  • Country: us
  • Karma: +10/-0
Itchigo's Multiball Code
« on: December 07, 2012, 10:29:53 PM »
Multball Code:

Here's how I code my multiball. This is basic and will help you keep track of the ball(s). This assumes 2 kickers and 3 ball multiball. It also assumes you have to hit a target down to initiate multiball.

Objects you will need (correctly named):
Kicker1
Kicker2
Ballrelease
Mutiballtarget
Multiballlight
Drain


Dim Ballslocked, Ballsinplay


Sub Kicker1_Hit()

If  Lock1.State=1 Then 'Locklight
Lockball
End If

If Tilt=False Then
Addscore 1000
Playsound""
End If

Else

Kicker1.Kick 135,15

End Sub

Sub Kicker2_Hit()

If  Lock2.State=1 Then 'Lock light
Lockball
End If

If Tilt=False Then
Addscore 1000
Playsound""
End If

Else

Kicker2.Kick 135,15

End Sub

So, if lock is lit when the kicker is hit, call the lockball sub. Otherwise kick the ball back out. If the game isn't tilted then add the score and play any sounds.



Sub Lockball()

Ballslocked=Ballslocked+1
Ballrelease.Createball
Ballrelease.Kick 90,12

If Ballslocked=2 Then Multiballlight.State=1
Mutiballtarget.Isdropped=False
End If

If Tilt=False Then
Addscore 1000
Playsound ""
End If
End Sub


We call this sub to lock the ball, add 1 to the ballslocked variable, and kick out another ball in the plungerlane. No need to change ballsinplay because you're locking one and kicking another out.

We also check for ballslocked, because if you have 2 ballslocked, turn on the multiball light and raise the target.


Sub MutiballTarget_Hit()
If Multiballlight.State=1 Then
Kicker1.Kick 135,15
Kicker2.Kick 135,15
Ballsinplay=ballsinplay+2
Lock1.State=0
Lock2.State=0
End If
End Sub

If the multiball target is hit with the light on then kick the balls out, reset the lights, and expect 2 extra balls in play.


Other things you need:

In the "Newgame" or Startgame sub you will need: Ballsinplay=1
Ballslocked=0

In your "Nextball Sub you need:
Ballsinplay=1

Ballsinplay=0 (when you start your bonus routine, then when you kick out a new ball you have 1 ball in play).

In your "Drain_Hit" Sub you need: (Example).

Sub Drain_Hit()
Ballsinplay=Ballsinplay-1
If Ballsinplay=0 Then
Start your bonus or whatever.
End If
End Sub

This keeps track of Multiball for you.


Hope this helps any budding tablemakers. Obviously you can get much more elaborate with jackpots, and relocking balls during multiball, etc. But this is a basic routine to keep track of 3 balls.
Tremble in fear! Behold my Bankai!


Offline faralos

  • Full Member
  • ***
  • Posts: 235
  • Karma: +1/-0
Re: Itchigo's Multiball Code
« Reply #1 on: December 09, 2012, 10:28:24 AM »
can you put these tutorials into a zip file of some sort?
it's a pain to have to copy these pages all the time
 
I am never wrong Once I thought I was
 but I was merely mistaken

Offline Itchigo

  • Victory is mine!!
  • Administrator
  • Pinball Wizard
  • *****
  • Posts: 1,423
  • Country: us
  • Karma: +10/-0
Re: Itchigo's Multiball Code
« Reply #2 on: December 09, 2012, 01:28:30 PM »
Sure, I'll write it tonight at work. ;D
Tremble in fear! Behold my Bankai!


Offline faralos

  • Full Member
  • ***
  • Posts: 235
  • Karma: +1/-0
Re: Itchigo's Multiball Code
« Reply #3 on: December 09, 2012, 07:30:51 PM »
well just zipping them up would have been nice
as they sit I must copy the entire thing and paste it into wordpad
 then print it out so I can read it
I am never wrong Once I thought I was
 but I was merely mistaken