Hit 3 switches to open door...

I’m sure this is really basic, but I’ve tried everything I can think of.

So I have these three switches (or objects that the player touches), and once the player touches all three, I want a door to open.

I’m still shuffling through the BGE for the first time, and I have to believe that there is some very basic non-python way of having each object give a +1 to something and when that counter hits 3, the action plays out.

I just can’t figure out how to count +1, and when it hits 3, for a remote object to be effected.
I think it was something to do with the properties sensor and actuator, but that seems to be “per object” only.

So basic stuff, yeah

messages

also, you can connect the sensors, controllers and actuators from different objects. select them all and look in the logic, you will see them right there.

Create a property for your character, give it a name like “pressed”. Add a property for each switch, “switch”. then give the character a collision sensor, and type the property “switch” in the field. Then a controller and a property actuator. For the property actuator, add, prop:pressed, value:1. Then add a property sensor, and controller, message actuator. in the message actutor, to:the name of the door, subject:open. Then on the door add a message sensor, subject:open, an and controller, and an actuator. You can have the actuator end the object or play an ipo of it opening. On the switches, collision sensor, prop:a property on your character, and conrtroller, edit object actuator. Make the edit object actuator end the switch so you cant press the same one three times.
I hope you can understand that :slight_smile:

Thanks for the help! I think I understand what should be happening…

That is hot! Never realized that was possible :yes:

Thanks, I understand everything but that part I put in bold… what is the Property Sensor settings? “Equal to 3” ?

Okay… I just figured out one more additional step I need to take. I need to assign a property value before I can add to it. Sooooooo basic.:o

Here is another solution.
Easier to understand by checking the blend directly.

Use left/right arrows.

Attachments

switches_peter.blend (144 KB)

If you don’t want to have a property on your object, you can also just switch to an empty state instead of using a “switch” property on the cube.

TheSambassador > True (but can be a bit troublesome if the switch object is animated).

The Bricky Way:
1- Create 3 INT Properties on the Door with 0 as value
2- Create 3 MSG Sensors, 3 AND Controllers and 3 Property (Assign) Actuators.
3- Put each one of those Properties on the Property Actuators and make them change their value to 1
4- Make each one of the switches send one of those messages to trigger MSG sensors on the door.
5- Make 3 Property Sensors on the door, each one with one of the Properties asking if they are equal to 1.
6- Connect those sensors to an Expression Controller. The Expression SHould be something like this :
Flag1 = 1 AND Flag2 = 1 AND Flag3 = 1.
7- Connect that Expression controller to the Ipo Actuator or whatever you have to make the door move And Thats it.

I hope it helps

Guys, thank you very much… I totally got it working now.
Cray, that blend was a giant help :slight_smile: