Jump to content



Photo

Subways, kickers...


  • Please log in to reply
19 replies to this topic

#1 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

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

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 01 May 2014 - 04:24 PM

More questions. We could have a user manual at the rate I'm going on this board :)

 

I'm having trouble with a simple table with one solenoid for the outhole with no switches. I have tried a few ways but none seem to work correctly. Instead of taking up to 2 minutes each time to test the code I thought it's probably easier just to ask and save time.

	BxSwNode drain = subManager.AddEntrance("Drain");		// Entrance kicker without switch		
	drain = subManager.AddExit("PlungerKicker",1);	// Output kicker driven by solenoid 1
				
        // build the subway system
        subManager.Build();

I did have the two linked but there is no switch to link the two.

 

In one version it was starting the game and kicking the ball out correct but after the first ball hits the drain it would be game over.

 

https://www.dropbox....3avchduc/RD.jpg

 

This table in question, Roller Disco(gottlieb). I added a quick driver to the script for GTS1 and all other switches/ solenoids are ok.

 

 


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


#2 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

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

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 01 May 2014 - 08:27 PM

Another thing was wondering about a kicker is, can the depth where the ball sits be adjusted?

 

Could be just me but they look like they're sitting pretty low.


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


#3 BilboX

BilboX

    Enthusiast

  • Unit3D Pinball Team
  • 433 posts
  • Location:French Polynesia

  • Flag: France

  • Favorite Pinball: Metallica, Addams Familly, Scared Stiff, White Water

Posted 02 May 2014 - 02:54 PM

Hi chepas.

 

If this is the only code you have regarding subway, there will be a problem.

I cannot find the Roller Disco's manual due to patent so I don't understand how it works.

 

Either, it is a "regular" through, so you need to LINK two kickers:

// Main through
BxSwNode drain = subManager.AddEntrance("Drain");	// Main drain node used as subway entrance (not switch triggered)
BxSwNode pkick = subManager.AddExit("PlungerKicker",4);	// Exit plunger kicker Node
//pkick.m_switchSlot = 52;				// optionnal kicker switch

BxSwEdge mainThrough = subManager.LinkNodes(drain,pkick,1.5f);	// main Through edge link (1.5 seconds for a ball to cross it) 

OR, it is a simple "in/out" and you have only ONE kicker, used as entrance and out:

BxSwNode drain = subManager.AddEntrance("Drain");        // Entrance kicker without switch        
    drain = subManager.AddExit("Drain",1);    // Output kicker driven by solenoid 1

In the latter case, you can prevent the ball to be "destroyed" by setting the flag to false:

BxSwNode drain = subManager.AddEntrance("Drain",-1,false);        // Entrance kicker without switch (-1), not deleting ball => aka saucer

Another thing was wondering about a kicker is, can the depth where the ball sits be adjusted?

 

Could be just me but they look like they're sitting pretty low.

Nop, no depth yet => TODO


UP2


#4 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

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

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 02 May 2014 - 06:09 PM

I had actually tried the first two ways of doing it with no luck, so must be a switch missing or something. Also tested with just the drain kicking into plunger lane , but after the ball in play is drained , the ball doesn't get taken, just sits there.

 

Maybe one time you could get a look at it, the table is very small at this point so far, no rush, although I have needed roller disco 3D for a while :).


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


#5 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

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

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 02 May 2014 - 08:38 PM

Run into this problem a couple of times now with saucers, like this..

	BxSwNode LeftKicker = subManager.AddEntrance("sw34", 34, false);	//
        LeftKicker = subManager.AddExit("sw34", 5);		// Solenoid 5

If a ball hits the kicker containing a ball, one will disappear.


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


#6 BilboX

BilboX

    Enthusiast

  • Unit3D Pinball Team
  • 433 posts
  • Location:French Polynesia

  • Flag: France

  • Favorite Pinball: Metallica, Addams Familly, Scared Stiff, White Water

Posted 03 May 2014 - 08:58 AM


If a ball hits the kicker containing a ball, one will disappear.

Strange. It should not because there is at max 1 ball by default in nodes...


Maybe one time you could get a look at it, the table is very small at this point so far, no rush, although I have needed roller disco 3D for a while :).

Yes but without the doc manual, gonna be hard to debug...


UP2


#7 nath2099

nath2099

    Neophyte

  • Members
  • Pip
  • 9 posts

  • Flag: Australia

  • Favorite Pinball: GNR

Posted 29 July 2014 - 09:02 AM

