Jump to content



Photo
- - - - -

Drop Target Reset / Timing

drop targets drop target reset timing

  • Please log in to reply
9 replies to this topic

#1 ronimhoff

ronimhoff

    Hobbyist

  • Members
  • PipPip
  • 36 posts
  • Location:Croton on Hudson, NY

  • Flag: United States of America

  • Favorite Pinball: Williams Flash

Posted 11 January 2018 - 02:47 AM

Hi All, I have come across and solved something that may help others. 

 

I just put up a new X table for approval, but in the process of building that one I had this problem with drop targets. I do the typical stuff where you have a bank of n targets and each time you hit 1, you check to see if they are all hit, and you reset them. My checks were consistently failing and i couldn't figure out why. 

 

However, finally I thought, wait a second, there is drop speed in VPX and maybe my check is running before the sucker is fully dropped. 

 

Low and behold that was it ( first time I've ever been miffed about code running too fast ! ) 

 

Here's what I did in case you guys are running into it. 

 

Entrance critera is a bank of 4 targets with 3 targets having an isDropped = 1 value ( because that's what a target.isDropped returns in X by the way, rather than true )

 

Player is about to hit 4th and only remaining target with .isDropped = 0

 

I hope this helps someone.

 

....

 

The target4_hit routine calls this guy after an Addscore

 

Sub CheckDropTargets()
      CheckDropTargetTimer.enabled = true
End Sub
 
' The CheckDropTargetTime is set to 500 ms in my case, so after that period of time (which allows the target to fully drop and meet the isDropped = 1 state), the code to see if all 4 are dropped runs.
 
Sub CheckDropTargetTimer_Timer
   i = 0 
   For each target in DropTargets
       i = i + target.isDropped
   Next 
   ' The output to the back glass that allowed me to see what was happening
   MessageBox2.text = i
   If i = 4 Then
      AddScore 5000
      For each target in DropTargets
         target.isDropped = False
     Next 
     TurnOnTargetLights
   End If
   CheckDropTargetTimer.enabled = false
End Sub


#2 BorgDog

BorgDog

    We come in peace.. shoot to kill.. shoot to kill.

  • Members
  • PipPipPipPip
  • 1,427 posts
  • Location:Leavenworth, WA

  • Flag: United States of America

  • Favorite Pinball: Alien Star, TNA



Posted 11 January 2018 - 03:36 AM

When your ball hits a drop target there are actually 2 events that happen for our purposes.  the first is a DropTarget_hit which as the name implies is when the drop target is first hit and can be used with a Sub DropTarget_hit.

 

The second, which is what you want to run your checks off of is a short time later when the drop target reaches the bottom of it's animation and is DropTarget_dropped, so would be used with a Sub DropTarget_dropped routine and at that time the isdropped is at 1 so no need for the timer.

 

Hope that makes sense and helps.



#3 ronimhoff

ronimhoff

    Hobbyist

  • Members
  • PipPip
  • 36 posts
  • Location:Croton on Hudson, NY

  • Flag: United States of America

  • Favorite Pinball: Williams Flash

Posted 11 January 2018 - 03:55 AM

I'll try it, I was unaware of the dropped ( as in it dropped / not necessarily completely ) . Thank you very much.



#4 gtxjoe

gtxjoe

    VPF Veteran

  • VIP
  • 5,151 posts

  • Flag: United States of America

  • Favorite Pinball: Medieval Madness, AbraCadabra



Contributor

Posted 11 January 2018 - 04:19 AM

Dont forget to read the command reference.txt file in the VP folder for details on the VP object routines. In this case it should mention the target hit raised and dropped routines

#5 ronimhoff

ronimhoff

    Hobbyist

  • Members
  • PipPip
  • 36 posts
  • Location:Croton on Hudson, NY

  • Flag: United States of America

  • Favorite Pinball: Williams Flash

Posted 11 January 2018 - 04:21 AM

Cleaner and meaner. .. Thanks again BorgDog

 

This instead of the prior ( for targets 2,3,4, and 5)

 

Sub Target5_Hit
   Target5.isDropped = True
   AddScore 500
   TargetLights(3).state = 0
End Sub
 
Sub Target5_Dropped
   CheckDropTargets
End Sub
 
Sub CheckDropTargets
   i = 0 
   For each target in DropTargets
       i = i + target.isDropped
   Next 
   If i = 4 Then
      AddScore 5000
      For each target in DropTargets
         target.isDropped = False
     Next 
     TurnOnTargetLights
   End If
End Sub

gtxjoe...I hear you...."Read the directions !" ..... ha ha ha.  My daughters could tell you some stories....



#6 BorgDog

BorgDog

    We come in peace.. shoot to kill.. shoot to kill.

  • Members
  • PipPipPipPip
  • 1,427 posts
  • Location:Leavenworth, WA

  • Flag: United States of America

  • Favorite Pinball: Alien Star, TNA



Posted 11 January 2018 - 01:41 PM

your target5.isdropped=true statement at that point is unnecessary and actually won't have any effect at that point as the animation has already started due to the hit and it will be set as true when it is at the bottom and not sooner.  that statement however can be used just like the isdropped=false elsewhere in the script if you want to drop a target without it actually being hit.

 

another way I've seen and used for the check part is a statement like

 

if Target1.isdropped and Target2.isdropped and Target3.isdropped and Target4.isdropped then  

 

while that may seem longer and more cumbersome it eliminates the need for the counter and the for..next loop  



#7 allknowing2012

allknowing2012

    Pinball Fan

  • Members
  • PipPipPipPip
  • 1,948 posts
  • Location:Waterloo, ON

  • Flag: Canada

  • Favorite Pinball: bucaneer

Contributor

Posted 12 January 2018 - 12:51 AM

FYI .. it was just added last year so not all the common if you are looking thru older tables scripts.


* I don't know everything - I just have no life *
testimageNL

 

 

 

#8 ANDROID

ANDROID

    Enthusiast

  • Silver Supporter
  • 285 posts
  • Location:Fox Cities, Wisconsin......USA

  • Flag: United States of America

  • Favorite Pinball: EM's MM, TOM, CV, AFM..lots

Posted 23 May 2020 - 08:37 AM

I know its an old topic, im really bad at figuring out script.  Loserman's El Dorado (Gottlieb) has two banks of cards 10 cacti and 5 side bank.  after dropping all fifteen drop targets it resets once and for specials or addaball like in the lariat clone. but it won't reset to a third time.  So after 30 drop targets are dropped there is nothing to aim for... I tried monkeying around with the script but to no avail.  Its probably an easy fix for guys



#9 Thalamus

Thalamus

    Pinball Wizard

  • Platinum Supporter
  • 4,976 posts

  • Flag: Norway

  • Favorite Pinball: GOT, Alien Star, LOTR, TOM

Posted 23 May 2020 - 09:13 AM

Post it in the support thread of the table and since it is Loserman, I'm sure he will look into it and fix it.


From now on. I won't help anyone here at VPF. Please ask Noah why that is.


#10 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

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

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 23 May 2020 - 10:17 AM

I know its an old topic, im really bad at figuring out script.  Loserman's El Dorado (Gottlieb) has two banks of cards 10 cacti and 5 side bank.  after dropping all fifteen drop targets it resets once and for specials or addaball like in the lariat clone. but it won't reset to a third time.  So after 30 drop targets are dropped there is nothing to aim for... I tried monkeying around with the script but to no avail.  Its probably an easy fix for guys

I've just converted the "Sci Fi Classic" from Future pinball and I thought you may have had a similar issue that I had, but maybe not. Post it here anyway as seems relevant.

 

As thread title says, timing. This game checks all targets if dropped, but Visual Pinball drops aren't dropped until the animation is dropped? I even brute force the drops and still didn't work.

 

Really it is silly to rely on "Light states", "Drop states" anyway.

' Save the drops in array, 0-1
Dim DropTargets : DropTargets = Array(0,0,0,0,0,0,0)

Sub FourBank1_Hit()
	If (fpTilted = False) Then
		DropTargets(0) = 1
		CheckDropTargets()
	End If
End Sub

' Checks all dropped
Function DropsCompleted()
	Dim dt : Dim complete
	for each dt in DropTargets
		if dt = 0 then
			complete = 0
			Exit For
		else complete = 1
		End If
	next
	DropsCompleted = complete
End Function

' Reset at end of ball for example
Sub ResetTargets()
	DropTargets = Array(0,0,0,0,0,0,0)
End Sub

 


Bump maps are the new auto-tune :BDH:
VPX - RSS Updates ---- blog.flippingflips.xyz/en/ -- Visual Pinball No.1 (2021) . Est.2000






Also tagged with one or more of these keywords: drop targets, drop target reset, timing