Jump to content



Photo
* * * * * 1 votes

How to create force fields walls and teleports for balls? help is needed, please.

How to create force fields teleports for balls

  • Please log in to reply
3 replies to this topic

#1 EpeCreaciones

EpeCreaciones

    Hobbyist

  • Members
  • PipPip
  • 39 posts

  • Flag: Spain

  • Favorite Pinball: Tales of Arabian Nights

Posted 25 April 2024 - 01:09 AM

(Eng / Esp)
 
 
Hello everyone.
 
I need a help. I'm doing experiments with a table I'm working on. One of many projects that occur to me at the same time.
 
My question is how can I store the speed variable of a ball and transmit it to another ball.
 
Explanation:
 
1) I want to put a kind of force field (a wall) between a captive ball and the ball in play. So that when the ball hits the wall, the captive ball receives the speed (and direction) information of the ball in play and reacts as if it had hit it directly.
 
 
2) Another thing I want to do is place a kind of "portal", so that, when throwing the ball from the plunger towards a wall (where there will be a hidden kicker), the ball will teleport to another kicker (which will create again the ball) and will give you the same exit speed with which you arrived "at the wall" of the portal, like a teleport (it should be bi-directional).
 
 
I guess in both cases, I have to use the active ball variables VelX and VelY, and copy those temporary variable numeric values that I will then use to give speed to the new balls.
 
I can also use the BallVel function, (although I don't fully understand this function):
 
Function BallVel(ball) 'Calculates the ball speed
     BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
End Function
 
Question: (ball) is it a variable or is it a reference to the active ball? Where does it come from?
 
 
Although in my case I should only use the vertical part for the portal, that is, control VelY.
 
The question is how to focus it.
To capture the speed, read that speed using: Magnets, hidden star triggers, the wall itself with _Hit event...? Something that simple?
 
Speed_X = ActiveBall.VelX
Velocity_Y = ActiveBall.VelY
 
 
And the most important question.
How to transmit that information? How to give that speed variable value to the other captive ball?
 
For the ball that comes out of the portal and is created by the exit kicker it is easy, you can put the value of the variable in the launch kick. (kick Angle, Strength)
 
For the captive ball, give a proper name to the captive ball as an independent object?
 
I have tried several methods but they don't work. Some suggestions?
 
 
Greetings. And thanks in advance for the help.
 
EpeC.
 
---
 
Hola a todos.
 
Estoy haciendo experimentos con una mesa en la que estoy trabajando. Una de tantos proyectos que se me ocurren a la vez.
 
Mi consulta es como puedo almacenar la variable de velocidad de una bola y transmitírsela a otra bola.
 
Explicación:
 
1) Quiero poner una especie de campo de fuerza (un muro) entre una bola cautiva y la bola en juego. De manera que cuando la bola impacte al muro, la bola cautiva reciba la información de velocidad (y dirección) de la bola en juego y reaccione tal como si le hubiese impactado directamente.
 
 
2) Otra cosa que quiero hacer es colocar una especie de "portal", de manera que, al lanzar la bola desde el plunger hacia un muro (donde habrá un kicker oculto), la bola se teletransporte a otro kicker (que creará de nuevo la bola) y le dará la misma velocidad de salida con la que llegó "al muro" del portal, como un teletransporte (debería ser bidirecional).
 
 
Supongo que en ambos casos, tengo que usar las variables de la bola activa VelX y VelY, y copiar esos valores numéricos variables temporales que luego usaré para darles velocidad a las nuevas bolas.
 
También puedo usar la función BallVel, (aunque no entiendo del todo esta función):
 
Function BallVel(ball) 'Calculates the ball speed
    BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
End Function
 
Pregunta: (ball) ¿es una variable o es una referencia a la bola activa? ¿De dónde sale?
 
 
Aunque en mi caso solo debería usar la parte vertical para el portal, o sea controlar VelY.
 
La cuestión es como enfocarlo. 
Para capturar la velocidad, leer esa velocidad usando: Magnets, triggers estrella ocultos, el propio muro con _Hit event ...? Algo así de simple?
 
Velocidad_X = ActiveBall.VelX
Velocidad_Y = ActiveBall.VelY
 
 
Y la cuestión más importante.
cómo transmitir esa información? cómo dar ese valor de variable de velocidad a la otra bola cautiva?
 
Para la bola que sale del portal y es creada por el kicker de salida es fácil, se puede poner el valor de la variable en el kick de lanzamiento. (kick Angulo, Fuerza)
 
Para la bola cautiva, dar un nombre propio a la bola cautiva como objeto independiente?
 