Hi there, I'm trying to get a saucer working but with a delayed kick out. How might one do that?

		BxSwNode KLSaucer  =  subManager.AddEntrance("KLSaucer",70, false); // switch #70, kill ball = false	
		KLSaucer =  subManager.AddExit("KLSaucer",70);		// solenoid #70

Edited by nath2099, 29 July 2014 - 09:03 AM.


#8 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

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

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 29 July 2014 - 09:52 AM

		BxSwNode KLSaucer  =  subManager.AddEntrance("KLSaucer",70, false); // switch #70, kill ball = false	
		KLSaucer =  subManager.AddExit("KLSaucer",70,5.0f);		// solenoid #70

That should work. You can see the comma and float time in the exit.


Edited by chepas, 29 July 2014 - 09:58 AM.

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


#9 nath2099

nath2099

    Neophyte

  • Members
  • Pip
  • 9 posts

  • Flag: Australia

  • Favorite Pinball: GNR

Posted 29 July 2014 - 10:11 AM

Hi Chepas, thanks for that... but it doesn't seem to work... doesn't eject. Here is my script if it's any help!

using UnityEngine;
using System.Collections;

public class Script{
    public void Init(){
        GameObject table = GameObject.Find("TABLE");
        test_TableManager behaviour = table.AddComponent<test_TableManager>();
		behaviour.PreInit();		// Call pre-initialization steps
		behaviour.Init();			// Script initialization
		behaviour.PostInit();		// Call poste-initialization steps
    }
}

public class test_TableManager : BxTableManager{
	bool m_autokick = true;
	public override void Init (){
		base.Init();					// Call BxVPMTableManager Start (Display version and default controller options
		InitArrays(255,255,10,255);		// 89 Lamps, 65 Solenoids/Flashers (10 by default for GIs) and 255 Switches...)
		SetDMDObject("DMD","BxVPMDMD");	// Link the Vpm driven Dmd Update Component to the object "DMD"
		InitSubwaySystem();				// Initialize Subway System
		Global.Physics.g_GeneralForceMultiplier = 1;
        Global.Physics.g_PlungerForceMultiplier = 15f;
        Global.Physics.g_AutoPlungerForceMultiplier = 45f;
        Global.Physics.g_FlipperForceMultiplier = 350f;
        Global.Physics.g_FlipperSpeedTargetMultiplier = 10000f;
        Global.Physics.g_VerticalKickerForceMultiplier = 300;
        Global.Physics.g_OrientedKickerForceMultiplier = 400f;
        Global.Physics.g_BumperKickForceMultiplier = 500f;
        Global.Physics.g_SlingshotForceMultiplier = 180f;
        Global.Physics.g_SlingshotThresholdForce = 20;
        Global.Physics.g_NudgeForceMultiplierX = 0.6f;
        Global.Physics.g_NudgeForceMultiplierY = 0.3F;
		Global.Physics.g_DiverterForceMultiplier = 1500;
        Global.Physics.g_DebugShotForceMultiplier = 200;
        Global.Physics.g_CoilMagnetForceMultiplier = 5.5f;
        Global.Physics.SetBallDiameter(26.987f);    // Set the balls diameter
        Global.Physics.g_AirBall = false;
		BxBumperKick.s_AutoKickBumperMode = false;		// Bumpers automatically kick
		GameObject ball=GameObject.Find("Shop/ball");
		ball.renderer.material.mainTexture=Resources.Load("BITMAP/amigaball") as Texture;////affect amigaball
		ball.renderer.material.color=Color.white;   //// so that amigaball can be seen
	
	}
	
	//! Initialize table driver
	public override void InitDriver(){
		m_driver = new BxDriver_wpc();
	}	
	
	public override void LateUpdate (){
		base.LateUpdate();
		if(Input.GetKeyDown(KeyCode.K)){
			SetSolenoid(4, true); // todo => switch off (will not work when not using changedSolenoidsCallback)
		}		
		if(Input.GetKeyDown(KeyCode.L)){
			//SetSolenoid(69, true);
			launchBall(true);
		}
	}
	
