Jump to content



Photo
- - - - -

Is there a way to detect if a ball was destroyed?

kicker ball destroyed

  • Please log in to reply
9 replies to this topic

#1 CrimsonTurtle8

CrimsonTurtle8

    Enthusiast

  • Members
  • PipPipPip
  • 386 posts
  • Location:US

  • Flag: ---------

  • Favorite Pinball: Theatre of Magic

Posted 25 January 2024 - 03:13 AM

Is there a way in VP to trigger an event ONLY if a kicker destroys a ball? So not Kicker_Hit() but something like:

 

If Kicker1.Destroyball Then

 

Kicker2.Createball

 

End If

 

Basically, I'd like some invisible safety kickers if balls get stuck but I can only make a new ball if I'm SURE the safety kicker actually destroyed the stuck one. Thanks!



#2 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,859 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 25 January 2024 - 04:50 AM

if you call the event object.destroyball

the ball should just vanish

 

you can try it, have magnasave key trigger a destroyball event with the ball sitting in the middle of the table

ball should vanish


If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow


#3 hmueck

hmueck

    MaX

  • VIP
  • 2,190 posts
  • Location:Hamburg

  • Flag: ---------

  • Favorite Pinball: IPDB Top 300



Contributor

Posted 25 January 2024 - 05:56 AM

Is there a way in VP to trigger an event ONLY if a kicker destroys a ball? So not Kicker_Hit() but something like:

 

If Kicker1.Destroyball Then

 

Kicker2.Createball

 

End If

 

Basically, I'd like some invisible safety kickers if balls get stuck but I can only make a new ball if I'm SURE the safety kicker actually destroyed the stuck one. Thanks!

 

I think you're overthinking this.

When the kicker is hit, it will destroy the ball. Then you know it's gone.
Or set a variable.

Kicker1.Destroyball

kicker1destroyedtheball=true


Edited by hmueck, 25 January 2024 - 05:57 AM.

VPX0beta tables: 29cff786951ed9c1a70fc1fa47f5e3c1.png 0cecd68ffa2537a7262337834a05bbbe.png Finish them if you like!

#4 CrimsonTurtle8

CrimsonTurtle8

    Enthusiast

  • Members
  • PipPipPip
  • 386 posts
  • Location:US

  • Flag: ---------

  • Favorite Pinball: Theatre of Magic

Posted 25 January 2024 - 02:53 PM

Sorry I left out a key point! The destroying isn't the problem. When it destroys the ball, my safety mechanism automatically makes a new ball. It destroys any hidden balls I can't see then makes a new one no matter what. But even if it isn't destroying a ball, it adds a new one to the playfield and that's the problem. I want it to destroy anything it finds, but only make a NEW ball if it ACTUALLY successfully destroys something--not just triggering the destroy command. I have a feeling my safety feature idea won't work then, based on what I'm hearing. 

 

I'm getting a mystery ball stuck during multiball and I have no idea where it's going and I thought this might be a nice failsafe if I can't nail down the problem, but it seems like it won't work.



#5 Fusionwerks

Fusionwerks

    Poorly recovering pinball addict

  • Platinum Supporter
  • 417 posts

  • Flag: United States of America

  • Favorite Pinball: JP (DE), Deadpool, James Bond 007

Posted 25 January 2024 - 03:05 PM

Sounds like you need to set a true/false flag first to determine if it NEEDS to create one, then you can bounce that result into an if/then statement. Or maybe we need to understand better exactly what the scenario is. Maybe explain EACH step of the scenario, and what you want to accomplish.

#6 CrimsonTurtle8

CrimsonTurtle8

    Enthusiast

  • Members
  • PipPipPip
  • 386 posts
  • Location:US

  • Flag: ---------

  • Favorite Pinball: Theatre of Magic

Posted 25 January 2024 - 04:17 PM

Oh yeah I don't know how to do a true false flag. Basically I have invisible kickers under any spot the ball can get caught. Every 10 seconds the game checks if the player hasn't touched any keys, then destroys anything touching those kickers and creates a new ball. I need it to test if those kickers are actually destroying something. Otherwise, the player can just hold the ball on a flipper and get a new ball every ten seconds. If it could test that it's actually destroying the only ball in play, it would never make a duplicate ball for no reason.


Edited by CrimsonTurtle8, 25 January 2024 - 04:17 PM.


#7 hmueck