He probado varios métodos pero no funcionan. ¿Algunas sugerencias?
 
 
Saludos. Y gracias de antemano por la ayuda.
 
EpeC.

Edited by EpeCreaciones, 25 April 2024 - 01:12 AM.


#2 bigus1

bigus1

    Pinball Fan

  • Members
  • PipPipPipPip
  • 776 posts
  • Location:Brisbane, Australia

  • Flag: Australia

  • Favorite Pinball: Firepower

Posted 25 April 2024 - 04:22 AM

You can tell the balls to do anything you want with any trigger :)

 

Sub Thing_Hit()
    ActiveBall.X = 182
    ActiveBall.Y = 180
    ActiveBall.Z = 125
    ActiveBall.VelX = 0
    ActiveBall.VelY = 0
End Sub



#3 unclewilly

unclewilly

    sofa king.....

  • VIP
  • 5,084 posts
  • Location:Baltimore, Maryland

  • Flag: United States of America

  • Favorite Pinball: tz, tom, big hurt, who dunnit



Posted 25 April 2024 - 01:06 PM

The captive ball class in core.vbs fils will handle all that for you.
Take a look at saytheaterof magic. Any old version and you can see the captive ball class set up and the subroutines associated with it
If it's an original, you can still load the core vbs, and I recommend you do because it has many classes you can use as well for things like balltrough or ball locks. Ever since I made pinball magic I don't really destroy and create balls(teleport), I will make them function in otherwise like subway systems under the playfield.

"it will all be ok in the end, if it's not ok, it's not the end"
 
Monster Bash VP10 WIP https://dl.dropboxus... (vpx)WIP15.vpx

uw2.gif


#4 EpeCreaciones

EpeCreaciones

    Hobbyist

  • Members
  • PipPip
  • 39 posts

  • Flag: Spain

  • Favorite Pinball: Tales of Arabian Nights

Posted 27 April 2024 - 04:19 AM

(ESP / ENG)

 

Hola a todos.
 
Quiero daros las gracias a todos por vuestra ayuda. Finalmente lo hice funcionar como deseaba.
 
Respecto a los temas propuestos, lo solucioné así:
 
1) CapBall:
 
Leí las rutinas de core.vbs, vbsdoc_outdated.html, y vi el código y los objetos en la mesa Theatre of Magic, y entendí el funcionamiento básico así:
 
Un kicker crea la bola cautiva y a la vez la impulsa. El Trigger exterior detecta la bola activa e inicia la rutina de rebote y lanzamiento, leyendo su velocidad de impacto. El muro intermedio mantiene la bola cautiva en su sitio y hace rebotar a la bola activa en juego. Y un trigger interno de la zona acotada desactiva y reactiva el kicker de rebote y lanzamiento (_Hit y _Unhit), cuando la bola cautiva sale o regresa al punto de partida.
 
 
Pero cuando declaraba objeto de clase, me daba Error line 1: necesita un controller.
 
Pensé que tenía problemas al cargar controller.vbs al inicio del Script, pero el error se mantenía. Al final, y tras descargar las ultimas versiones de los archivos core.vbs y controller.vbs (pensé que estaban obsoletos, y no era así) opté por hacer todo yo mismo desde cero, siguiendo el mismo esquema básico. Una especie de ingeniería inversa, que finalmente sí funciona.
 
 
Epe Solución:
 
En el editor creo un único kicker (KickerCap) para crear y lanzar la bola cautiva, a modo de kicker de rebote. He creado solo uno, aunque haya muchas bolas dentro del recinto. Esta es una diferencia importante con el modelo original, que asignaba un kicker para cada bola cautiva dentro de la zona acotada.
 
Luego creo en el editor un Trigger (TrigHit) para detectar el evento de colisión en la zona de impacto. Notaréis que usé nombres similares a los de las rutinas en el core.vbs.
 
Luego en el Script creo dos variables para almacenar los datos temporales relativos a la velocidad X/Y de la bola activa que impacte la zona del Trigger disparador de eventos de rebote (a la que más arriba me refería a ella como campo de fuerza).
 
En la Sub _Hit del evento de impacto, asigno a las variables auxiliares que controlan las velocidades X e Y y las paso como parámetros al kicker que se encarga de dar movimiento a la bola cautiva en reposo.
 
No he usado el segundo Trigger, el de dentro de la zona acotada, para reactivar el Kicker de rebote, ya que permanece activo todo el tiempo. Pero final mente lo usaré para esta finalidad y así dar cierta soltura a la bola rebotadora.
 
 
En el Script queda así:
 
'Define y crea la Captive Ball
KickerCap.CreateBall
KickerCap.kick 0,1
 