	//! Initialize Subway System (redefinition)
	public override void InitSubwaySystem(){
		base.InitSubwaySystem();
		GameObject subway = GameObject.Find ("TABLE/SUBWAY");
		if(subway==null){
			Debug.LogError("Unable to find SUBWAY object");
			return;
		}
		BxSwManager subManager = (BxSwManager)subway.GetComponent("BxSwManager");
		if(subManager==null) subManager = (BxSwManager)subway.GetComponent("BxSwVisualManager");
		if(subManager==null){
			Debug.LogError("Unable to find the Subway manager component in SUBWAY object");
			return;
		}
		float swL = Global.Physics.g_BallDiameter;					// length of switches in mm
		BxSwNode drain = subManager.AddEntrance("Drain",5);		// Main drain node used as subway entrance		
		BxSwNode pkick = subManager.AddExit("PlungerKicker",4);	// Exit GoT_ kicker Node
		pkick.m_swicthSlot = 52;								// Node switch number
		BxSwEdge mainThrough = subManager.LinkNodes(drain,pkick,1.5f);			// main Through edge link (1.5 seconds for a ball to cross it)
		mainThrough.AddSwitch(50, mainThrough.m_length-swL*1.5f, swL*0.9f);		// First switch on the edge
		mainThrough.AddSwitch(51, mainThrough.m_length-swL*0.5f , swL*0.9f);	// Second switch on the edge (making 3 in total with the pkick node switch)
		subManager.Build();
		for(int i=0;i<10;i++){
			BxSwVirtualBall b = new BxSwVirtualBall();
			drain.InsertBall(b);
			subManager.ReportNewBall(b);
			subManager.DoStep();
		}
		BxSwNode KLSaucer  =  subManager.AddEntrance("KLSaucerKicker",70, false); // switch #70, kill ball = false	
		KLSaucer =  subManager.AddExit("KLSaucerKicker",70,5.0f);		// solenoid #70
		BxSwNode TWSaucer  =  subManager.AddEntrance("TWSaucerKicker",71, false); // switch #70, kill ball = false	
		TWSaucer =  subManager.AddExit("TWSaucerKicker",71,5.0f);		// solenoid #70

		//BxSwNode thingSaucer		=  subManager.AddEntrance("Kicker1",87,false);				// Intput kicker with switch 87 NOT destroying the ball (Saucer)
		//thingSaucer					=  subManager.AddExit("Kicker1",26,0f);	// Output kicker driven by solenoid 26 (SHOULD be the same as above because of the same name) => No animation for kicking (releaseTime=0)
		
		
	}

	
	//! Link lamp array to Unity objects (called by InitArrays)
	public override void InitLampsObjects(){
		base.InitLampsObjects(); // call ancestor's function
		AddLamp("Light1",1);// Mode Start
		AddLamp("bulbInLaneBottomLeft",2);
		//SetLamp (2,true,20);
		AddLamp("bulbInLaneTopLeft",3);
		//SetLamp (3,true,20);
	}
	
	//! Link solenoid array to Unity objects (called by InitArrays)
	public override void InitSolenoidsObjects(){
		base.InitSolenoidsObjects(); // call ancestor's function	
		AddSolenoid("Bumper1"						, 61	, "BxBumperKick");
		AddSolenoid("Bumper1/cap"					, 61	, "BxBasicLamp");	// Left Bumper
		BxBasicLamp bl1=GameObject.Find("Bumper1/cap").GetComponentInChildren<BxBasicLamp>();
		bl1.m_onTime=0f;
		bl1.m_offTime=0.5f;
		AddSolenoid("Bumper2"						, 62	, "BxBumperKick");
		AddSolenoid("Bumper2/cap"					, 62	, "BxBasicLamp");	// Left Bumper
		BxBasicLamp bl2=GameObject.Find("Bumper2/cap").GetComponentInChildren<BxBasicLamp>();
		bl2.m_onTime=0f;
		bl2.m_offTime=0.5f;
		AddSolenoid("Bumper3"						, 63	, "BxBumperKick");
		AddSolenoid("Bumper3/cap"					, 63	, "BxBasicLamp");	// Left Bumper
		BxBasicLamp bl3=GameObject.Find("Bumper3/cap").GetComponentInChildren<BxBasicLamp>();
		bl3.m_onTime=0f;
		bl3.m_offTime=0.5f;
		AddSolenoid("LeftSlingshotRubber"			, 64	, "BxSlingshotKick");
		AddSolenoid("RightSlingshotRubber"			, 65	, "BxSlingshotKick");
		AddSolenoid("Flippers/RightFlipper"			, 66	, "BxBasicFlip");	// Right Flipper
		AddSolenoid("Flippers/LeftFlipper"			, 67	, "BxBasicFlip");	// Left Flipper
		AddSolenoid("Flippers/UpperRightFlipper"	, 68	, "BxBasicFlip");	// URight Flipper
		AddSolenoid("rightAutoPlunger"				, 69	, "BxAutoPlunger");	// 
		// #70 KLSaucerKicker set in InitSubwaySystem
		// #71 TWSaucerKicker set in InitSubwaySystem
		
	}
	

