- This topic has 10 replies, 6 voices, and was last updated 6 years, 12 months ago by ninuzzu.
-
AuthorPosts
-
May 6, 2017 at 3:24 am #53608
Hello guys I would like to tell you how to add ballshadow in a VPX table.
First you need the ballshadow primitive(s), their texture and material; you can take everything from this test table:
Now it comes the scripting, you can copy paste this in your tables:
[code]
‘*********** BALL SHADOW *********************************
Dim BallShadowBallShadow = Array (BallShadow1)
Sub BallShadowUpdate_timer()
Dim BOT, b
BOT = GetBalls
‘ hide shadow of deleted balls
If UBound(BOT)<(tnob-1) Then
For b = (UBound(BOT) + 1) to (tnob-1)
BallShadow(b).visible = 0
Next
End If
‘ exit the Sub if no balls on the table
If UBound(BOT) = -1 Then Exit Sub
‘ render the shadow for each ball
For b = 0 to UBound(BOT)
If BOT(b).X < Table1.Width/2 Then
BallShadow(b).X = ((BOT(b).X) – (Ballsize/6) + ((BOT(b).X – (Table1.Width/2))/7)) + 10
Else
BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X – (Table1.Width/2))/7)) – 10
End If
ballShadow(b).Y = BOT(b).Y + 20
If BOT(b).Z > 20 Then
BallShadow(b).visible = 1
Else
BallShadow(b).visible = 0
End If
Next
End Sub[/code]
Now I will explain that code, which is based on JP’s rolling sound routine.
You need as much ballshadows primitives as the tnob, defined in the Jp’s rolling sound routine. So, for example
Const tnob=3
This means that we have maximum 3 balls during the gameplay, so you need 3 ballshadow primitives (one for each ball). The first part will become
Dim BallShadow
BallShadow = Array(Ballshadow1,Ballshadow2,Ballshadow3)
So you have to duplicate the primitive “Ballshadow1”, included in the sample table above, as many times as the total number of balls (tnob).
Finally, to make it work, you need to:
-add a timer, always enabled and with a low interval (I set it at 10 ms): name it BallshadowUpdate
-change the instances of Table1 with the name of the Table you find in the Vp Editor (default name is table1, but it may change).
-define the ballsize (default value is 50) or replace the ballsize instances with the value 50 or so.
Note: some authors are using an older version of this code, so please update it with the new one. It fixes some situations when the ball gets destroyed (e.g. it drains) but the shadow is still visible above the pf.
This is the standard method, it works for 90% of the tables, but there are some cases where you need to hide the shadow because a fakeball is used and you don’t want to display its shadow (or mute the rolling sound).
Cheers
You need to login in order to like this post: click here
3 users thanked author for this post.
May 6, 2017 at 2:13 pm #53615You should add this as a ‘tutorial’ Â and/or part of the wiki otherwise it will get buried in the forums.
You need to login in order to like this post: click here
May 6, 2017 at 4:04 pm #53633I was about to say the same Dark – this is exactly the stuff that we need ot keep in a tutorial or wiki section instead of forum !
Thank you Ninuzzu.
You need to login in order to like this post: click here
May 6, 2017 at 5:40 pm #53644Totally agree. I will say I love the test tables! So easy to use the code. As they make it very clear what to look for
********************************************************
Messing with the VPinball app and push notifications.
So if you haven't downloaded app yet what are you waiting for!?
for IOS and Android********************************************************
You need to login in order to like this post: click here
May 7, 2017 at 2:41 am #53670Ok, randr, could you please add it to the wiki? thanks.
You need to login in order to like this post: click here
May 7, 2017 at 6:31 am #53674@randr I’ve put this info up in the wiki, but, what feel we need is some sub levels right under top level ‘Knowlege base’. Editing, Installation, Tweaks – I’m sure we could use a few more. That way I don’t piss off Dark to much ;) ( nah – he is right, need some structure )
You need to login in order to like this post: click here
May 7, 2017 at 7:23 am #53675I will work on that this week. That is why I improved the search engine to Ajax. Type something in search on right side bar but don’t press enter. I think WordPress is going to have front end editing “built in” very soon so this could become much better… currently it’s kinda a hack job. Nice part is all wiki publications are “posts” so I can always move them to a cleaner layout
********************************************************
Messing with the VPinball app and push notifications.
So if you haven't downloaded app yet what are you waiting for!?
for IOS and Android********************************************************
You need to login in order to like this post: click here
May 11, 2017 at 3:27 pm #53834Hey @ninuzzu, how can I hide the shadow while on a ramp? I have a ramp with very little transparency and I’d like to keep the ball shadow from appearing on the playfield below.
Thanks!You need to login in order to like this post: click here
May 11, 2017 at 4:10 pm #53837I would think tie it to the same code as rolling sound with height?
********************************************************
Messing with the VPinball app and push notifications.
So if you haven't downloaded app yet what are you waiting for!?
for IOS and Android********************************************************
You need to login in order to like this post: click here
May 11, 2017 at 5:23 pm #53838That was easy. Thanks Ninuzzu!! New 2.0 of Kiss coming soon with this change and others.
You need to login in order to like this post: click here
May 12, 2017 at 2:48 am #53892@bord: well, there are two ways of doing it: one is using the ball height so you need to change this:
If BOT(b).Z > 20 Then
BallShadow(b).visible = 1
Else
BallShadow(b).visible = 0
End IfInto this, for example
If BOT(b).Z > 20Â AND BOT(b).Z < 50 Then
BallShadow(b).visible = 1
Else
BallShadow(b).visible = 0
End IfThis says to render the shadow only when ball height is something between 20 and 50 (remember that the ball height =Â ballsize/2)
There’s another way, more complex, by placing a trigger on ramp enter and another one on ramp exit, then use an array:
ReDim OnRamp(tnob-1)
For i = 0 to (tnob-1): OnRamp(i)=0:next
……………
If BOT(b).Z > 20 AND OnRamp(b)= 0 Then
BallShadow(b).visible = 1
Else
BallShadow(b).visible = 0
End IfYou need to login in order to like this post: click here
-
AuthorPosts
Forums are currently locked.