Specific-Instance Targeting

I need some help. I have a simple game where you open doors with switches. The switches turning on and off and doors opening works fine, but whenever I hit a switch all other switches activate (they are the same instance). How can I only activate one switch instead of them all?

1 Like

You can give a object variable for each instance in properties, like a ID, switchDoorRoom, Saloon, Kitchen…
And in your eventsheet check the object variable with a condition.
If Door with the object variable ID = Kitchen
Do something

1 Like

Makes sense. Thank you.

Using IDs worked fine with the switches (at least animation wise). I have switch 1 which triggers door 1, but switch 2 can also trigger door 1, even though I’m using an ID and the animation is working fine. What could I do?

Can you post a screenshot of the events?


Switch 1 is turned off after I trigger switch 2. Switch 2 can also open the door.


1 Like

I may be wrong, but think instance variables on the switch objects would work better in this case.

So the events might look like:

Variable id of switch = 1
Your actions

Variable id of switch = 2
Your actions

It is an instance variable, but there is no “instance variable” conditions.

Your events are all scene variables, not object instance variables.

When you click on an object, the “instance variables” may be added through the properties panel. Then in the events, you would use events under “common actions for all objects” > variables…

1 Like

I was using instance variables, but I guess it was the wrong conditions.
I think that will solve it


Alright, the switches work, but is there any way I can turn off/on the collision for that specific instance? I know there is separate two objects but that applies to all instances.

You can try to invert the collision condition.

Then set the actions for what you want to do in that case.