x

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"

How do I enable and Disable one key?

I am trying to enable and disable one key when you enter a trigger box. However you can switch characters with this key but I only want the key to work after you encounter the other player.

Product Version: UE 4.19
Tags:
more ▼

asked Apr 14 '18 at 09:59 AM in Blueprint Scripting

avatar image

EmilyBec
18 4 6 11

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

1 answer: sort voted first

Use a bool and a branch.

more ▼

answered Apr 14 '18 at 10:09 AM

avatar image

EvilCleric
516 3 5 12

avatar image EmilyBec Apr 14 '18 at 10:14 AM

How would I do this?

avatar image EvilCleric Apr 14 '18 at 11:00 AM

Bool variable: bKeyActive. Default value = true

At the key event, the first thing you do is a branch. If bKeyActive is true then do whatever is supposed to do, otherwise, do nothing.

When player enter trigger box, set bKeyActive = false. Which means, the key will be disabled.

When you encounter another player, set bKeyActive = true.

avatar image EmilyBec Apr 14 '18 at 11:22 AM

Would it be possible if you could show me a quick bp as I do not quite understand

avatar image Nebula Games Inc Apr 14 '18 at 11:35 AM

Here you go. This is what @EvilCleric means. Once you place a trigger volume in your level, select it and open the level BP and you will be able to create overlap events for it as I show in the first image.

alt text

alt text

alt text

level-bp.jpg (111.8 kB)
level-bp-part-2.jpg (134.8 kB)
avatar image EmilyBec Apr 14 '18 at 01:37 PM

Thank you for this! my Boolean does not have a target

avatar image EmilyBec Apr 14 '18 at 01:38 PM

alt text

avatar image Nebula Games Inc Apr 14 '18 at 02:31 PM

The Boolean needs to be a variable in the blueprint where you are going to have the TAB key execution because that is what controls the flow of execution. The reason it needs a target is because you're supposed to call it from the level blueprint when the trigger volume is overlapped. So look at my screen shots again, see what I scripted in the level blueprint vs the player character :) in your case "player character" is "penguin" so penguin needs to have the boolean as a variable in the details panel.

avatar image Nebula Games Inc Apr 14 '18 at 11:45 AM

And just in case you want to know how to switch back and forth here you are, just add this one extra node in between (N Flip Flop) :)

alt text

avatar image EmilyBec Apr 14 '18 at 01:42 PM

I have just realised, I created a new player control and I already have this, So would i need to change this to what you have just make? alt text

avatar image EmilyBec Apr 14 '18 at 01:53 PM

alt text I did this in my player control bp, it is now not working but when i enter the trigger it is still not working :(

avatar image Nebula Games Inc Apr 14 '18 at 02:38 PM

This should not be in the player controller. You can have the TAB execution in the player controller but the overlap event needs to be in reference to the trigger volume. Easiest way to do that is from the level blueprint. I am not sure what "overlap" event you called from the player controller but I doubt it is for the trigger volume.

avatar image EmilyBec Apr 14 '18 at 02:52 PM

alt text I did them both, but they still do not work, however it stopped the tab from working, but when I entered the trigger tab still does not work.

avatar image EmilyBec Apr 14 '18 at 02:58 PM

I also the possessing bp into the penguin character bp but it still did not work

avatar image Nebula Games Inc Apr 14 '18 at 03:12 PM

WOW! you got a lot going on in there! haha Ok so first of all, I am seeing that the "on overlap" event is connected to a Gate node, I don't know what the settings are for open/close there but that could be one issue. Second, I thought you were using a trigger volume to execute your overlap events...here it looks like you are just having it overlap the character mesh "Human". This would not be ideal as you now open yourself up to all kinds of extra issues getting that overlap to fire. Are the penguin and the human compatible actors for overlap based on their collision properties? When you overlap the human you would need to press "tab" WHILE still touching the human because the second you stopped touching the human your "end overlap" would fire. My suggestion is start simple and get the overlaps to work with a trigger volume and don't bother with the gate for now. You can always add more complexity later once the basic stuff is working and then if you add a gate or other node and it stops working you know exactly where the issue is. This set up is difficult to debug why the overlap isn't working because there are so many reasons besides just the blueprint nodes being hooked up properly.

avatar image EmilyBec Apr 14 '18 at 03:19 PM

Hahah I know, you play at the penguin at the beginning, you find the human and then you can switch between both players. As I do not know how to disable the tab key, if you press it when the game starts you can switch between them which I do not want to happen. So, basically everything that is connected to that human trigger is meant to triggered at the same time, so I have dialogue that is triggered, something is destroyed and I also want the "Tab" key to be triggered as well.

avatar image EmilyBec Apr 14 '18 at 03:20 PM

I do not know if I have even does the bp right, but they work haha

avatar image Nebula Games Inc Apr 14 '18 at 03:27 PM

Also I just realized you have 2 "enable switching" booleans. One is in the level blueprint (which shouldn't be) the other in the player controller (which is correct). Now, "on overlap" you want to drag out from the controller BP pin to get the boolean contained within. That is the boolean that controls the TAB execution not the one you made in the level BP, that is just extra and doesn't actually do anything.

alt text

alt text

controller-bp.jpg (192.8 kB)
level-bp.jpg (156.3 kB)
avatar image EmilyBec Apr 14 '18 at 03:49 PM

![alt text][1]

I kept the other one the same and changed this one. but the tab does not work when I enter the trigger :( [1]: /storage/temp/237466-screenshot-2018-04-14-164441.png

avatar image Nebula Games Inc Apr 14 '18 at 03:54 PM

Looks like we are going for another long thread haha Ok so, you still have it set up where you actually need to "touch" the Human character for the overlap event to occur. There is no trigger volume in your set-up. Is that what you want? Second just for troubleshooting can you bypass the gate and hook the overlap event directly into the "cast to penguin" and print a string at the end to make sure it goes all the way through. So after "enable switching" print a string. And we will go from there.

avatar image EmilyBec Apr 14 '18 at 04:08 PM

alt texthahaha I am sorry but you are the best for helping! I have a trigger on the actual human so when the penguin touches it, it does work. I don't think it is working because the print string did not appear.

avatar image Nebula Games Inc Apr 14 '18 at 04:03 PM

Also, are you actually "switching" controllers entirely? Like the penguin has one controller type and then you want to use "New Controller" when you switch? So you actually have 2 controller BPs? Because that makes it more complicated. And if that is the case this won't work because we would actually have to switch controller BPs entirely not just what is "possessed" by the controller.

avatar image EmilyBec Apr 14 '18 at 04:15 PM

No they have the same controllers, I cannot remember exactly how I did it but I think the players change through their camera. This is what is in both players bp alt text

avatar image Nebula Games Inc Apr 14 '18 at 04:22 PM

AHH! I remember this issue when I was making screen shots for you....for some reason the "overlapped actor" pin doesn't work. Move it to the "other actor" and it executes fine for me.

avatar image EmilyBec Apr 14 '18 at 04:29 PM

It works!!! thank you sooooo much again! :D

avatar image Nebula Games Inc Apr 14 '18 at 04:36 PM

You're welcome! We can try for an even longer post next time haha

avatar image EmilyBec Apr 14 '18 at 04:45 PM

hahah I will just ask you next time I have a problem!

avatar image Nebula Games Inc Apr 14 '18 at 04:48 PM

Haha sure, you can message me on my channel or here although I am not sure how to send messages to people with the Unreal Account but I know there is a way!

avatar image EmilyBec Apr 14 '18 at 07:33 PM

I will find out when the time comes haha

(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