	public override void InitSwitchesObjects(){
		base.InitSwitchesObjects(); // call ancestor's function		
		AddSwitch("Bumper1"					, 61);
		AddSwitch("Bumper2"					, 62);
		AddSwitch("Bumper3"					, 63);	
		AddSwitch("LeftSlingshotRubber"		, 64	,"BxSlingshotSwitch");
		AddSwitch("RightSlingshotRubber"	, 65	,"BxSlingshotSwitch");
		AddSwitch("rightLaunchTrigger"		, 69	,"BxTriggerSwitch");
		// #70 KLSaucerKicker set in InitSubwaySystem
		// #71 TWSaucerKicker set in InitSubwaySystem
	}
	public void launchBall(bool state){
		//SetSolenoid(69, state);
		SetSolenoid(69, state); 

	}
	
	public override void SetSwitch (int slot, bool state){
		base.SetSwitch (slot, state);
		switch(slot){
			case 61:
			case 62:
			case 63:
				SetSolenoid(slot,state); 
				break;
			case 64:
			case 65:	
				if(state) {
					SetSolenoid(slot,state); 
				}
				break;
			case 69:
				SetLamp (1,state);
				if (state) {
					SetSolenoid(69, state); 
				}
				break;
			case 70:
				//SetSolenoid(70, state); 
				break;
			case 71:
				//SetSolenoid(71, state); 
				break;
		}
	}	
}


#10 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

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

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 29 July 2014 - 10:21 AM

Try moving the kickers you've added before you build the subway.

 

subManager.Build();


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


#11 nath2099

nath2099

    Neophyte

  • Members
  • Pip
  • 9 posts

  • Flag: Australia

  • Favorite Pinball: GNR

Posted 29 July 2014 - 10:30 AM

Nah still nothing:

	public override void InitSubwaySystem(){
		base.InitSubwaySystem();
		GameObject subway = GameObject.Find ("TABLE/SUBWAY");
		if(subway==null){
			Debug.LogError("Unable to find SUBWAY object");
			return;
		}
		BxSwManager subManager = (BxSwManager)subway.GetComponent("BxSwManager");
		if(subManager==null) subManager = (BxSwManager)subway.GetComponent("BxSwVisualManager");
		if(subManager==null){
			Debug.LogError("Unable to find the Subway manager component in SUBWAY object");
			return;
		}
		float swL = Global.Physics.g_BallDiameter;					// length of switches in mm
		BxSwNode drain = subManager.AddEntrance("Drain",5);		// Main drain node used as subway entrance		
		BxSwNode pkick = subManager.AddExit("PlungerKicker",4);	// Exit GoT_ kicker Node
		pkick.m_swicthSlot = 52;								// Node switch number
		BxSwEdge mainThrough = subManager.LinkNodes(drain,pkick,1.5f);			// main Through edge link (1.5 seconds for a ball to cross it)
		mainThrough.AddSwitch(50, mainThrough.m_length-swL*1.5f, swL*0.9f);		// First switch on the edge
		mainThrough.AddSwitch(51, mainThrough.m_length-swL*0.5f , swL*0.9f);	// Second switch on the edge (making 3 in total with the pkick node switch)
		
				BxSwNode KLSaucer  =  subManager.AddEntrance("KLSaucerKicker",70, false); // switch #70, kill ball = false	
		KLSaucer =  subManager.AddExit("KLSaucerKicker",70,5.0f);		// solenoid #70
		BxSwNode TWSaucer  =  subManager.AddEntrance("TWSaucerKicker",71, false); // switch #70, kill ball = false	
		TWSaucer =  subManager.AddExit("TWSaucerKicker",71,5.0f);		// solenoid #70
		
		
		subManager.Build();
		for(int i=0;i<10;i++){
			BxSwVirtualBall b = new BxSwVirtualBall();
			drain.InsertBall(b);
			subManager.ReportNewBall(b);
			subManager.DoStep();
		}


		//BxSwNode thingSaucer		=  subManager.AddEntrance("Kicker1",87,false);				// Intput kicker with switch 87 NOT destroying the ball (Saucer)
		//thingSaucer					=  subManager.AddExit("Kicker1",26,0f);	// Output kicker driven by solenoid 26 (SHOULD be the same as above because of the same name) => No animation for kicking (releaseTime=0)
		
		
	}


#12 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

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

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 29 July 2014 - 10:41 AM

Nate from P-ROC? I think I gave you that script.

 

If it's for original table you probably need switch/solenoid callback


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


#13 nath2099