hmueck

    MaX

  • VIP
  • 2,190 posts
  • Location:Hamburg

  • Flag: ---------

  • Favorite Pinball: IPDB Top 300



Contributor

Posted 25 January 2024 - 04:36 PM

Not sure, but won't VP show an error message, when you try to destroy a ball in a kicker, which has no ball in it?


VPX0beta tables: 29cff786951ed9c1a70fc1fa47f5e3c1.png 0cecd68ffa2537a7262337834a05bbbe.png Finish them if you like!

#8 gtxjoe

gtxjoe

    VPF Veteran

  • VIP
  • 5,152 posts

  • Flag: United States of America

  • Favorite Pinball: Medieval Madness, AbraCadabra



Contributor

Posted 25 January 2024 - 06:28 PM

When this happens, you can use the debugger to retrieve the location of all balls. See here
https://www.vpforums...showtopic=48842

If the ball is lost by falling through the playfield and cant figure out why, there is a sub you can add to the script that monitors if a ball has a negative height that you can use to spit out another ball. Search some the VPW releases for code that contains the word Narnia.

Edited by gtxjoe, 25 January 2024 - 06:29 PM.


#9 Fusionwerks

Fusionwerks

    Poorly recovering pinball addict

  • Platinum Supporter
  • 417 posts

  • Flag: United States of America

  • Favorite Pinball: JP (DE), Deadpool, James Bond 007

Posted 25 January 2024 - 10:39 PM

the best way to protect a ball from getting caught/stuck/lost somewhere it isn't supposed to is to have walls protecting those areas, and set them to invisible.



#10 EpeCreaciones

EpeCreaciones

    Hobbyist

  • Members
  • PipPip
  • 43 posts

  • Flag: Spain

  • Favorite Pinball: Tales of Arabian Nights

Posted 25 January 2024 - 11:57 PM

Hello.
 
When you create a new ball, you put a counter variable to know how many balls are in play, on the PF at each moment. We will call this variable BIP.
This variable is the one that carries out internal control in the ball code over the PF or that are in play, BIP of Ball In Play.
 
   Dim BIP
   BIP = 0 'We initialize the value to zero because at this time, we have not yet created any balls on the PF.
 
 
Creating a new ball (for play, or for a multiball, for example) causes you to add +1 to the ball counter control variable:
 
   Kicker_In.CreateBall
   BIP = BIP + 1
 
Then you throw the ball in any direction you want, including up, to continue the game. For example, to release the ball to the right of the kicker:
 
   Kicker_In.Kick 90.7
 
 
When the ball falls to a kicker that destroys it (Drain, Tunnel Hole, etc.) that is, when the ball physically leaves the field of play (not by placing itself on another platform or elevated mini PF), Remember: use it if the ball physically leaves the PF, if you pretend to go under the PF to exit or reappear somewhere else, or if you are going to teleport the ball in some "disappear and reappear" way.
 
So you use:
 
   Kicker_Out.DestroyBall
   BIP = BIP - 1
 
When you respawn, you add +1 again, that is:
 
   Kicker_In.CreateBall
   BIP = BIP + 1
 
 
If it is the same hole in the PF that it respawns through, you use its corresponding name for that:
 
   Kicker_Out.CreateBall
   BIP = BIP + 1
 
 
This way, you will know when there are no more balls left on the PF. You will know the event that causes balls to be subtracted or added according to your script. For example, Drain_Hit will trigger a ball loss, so if you have another variable with the number of balls remaining in the game, you will subtract -1 from that value, in addition to subtracting one ball from the variable that controls balls over the PF or that are at stake, BIP.
 
If it is a multiball, you will know that one of the multiball balls has been lost, so you will have to decide whether to create a new one or not, depending on the maximum number of balls you want to have at the same time on the PF.
 
So, if you know that BIP = 0, it means that the ball has disappeared at some point that is designed to destroy balls, and if, as you say, your script creates a lost ball if the sensors you installed do not detect anything, it is the same as checking in in "If BIP = 0 Then ..."
 
If it got stuck somewhere on the PF, but has not been deleted from the game, BIP must have a value of at least 1 ball over PF, that is, there is a ball in play even if the sensors you placed do not detect a collision in them.
 
 
I don't know if I have helped you clarify ideas, but in most scripts I have read a similar method is usually used to keep track of balls in play.
 
Greetings. :)
 
 
EpeC.






Also tagged with one or more of these keywords: kicker, ball destroyed