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.
Use a bool and a branch.
How would I do this?
Would it be possible if you could show me a quick bp as I do not quite understand
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.
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.
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)
Thank you for this! my Boolean does not have a target
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?
I did this in my player control bp, it is now not working but when i enter the trigger it is still not working
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.
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.
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.
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.
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.
I also the possessing bp into the penguin character bp but it still did not work
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.
I do not know if I have even does the bp right, but they work haha
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.