nath2099

    Neophyte

  • Members
  • Pip
  • 9 posts

  • Flag: Australia

  • Favorite Pinball: GNR

Posted 29 July 2014 - 10:56 AM

 

 

Nate from P-ROC?

Yes mate, getting there slowly!

 

So given the above code, I'd just add add to the switch statement:

public override void SetSwitch (int slot, bool state){
		base.SetSwitch (slot, state);
		switch(slot){
			case 61:
			case 62:
			case 63:
				SetSolenoid(slot,state); 
				break;
			case 64:
			case 65:	
				if(state) {
					SetSolenoid(slot,state); 
				}
				break;
			case 69:
				SetLamp (1,state);
				if (state) {
					SetSolenoid(69, state); 
				}
				break;
			case 70:
                                Delay(5000); // WHAT IS THE RIGHT STATEMENT HERE, AND WILL IT KILL EVERYTHING ELSE UNTIL THE 5 SECONDS EXPIRES?
				SetSolenoid(70, state); 
				break;
			case 71:
				Delay(5000); // WHAT IS THE RIGHT STATEMENT HERE, AND WILL IT KILL EVERYTHING ELSE UNTIL THE 5 SECONDS EXPIRES?
                                SetSolenoid(71, state); 
				break;
		}
	}	


#14 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

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

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 29 July 2014 - 11:17 AM

Well, the float release time thing is weird. It rises up slowly then pops out. Almost like it's squeezing one out , lol.

 

Try this:

 

Remove the switch callback from the set switch function.

    public override void Init()
    {

        AddSwitchCallBack(70, switchCallbackTest);

    void switchCallbackTest(int slot, bool b)
    {
        SetSolenoid(70, true);
    }
    
        void PrepareElements()
    {

}

}

Add the line inside of the table managers init() instead, and the function before void PrepareElements


Edited by chepas, 29 July 2014 - 11:20 AM.

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


#15 nath2099

nath2099

    Neophyte

  • Members
  • Pip
  • 9 posts

  • Flag: Australia

  • Favorite Pinball: GNR

Posted 29 July 2014 - 10:27 PM

Still no go unfortunately. Am I still supposed to have the 5f in the AddExit declaration? It does seem to do something, but definitely not a 5 second hold. I also don't have a PrepareElements function.

 

Here's where I'm at atm:

using UnityEngine;
using System.Collections;

public class Script{
    public void Init(){
        GameObject table = GameObject.Find("TABLE");
        test_TableManager behaviour = table.AddComponent<test_TableManager>();
		behaviour.PreInit();		// Call pre-initialization steps
		behaviour.Init();			// Script initialization
		behaviour.PostInit();		// Call poste-initialization steps
    }
}

public class test_TableManager : BxTableManager{
	bool m_autokick = true;
	public override void Init (){
		base.Init();					// Call BxVPMTableManager Start (Display version and default controller options
		InitArrays(255,255,10,255);		// 89 Lamps, 65 Solenoids/Flashers (10 by default for GIs) and 255 Switches...)
		SetDMDObject("DMD","BxVPMDMD");	// Link the Vpm driven Dmd Update Component to the object "DMD"
		InitSubwaySystem();				// Initialize Subway System
		Global.Physics.g_GeneralForceMultiplier 			= 1;
        Global.Physics.g_PlungerForceMultiplier 			= 15f;
        Global.Physics.g_AutoPlungerForceMultiplier 		= 45f;
        Global.Physics.g_FlipperForceMultiplier 			= 350f;
        Global.Physics.g_FlipperSpeedTargetMultiplier 		= 10000f;
        Global.Physics.g_VerticalKickerForceMultiplier 		= 300;
        Global.Physics.g_OrientedKickerForceMultiplier 		= 400f;
        Global.Physics.g_BumperKickForceMultiplier 			= 500f;
        Global.Physics.g_SlingshotForceMultiplier 			= 180f;
        Global.Physics.g_SlingshotThresholdForce 			= 20;
        Global.Physics.g_NudgeForceMultiplierX 				= 0.6f;
        Global.Physics.g_NudgeForceMultiplierY 				= 0.3F;
		Global.Physics.g_DiverterForceMultiplier 			= 1500;
        Global.Physics.g_DebugShotForceMultiplier 			= 200;
        Global.Physics.g_CoilMagnetForceMultiplier 			= 5.5f;
        Global.Physics.SetBallDiameter(26.987f);    // Set the balls diameter
        Global.Physics.g_AirBall = false;
		BxBumperKick.s_AutoKickBumperMode = false;		// Bumpers automatically kick
		GameObject ball=GameObject.Find("Shop/ball");
		ball.renderer.material.mainTexture=Resources.Load("BITMAP/amigaball") as Texture;////affect amigaball
		ball.renderer.material.color=Color.white;   //// so that amigaball can be seen
		
		AddSwitchCallBack(70, KLKickout);
		AddSwitchCallBack(71, TWKickout);	
	}
	
