Jump to content

Help with ball rolling sounds


Delta23

Recommended Posts

  • Content Provider
Posted

G'day everyone,

 

I’m currently updating my Aliens table and have run into an issue I can not resolve. I’m hoping someone here may be able to enlighten me.

 

I want to add a captured ball to the table, which I managed to do, but this breaks the ball rolling sounds.

 

Normally a ball on the table (BallX) plays the rolling sounds.

If BallX is locked, a second ball (BallY) is fed onto the table and it plays all the rolling sounds.

If you then lock BallY you get the multiball (2 balls) and you get the rolling sounds.

 

However, when I add the captured ball to the table I get that BallX plays all the rolling sounds.

But when BallX is locked and BallY is fed onto the table, all rolling sounds are gone.

This is also true if you get the multiball.

 

I think the script in JP's Rolling Sounds subroutine is set up so it only has to worry about 2 balls been on the table at the same time.

Adding the captured ball then breaks the rolling sounds as you now will have 3 balls on the table after the first one is locked.

 

I have taken a look at JP’s subroutine and I can not figure out what to change to resolve this issue. Any help with this would be highly appreciated.

 

This is the script I added to the table to get the Captured Ball working:

 

CaptiveBall.CreateBall

CaptiveBall.Kick 90, 1

CaptiveBall.enabled=0

 

 

Below is JP’s subroutine script for his Ball Rolling sounds on this table (Sorcerer):

 

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

' JP's VP10 Rolling Sounds

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

 

Const tnob = 20 ' total number of balls

Const lob = 0 'number of locked balls

ReDim rolling(tnob)

InitRolling

 

Sub InitRolling

Dim i

For i = 0 to tnob

rolling(i) = False

Next

End Sub

 

Sub RollingUpdate()

Dim BOT, b, ballpitch

BOT = GetBalls

 

' stop the sound of deleted balls

For b = UBound(BOT) + 1 to tnob

rolling(b) = False

StopSound("fx_ballrolling" & b)

Next

 

' exit the sub if no balls on the table

If UBound(BOT) = lob - 1 Then Exit Sub 'there no extra balls on this table

 

' play the rolling sound for each ball

For b = lob to UBound(BOT)

If BallVel(BOT(b))> 1 Then

If BOT(b).z <30 Then

ballpitch = Pitch(BOT(b))

Else

ballpitch = Pitch(BOT(b)) + 15000 'increase the pitch on a ramp or elevated surface

End If

rolling(b) = True

PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), Pan(BOT(b)), 0, ballpitch, 1, 0

Else

If rolling(b) = True Then

StopSound("fx_ballrolling" & b)

rolling(b) = False

End If

End If

Next

End Sub

  • Content Provider
Posted

G'day everyone!

 

I have resolved this issue with JPs assistance.

 

Thank you for taking a look.

Posted
2 hours ago, Delta23 said:

G'day everyone!

 

I have resolved this issue with JPs assistance.

 

Thank you for taking a look.

 

That's great, but what was the fix?

It would be helpful to others. 

Thx

  • Content Provider
Posted

G'day KrankyPantz,

 

 

My bad. 

 

You, of course, are correct!

 

JPs ball rolling subroutine can handle up to 20 balls on the table through this constant: Const tnob = 20 (20 is overkill as this table only ever has 2 balls on the table, 3 if you add a captured ball, but JP uses that many balls to test the table without getting errors) 

The subroutine can also handle captured balls through this constant: Const lob = 0 (any balls added here will NOT play the rolling sounds, this makes sense as the ball is captured)

 

The issue was that each ball on the table must also have its own table rolling sound!

This table only had 2 ball rolling sounds listed in the Sound Manager: "fx_ballrolling0" and "fx_ballrolling1"

 

So the subroutine was playing "fx_ballrolling0" for ball one, once locked and ball 2 made it into the table it would then play "fx_ballrolling1" (all good).

Adding a captured ball would create an issue as the captured ball would use "fx_ballrolling0",  ball 1 would then use "fx_ballrolling1" and, if locked, ball 2 would have no sound to play.

 

Making Const lob = 1 to account for the captured ball, was not helping because all it does is tell the program not to play "fx_ballrolling0". Ball 1 would then play "fx_ballrolling1" and then I was out of sounds if ball 2 was on the table!

 

To resolve the issue I added more ballrolling sounds to the table "fx-ballrollin2" and "fx_ballrolling3"(just to make sure) :)

 

I hope this makes sense, please let me know if you need clarification.

 

Greetings and kind regards

Delta23

 

Archived

This topic is now archived and is closed to further replies.

×
  • Create New...