Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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):

alt text

This one is the door trigger inputs:

alt text

Product Version: Not Selected
switch1.png (280.0 kB)
switch3.png (180.3 kB)
more ▼

asked Jul 16 '14 at 06:53 PM in Using UE4

avatar image

10 3 6 6

avatar image phaynes888 Jul 16 '14 at 06:54 PM

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

alt text

switch2.png (92.8 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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?

more ▼

answered Jul 16 '14 at 08:05 PM

avatar image

596 31 77 51

avatar image phaynes888 Jul 16 '14 at 08:12 PM

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

avatar image SolarVelocity Jul 16 '14 at 08:17 PM

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

avatar image phaynes888 Jul 16 '14 at 08:25 PM

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 :) 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 :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Jul 16 '14 at 07:37 PM

avatar image

1.2k 50 24 51

avatar image phaynes888 Jul 16 '14 at 08:12 PM

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

alt text

switch4.png (135.1 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question