	void KLKickout(int slot, bool b){
        SetSolenoid(70, true);
    }

	void TWKickout(int slot, bool b){
        SetSolenoid(71, true);
    }
		
		
	//! Initialize table driver
	public override void InitDriver(){
		m_driver = new BxDriver_wpc();
	}	
	
	public override void LateUpdate (){
		base.LateUpdate();
		if(Input.GetKeyDown(KeyCode.K)){
			SetSolenoid(4, true); // todo => switch off (will not work when not using changedSolenoidsCallback)
		}		
		if(Input.GetKeyDown(KeyCode.L)){
			//SetSolenoid(69, true);
			launchBall(true);
		}
	}
	
	//! Initialize Subway System (redefinition)
	public override void InitSubwaySystem(){
		base.InitSubwaySystem();
		GameObject subway = GameObject.Find ("TABLE/SUBWAY");
		if(subway==null){
			Debug.LogError("Unable to find SUBWAY object");
			return;
		}
		BxSwManager subManager = (BxSwManager)subway.GetComponent("BxSwManager");
		if(subManager==null) subManager = (BxSwManager)subway.GetComponent("BxSwVisualManager");
		if(subManager==null){
			Debug.LogError("Unable to find the Subway manager component in SUBWAY object");
			return;
		}
		float swL = Global.Physics.g_BallDiameter;					// length of switches in mm
		BxSwNode drain = subManager.AddEntrance("Drain",5);		// Main drain node used as subway entrance		
		BxSwNode pkick = subManager.AddExit("PlungerKicker",4);	// Exit GoT_ kicker Node
		pkick.m_swicthSlot = 52;								// Node switch number
		BxSwEdge mainThrough = subManager.LinkNodes(drain,pkick,1.5f);			// main Through edge link (1.5 seconds for a ball to cross it)
		mainThrough.AddSwitch(50, mainThrough.m_length-swL*1.5f, swL*0.9f);		// First switch on the edge
		mainThrough.AddSwitch(51, mainThrough.m_length-swL*0.5f , swL*0.9f);	// Second switch on the edge (making 3 in total with the pkick node switch)
		
		BxSwNode KLSaucer  =  subManager.AddEntrance("KLSaucerKicker",70, false); // switch #70, kill ball = false	
		KLSaucer =  subManager.AddExit("KLSaucerKicker",70, 5.0f);		// solenoid #70
	
		BxSwNode TWSaucer  =  subManager.AddEntrance("TWSaucerKicker",71, false); // switch #71, kill ball = false	
		TWSaucer =  subManager.AddExit("TWSaucerKicker",71, 5.0f);		// solenoid #71

		
		
		subManager.Build();
		for(int i=0;i<10;i++){
			BxSwVirtualBall b = new BxSwVirtualBall();
			drain.InsertBall(b);
			subManager.ReportNewBall(b);
			subManager.DoStep();
		}


		//BxSwNode thingSaucer		=  subManager.AddEntrance("Kicker1",87,false);				// Intput kicker with switch 87 NOT destroying the ball (Saucer)
		//thingSaucer					=  subManager.AddExit("Kicker1",26,0f);	// Output kicker driven by solenoid 26 (SHOULD be the same as above because of the same name) => No animation for kicking (releaseTime=0)
		
		
	}

	
	//! Link lamp array to Unity objects (called by InitArrays)
	public override void InitLampsObjects(){
		base.InitLampsObjects(); // call ancestor's function
		AddLamp("Light1",1);// Mode Start
		AddLamp("bulbInLaneBottomLeft",2);
		//SetLamp (2,true,20);
		AddLamp("bulbInLaneTopLeft",3);
		//SetLamp (3,true,20);
	}
	
	//! Link solenoid array to Unity objects (called by InitArrays)
	public override void InitSolenoidsObjects(){
		base.InitSolenoidsObjects(); // call ancestor's function	
		AddSolenoid("Bumper1"						, 61	, "BxBumperKick");
		AddSolenoid("Bumper1/cap"					, 61	, "BxBasicLamp");	// Left Bumper
		BxBasicLamp bl1=GameObject.Find("Bumper1/cap").GetComponentInChildren<BxBasicLamp>();
		bl1.m_onTime=0f;
		bl1.m_offTime=0.5f;
		AddSolenoid("Bumper2"						, 62	, "BxBumperKick");
		AddSolenoid("Bumper2/cap"					, 62	, "BxBasicLamp");	// Left Bumper
		BxBasicLamp bl2=GameObject.Find("Bumper2/cap").GetComponentInChildren<BxBasicLamp>();
		bl2.m_onTime=0f;
		bl2.m_offTime=0.5f;
		AddSolenoid("Bumper3"						, 63	, "BxBumperKick");
		AddSolenoid("Bumper3/cap"					, 63	, "BxBasicLamp");	// Left Bumper
		BxBasicLamp bl3=GameObject.Find("Bumper3/cap").GetComponentInChildren<BxBasicLamp>();
		bl3.m_onTime=0f;
		bl3.m_offTime=0.5f;
		AddSolenoid("LeftSlingshotRubber"			, 64	, "BxSlingshotKick");
		AddSolenoid("RightSlingshotRubber"			, 65	, "BxSlingshotKick");
		AddSolenoid("Flippers/RightFlipper"			, 66	, "BxBasicFlip");	// Right Flipper
		AddSolenoid("Flippers/LeftFlipper"			, 67	, "BxBasicFlip");	// Left Flipper
		AddSolenoid("Flippers/UpperRightFlipper"	, 68	, "BxBasicFlip");	// URight Flipper
		AddSolenoid("rightAutoPlunger"				, 69	, "BxAutoPlunger");	// 
		// #70 KLSaucerKicker set in InitSubwaySystem
		// #71 TWSaucerKicker set in InitSubwaySystem
		
	}
	

	public override void InitSwitchesObjects(){
		base.InitSwitchesObjects(); // call ancestor's function		
		AddSwitch("Bumper1"					, 61);
		AddSwitch("Bumper2"					, 62);
		AddSwitch("Bumper3"					, 63);	
		AddSwitch("LeftSlingshotRubber"		, 64	,"BxSlingshotSwitch");
		AddSwitch("RightSlingshotRubber"	, 65	,"BxSlingshotSwitch");
		AddSwitch("rightLaunchTrigger"		, 69	,"BxTriggerSwitch");
		// #70 KLSaucerKicker set in InitSubwaySystem
		// #71 TWSaucerKicker set in InitSubwaySystem
	}
	public void launchBall(bool state){
		//SetSolenoid(69, state);
		SetSolenoid(69, state); 

	}
				

	
	public override void SetSwitch (int slot, bool state){
		base.SetSwitch (slot, state);
		switch(slot){
			case 61:
			case 62:
			case 63:
				SetSolenoid(slot,state); 
				break;
			case 64:
			case 65:	
				if(state) {
					SetSolenoid(slot,state); 
				}
				break;
			case 69:
				SetLamp (1,state);
				if (state) {
					SetSolenoid(69, state); 
				}
				break;

		}
	}	
}


#16 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

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

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 30 July 2014 - 09:27 AM

public class Script
{


    public void Init()
    {
        GameObject table = GameObject.Find("TABLE");
        test_TableManager behaviour = table.AddComponent<test_TableManager>();
        behaviour.PreInit();		// Call pre-initialization steps
        behaviour.Init();			// Script initialization
        behaviour.PostInit();		// Call poste-initialization steps

    }
}

public class test_TableManager : BxTableManager
{
    public GameObject Hand = null;
    
    //! Use this for initialization
    public override void Init()
    {
        base.Init();					// Call BxVPMTableManager Start (Display version and default controller options

        InitArrays(111, 255, 10, 255);		// 89 Lamps, 65 Solenoids/Flashers (10 by default for GIs) and 255 Switches...)

        InitSubwaySystem();				// Initialize Subway System

        AddSwitchCallBack(70, switchCallbackTest);

        //AddPlungerBehaviour("AutoPlunger");	// Add plunger behaviour
        BxBumperKick.s_AutoKickBumperMode = true;

        ////////////////////// Physics tuning
        Global.Physics.g_GeneralForceMultiplier = 1;
        Global.Physics.g_PlungerForceMultiplier = 15f;
        Global.Physics.g_AutoPlungerForceMultiplier = 45f;
        Global.Physics.g_FlipperForceMultiplier = 350f;
        Global.Physics.g_FlipperSpeedTargetMultiplier = 10000f;
        Global.Physics.g_VerticalKickerForceMultiplier = 300;
        Global.Physics.g_OrientedKickerForceMultiplier = 400f;
        Global.Physics.g_BumperKickForceMultiplier = 500f;
        Global.Physics.g_SlingshotForceMultiplier = 180f;
        Global.Physics.g_SlingshotThresholdForce = 20;
        //Global.Physics.g_SpinDiskForceMultiplier = 10f;

        Global.Physics.g_NudgeForceMultiplierX = 0.6f;
        Global.Physics.g_NudgeForceMultiplierY = 0.3F;

        Global.Physics.g_DiverterForceMultiplier = 1500;
        Global.Physics.g_DebugShotForceMultiplier = 200;
        Global.Physics.g_CoilMagnetForceMultiplier = 5.5f;
        Global.Physics.SetBallDiameter(26.987f);    // Set the balls diameter
        Global.Physics.g_AirBall = false;

    }

    void switchCallbackTest(int slot, bool b)
    {
        
        SetSolenoid(70, true);
    }
	
	    void PrepareElements()
    {   
        ////////////////// Correcting Playfield lamps(could have been done with material editor but too much lamps to do by hand )
        for (int l = 0; l < 200; l++)
        {
            try
            {
                GameObject.Find("Playfield/Lamps").transform.GetChild(l).FindChild("decal").Translate(new Vector3(0f, 0f, -0.09f));
                Material mat = GameObject.Find("Playfield/Lamps").transform.GetChild(l).FindChild("decal").renderer.material;///find decal object
                mat.shader = Shader.Find("PU3D/Managed/TexBackTrans");	///// change its shader to textured backlit transparent
                mat.color = new Color(mat.color.r / 3f, mat.color.r / 3f, mat.color.r / 3f, 0.9f); //// lowering its color by 3(texture used is really bright)
                mat.SetFloat("_BackLightingStrength", 20f); ///// setting its backlighting strength(you need to test)
                mat.color = new Color(mat.color.r, mat.color.r, mat.color.r, 0.9f);
            }
            catch { }
        }

        FP_Lamp[] fpl = GameObject.Find("TRANSLITE/Bulbs").GetComponentsInChildren<FP_Lamp>();
        foreach (FP_Lamp f in fpl)
            f.lit = f.unlit;
    }

    //! Initialize table driver
    public override void InitDriver()
    {

    }

The prepare elements here sorts the lamps out. I tested it and it worked kicking ball out. Your kicker code is ok  , so you should be ok with this


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


#17 nath2099

nath2099

    Neophyte

  • Members
  • Pip
  • 9 posts

  • Flag: Australia

  • Favorite Pinball: GNR

Posted 30 July 2014 - 10:52 AM

Sorry mate I think I'm missing something... Are you saying that if I add your PrepareElements it will fix the ball kickout issue, despite the fact it only seems to deal with lamps? Also, does the 5f in my code signify 5 seconds?



#18 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

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

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 30 July 2014 - 12:14 PM

////////////////// Correcting Playfield lamps(could have been done with material editor but too much lamps to do by hand )

 

That's all that is for.

 

The callback test is added into the  init() = AddSwitchCallBack(70, switchCallbackTest);

 

Then I suppose it shouldn't matter where the function is for that, but that's where I put it when tested it working. Yes, 5.0 seconds float value.


	//! Initialize table driver
public override void InitDriver(){
m_driver = new BxDriver_wpc();
}	

See this as well, if this is an original table , you would leave this blank for now. No way I know of to use pyprocgame with it.


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


#19 ICPjuggla

ICPjuggla

    Early Retirement

  • VIP
  • 1,193 posts

  • Flag: United States of America

  • Favorite Pinball: Star Wars

Posted 30 July 2014 - 07:11 PM

Sorry not trying to hijack the thread....

chepas, I've been trying to get in touch with you, where should I send the PM?

cosmicgunfight-sig2.png breakshot-sig-small3.png atlantis-sig-small.png mousinaround-sig6.png hurricane-sig16.png sc-badge1.png lw-sig.png embryon-logo0.png icp-3.png apollo13_badge(1).png whirlwind_badge0.png playboy_badge0.png oxo1.png raven_logo.png rambo_logo4.png


#20 nath2099

nath2099

    Neophyte

  • Members
  • Pip
  • 9 posts

  • Flag: Australia

  • Favorite Pinball: GNR

Posted 30 July 2014 - 09:59 PM

Cool, cheers for your help with that. It seems that the 5f isn't actual seconds. If I change it to 100f it holds the ball for about 5 seconds. I am running on a super quick computer though.Do I need a command to slow the program down a bit or is that expected behavior?

 

Thanks again.