'Define variables auxiliares
Dim mVelX 'almacena velocidad de bola en juego
Dim mVelY 'almacena velocidad de bola en juego
 
'Rutina de activación de impacto en el Trigger TrigHit del campo de fuerza
Sub TrigHit_Hit
' Light002.State = 2
mVelX = ActiveBall.VelX 'define el ángulo de rebote
mVelY = 0 - ActiveBall.VelY 'Para dar velocidad en vertical hacia arriba VelY debe ser negativo respecto a la fuerza de gravedad positiva, para obtener el valor negativo la velocidad vertical se resta de cero
KickerCap.kick mVelX,mVelY 'lanza la Captive Ball con ángulo y velocidad
End Sub
 
 
NOTA: expandiendo o moviendo por la mesa el Trigger detector de colisión (e incluso creando otros varios) se puede hacer que se impacte a la bola cautiva desde varios sitios de la mesa, como si se diera contra un campo de fuerza que transmita la inercia. 
 
Se me corre conectar los bumpers con la propiedad Nudge (salvando el Tilt!) para causar temblores en toda la mesa haciendo un poco más exagerado este efecto. XDD
 
Además el muro de retención se puede expandir o agregar otros invisibles a distintas escalas para que físicamente la bola activa en juego no llegue a la zona cercana de la bola cautiva. Esto me gusta para simular una especie de canalización mágica, Magia o Fuerza invisible que active el efecto de rebote para dar juego.
 
Gracias unclewilly. Me fue muy útil toda esa información que saqué de allí.
 
 
 
2) Teletransporte:
Gracias bigus1, por tu solución. No se me habría ocurrido mover la bola modificando sus corrdenadas en mesa. Me parece una solución muy elegante y eficaz. Además genera menos código en el Script y mucho menos procesamiento de datos, con lo cual es más fluida la mesa al jugar. De haber pensado en esta solución antes me habría ahorrado tener que utilizar kicker de entrada (que destruya bola), kicker de salida (que genere una nueva bola), además de todo el código que implica.
 
Finalmente sólo tuve que crear dos Triggers, uno de entrada (TriggerIn) y otro de salida (TriggerOut). Y en la subrutina _Hit de cada uno, colocar las coordenedas de la mesa donde debe aparecer la bola al atravesar dichos portales Trigger. El único detalle que hay que tener en cuenta es que al aparecer (mover) la bola al otro lado, no pise ni active el Trigger de retorno.
 
Este es mi código:
 
'Teletransporte de bolas
'En estas rutinas la Bola Activa se teletransporta a las coordenadas espaciales especificadas en la mesa
'si no se especifica velocidad con las propiedades VelX y VelY, la bola usará su misma inercia de llegada al TriggerIn_Hit
Sub TriggerIn_Hit() 'Trigger de Entrada
    ActiveBall.X = 60
    ActiveBall.Y = 1080
 
'   ActiveBall.Z = 125
'   ActiveBall.VelX = 0
'   ActiveBall.VelY = 0
End Sub
 
Sub TriggerOut_Hit() 'Trigger de Salida y/o Retorno
     ActiveBall.X = 902
 
'    ActiveBall.Y = 1080
'    ActiveBall.Z = 125
'    ActiveBall.VelX = 0
'    ActiveBall.VelY = 0
End Sub
 
 
Gracias Bigus1 por darme el código base, de ti he aprendido las coordenadas especiales de la bola activa en juego. :D
 
Gracias Unclewilly, tienes razón, es muy elegante y útil la solución de teletransportar la bola modificando sus coordenadas espaciales sobre la mesa, además apenas consume procesamiento de datos y la mesa se vuelve mucho más fluida que controlando un montón de artilugios y sus subrutinas anejas.
 
 
Gracias a todos por vuestra colaboración.
 
Recibid un cordial saludo.
 
 
EpeC.
 
----
 
Hello everyone.
 
I want to thank you all for your help. I finally got it working the way I wanted.
 
Regarding the proposed topics, I solved it like this:
 
1) CapBall:
 
I read the core.vbs routines, vbsdoc_outdated.html, and saw the code and objects on the Theater of Magic table, and understood the basic operation like this:
 
A kicker creates the captive ball and at the same time propels it. The external Trigger detects the active ball and starts the bounce and launch routine, reading its impact speed. The intermediate wall keeps the captive ball in place and bounces the active ball in play. And an internal trigger in the bounded area deactivates and reactivates the rebound and launch kicker (_Hit and _Unhit), when the captive ball leaves or returns to the starting point.
 
 
But when I declared class object, it gave me Error line 1: needs a controller.
 
I thought I was having problems loading controller.vbs at the start of the Script, but the error remained. In the end, and after downloading the latest versions of the core.vbs and controller.vbs files (I thought they were obsolete, and they were not) I chose to do everything myself from scratch, following the same basic scheme. A kind of reverse engineering, which finally works.
 
 
Epe Solution:
 
In the editor I create a single kicker (KickerCap) to create and launch the captive ball, as a rebound kicker. I have created only one, even though there are many balls inside the enclosure. This is an important difference from the original model, which assigned a kicker for each captive ball within the bounded zone.
 
Then I create a Trigger (TrigHit) in the editor to detect the collision event in the impact zone. You'll notice that I used names similar to those of the routines in core.vbs.
 
Then in the Script I create two variables to store the temporary data related to the X/Y speed of the active ball that impacts the Trigger zone that triggers rebound events (which I referred to above as a force field).
 
In the Sub _Hit of the impact event, I assign the auxiliary variables that control the X and Y velocities and pass them as parameters to the kicker, which is responsible for giving movement to the captive ball at rest.
 
I have not used the second Trigger, the one inside the bounded area, to reactivate the Rebound Kicker, since it remains active all the time. But finally I will use it for this purpose and thus give some looseness to the bouncing ball.
 
 
In the script it looks like this:
 
'Define and create the Captive Ball
KickerCap.CreateBall
KickerCap.kick 0.1
 
'Defines auxiliary variables
Dim mVelX 'stores ball speed in play
Dim mVelY 'stores ball speed in play
 
'Impact activation routine in the Force Field Trigger TrigHit
Sub TrigHit_Hit
' Light002.State = 2
mVelX = ActiveBall.VelX 'defines the bounce angle
mVelY = 0 - ActiveBall.VelY 'To give velocity vertically upwards VelY must be negative with respect to the positive force of gravity, to obtain the negative value the vertical velocity is subtracted from zero
KickerCap.kick mVelX,mVelY 'launches the Captive Ball with angle and speed
End Sub
 
 
NOTE: by expanding or moving the collision detection trigger around the table (and even creating several others) you can impact the captive ball from various places on the table, as if it were hitting a force field that transmits inertia. .
 
I run into connecting the bumpers with the Nudge property (saving the Tilt!) to cause tremors throughout the table, making this effect a little more exaggerated. XDD
 
In addition, the retaining wall can be expanded or other invisible ones added at different scales so that physically the active ball in play does not reach the nearby area of the captive ball. I like this to simulate a kind of magical channeling, Magic or Invisible Force that activates the rebound effect to give play.
 
Thanks unclewilly. All that information I got from there was very useful to me.
 
 
2) Teleportation:
Thanks bigus1, for your solution. It would not have occurred to me to move the ball by modifying its coordinates on the table. I find it a very elegant and effective solution. It also generates less code in the Script and much less data processing, making the table more fluid when playing. If I had thought about this solution before, I would have saved myself from having to use input kicker (which destroys ball), output kicker (which generates a new ball), in addition to all the code that entails.
 
Finally I only had to create two Triggers, one for input (TriggerIn) and one for output (TriggerOut). And in the _Hit subroutine of each one, place the coordinates of the table where the ball should appear when passing through said Trigger portals. The only detail to keep in mind is that when the ball appears (moves) to the other side, do not step on or activate the Return Trigger.
 
This is my code:
 
'Ball teleportation
'In these routines the Active Ball is teleported to the spatial coordinates specified on the table
'if speed is not specified with the VelX and VelY properties, the ball will use the same arrival inertia at TriggerIn_Hit
Sub TriggerIn_Hit() 'Input Trigger
     ActiveBall.X = 60
     ActiveBall.Y = 1080
 
' ActiveBall.Z = 125
' ActiveBall.VelX = 0
' ActiveBall.SpeedY = 0
End Sub
 
Sub TriggerOut_Hit() 'Output and/or Return Trigger
      ActiveBall.X = 902
 
' ActiveBall.Y = 1080
' ActiveBall.Z = 125
' ActiveBall.VelX = 0
' ActiveBall.SpeedY = 0
End Sub
 
 
Thank you Bigus1 for giving me the base code, from you I have learned the special coordinates of the active ball in play. :D
 
Thanks Unclewilly, you are right, the solution of teleporting the ball by modifying its spatial coordinates on the table is very elegant and useful, it also barely consumes data processing and the table becomes much more fluid than controlling a bunch of gadgets and their attached subroutines.
 
 
Thank you all for your collaboration.
 
Receive a cordial greeting.
 
 
EpeC.

Edited by EpeCreaciones, 27 April 2024 - 04:31 AM.