Download

Blueprint Don't execute after triggering the Enter of an Opened Gate Node

Hi, i am using this Blueprint in a button that moves a platform, when i use just one button in the level it work well, when i duplicate it only the last created button works. The one thats not working prints the "Open " and “Enter”, but not the “Done” after Exit of the Gate node.

I am using Unreal 4.27. the same code at UE5 works fine.

How do you set the char ref? Or have you assigned it manually and only then duplicated the BP?

  • how do you call ActionButton?
  • is the char ref valid at the time of call?
  • what is the value of the door button lock when calling ActionButton?
1 Like

I called a cast to char in begin play of this blueprint.

The action button is a custom event that I call in the char blueprint when E key is pressed.

The char ref is valid and the lock boolean is true, everything before the exit of the gate works fine no matter how many instances of the blueprint I put of the level, just the exit pin doesn’t work.

How does the character know which button they’re pressing.

Sounds a bit as if you Get All Actors of Class → Get 0

1 Like

Each instance of the button has a button number int variable, I put the blueprint I the level then I change the variable in details tab, then I have the platforms with the same method of ID, in unreal 5 I press the button 1 the platform 1 moves, I press button 2 platform 2 moves, in unreal 4.27 only button 2 works, if I put both platform the code 2 then button 2 moves both platforms. I am going to work right now, so if it take to long for me to answer again it’s because of that :slight_smile:

You’ll need to demonstrate an example of that ID system in action - if you want holes poked in it, that is.

I still do not understand how is the player connected to any of this. You press keys 1, 2, 3… in the Pawn / Controller - then what?

1 Like

Have you tried substituting the gate node for a branch? I mean create a bool that’s true on overlap and false on exit, then have your action button with a branch waiting to be executed to “enter” if the bool is true.

It will work the same, just that I’ve had similar problems when using gate node on multiple instances. This way you’ll make sure each instance works independent of each other, so if one works, all should work just as good.

1 Like

is the button that gets the character input, the character just overlaps it, the overlap opens the gate, then if the character press “E” the ActionButton Event is called in all the buttons but just the overlaped one should execute the gate output, the ID system i told is not in there i made a mistake because i was not looking at the blueprint when answered that, the ID is only in the platform part that comes after the gate.

here is how i call ActionButton Event and how i link the player and the button blueprints

This makes little sense. Every button attempts to store its own reference in the player. Every time it happens, the previous value gets overwritten.

The button variable in the player can only hold a reference to a single button…


How do you want the player to decide which button to press? Do we get close? Do we look at the button? Is it hardcoded?

You have many buttons but pressing E calls only one. So which one do we want? How do you decide?

1 Like

Thanks @Everynone , i was really trying to reference every button in the same variable, its solved now deleting the custom event and putting the keyboard input directly in the button, now when the player overlaps the button it enables the button input, and when it ends overlaping the button is disabled.

Also thanks @pezzott1

Here is the working code:

Think that what @Everynone was trying to say is that the input should be handled by the player and the item should be the one just waiting to be interacted with. Rather than overlap events to then wait for input, just have the player press E and trigger whats in front/close to do the trick. This will be usefull for everything that can be interacted with pressing E, not just the buttons.

Anyways, @Everynone please correct me if I’m assuming too much.

1 Like

Little to add. Use an Interface rather than hard coded references. Cleaner, safer, more flexible.

You don’t really need IDs - the player selects an actor and interacts with that actor. Unless you’re making puzzles - then you absolutely do need some form of ID. Which I’d still send through the interface.

But there’s more than one solution. Choose the one that works for you :slight_smile:

2 Likes

yeah, i could do it but for that o should make a variable to ID each instace of the button right?
is there any big performance diference the way you are sugesting and the way i did it? i dont know enough of unreal or programing in general to measure the code performance, i usually take the first aproach that comes to my mind and works haha.

Cool, i will try that in the other stuff i reference in the code, i did all of it hard coded.

Rather than performance, it’s quality of life. If you then decide to add a light that toggles when pressing E, by your logic you would need to add the E event to the light.

If the player just had the input event for E, all you have to do is on each press check if what’s in front (by a collision box, trace, proximity, etc) has the desired Interface, if it does then execute it regardless of what it is: if it’s a light, turn it on, if it’s a button, trigger it, etc… So you only have to do the press E logic once, and the rest is just wait to be triggered.

2 Likes

Fair enough, i am actually tired of editing lots of blueprints for every small change in the prototype, will try to be more polished with the code, this two quotes made my mind about it.

1 Like

Judging from what you’ve shared, no…

If you have any doubts on how to implement interfaces, feel free let us know by replying here.

Have fun.

1 Like