Making a door open with a switch

Hey guys

I have an issue with a blueprint I’m trying to set up. I’ll explain it now as best possible. What I have is a door that requires a key input to open and close, with a trigger box on it. In the same blueprint I have a switch, also with a trigger on it. The intent is that the door is locked until the player has used the switch, at which point they will be able to go to the door to open it.

My problem is that when I press F to use the switch, it turns on (one mesh hides and the ‘on’ variant unhides), which is fine, but standing in that same spot the switch trigger is still active, even though I have set a node to destroy it. This means that I can continue to press F on that spot to open and close the door, which isn’t what I want. I assume this is a problem because I’m using ‘F’ as the input for both actions, but what I want is:

  • To only be able to press F to use the switch once
  • The switch trigger then gets destroyed, switch is now unusable
  • The player must then head over to the Door trigger, and press F on this to open the door

If I leave the switch trigger and head over to the door one, I can use the door trigger as intended, and if i go back to the switch it no longer operates. Basically, it seems as if the switch won’t destroy properly until I leave the trigger area.

Any ideas what I’ve missed? Am I actually doing the right thing here anyway? (should switches for doors be contained in the same blueprint, can they be created separately and links created between blueprints somehow?)

Thanks for any advice, have attached my blueprint setups below. This one shows the inputs for the switch(s):

This one is the door trigger inputs:

And finally this bit is telling the door to open or close on the button press:

Why are you not disabling input on the switch once activated?
That would seem to be the fix since destroying the component does not stop it from functioning.

You could also add a branch if you needed it after the overlap to check if the switch has already been activated so it doesn’t enable input again.

Thanks, how can I disable that particular trigger though? I tried adding in these nodes, but as you can see it won’t let me connect ‘TriggerSwitch’ to the Target field. I’m not sure how it would know that the Target being ‘Self’ refers to either of my two trigger boxes

Another option may be to use a bool variable associated with your switch blueprint that is defaulted to true called say “canPressSwitch”. When you detect the press switch event, set it to false, and have a condition in your switching flow that checks for the “canPressSwitch == true” and only allow the press to proceed if that condition is valid?

You would use a “branch” node.

Set your bool to the red IN condition and then use the True OUT flow to SET the bool to false, then you can continue with your flow for processing switch event.

Next time the bool is now false, so the branch will not trigger the rest of the flow, you could even play an audible cue from the False OUT flow to show nothing happened

Thanks, what is the node I would need to check if conditions are valid or not?

Ah yeah, I have used the branch ones in this blueprint already, am too used to using cryengine and was looking for something along the lines of a gametoken check :slight_smile: Anyway, I sort of followed your advice, but I put two new bools in to detect whether or not the player was inside the door trigger. The input that opens and closes the door was then linked to this via a branch check, so now everything functions as it’s supposed to. The switch trigger is used once only, the door becomes unlocked, and you can only open and close the door when standing in the door trigger. Thanks very much :slight_smile: