Download

Hunger System Pick Up food with a button

Ho, So I followed this https://www.youtube.com/watch?v=6ar7B__eOh0 tutorial by Virtus education. Everything working fine, but I need to be able to pick up food on button pressed, not just on overlapping. Could you please help me? I tried to do branches and stuff< but it didn"t help. Please help me, I am desperate.

Also, why can’t I make a condition “on button pressed” in branch&?

OK, so I stored if the key was pressed as variable. In theory it should work but it doesn’t! Seems like c++ or blueprins whaterver just hates normal logic and likes to keep things compilcated. Please help me

I beg you help

I beg you help

Please… help

You have few issues:

  1. Your input logic is in the wrong place. Assuming the Blueprint you have posted is for the food actor, the key press event for the F key should rather go into your ThirdPersonCharacter. Your food actor may not be receiving any input unless it is specifically set to do so.
  2. When the F key is pressed, it is ok to set the F Pressed boolean variable to true to indicate the food should be picked up, but if the food is actually picked up, the variable should be reset to False so you can pickup the next food item. Right now it stays to True no matter what. You should also return it to False on the End Overlap, just in case.

With these changes it should work as expected.

Thank you very much! I will try it out and post an update

Hey,

I’ve played with and tried some pickups’ system these last days and like vr_marco, I think your execution logic is wrong too. I’ve made a system work with a button pressed like in my picture linked here.

As you can see, I’ve used :

  • an Enable Input node after the BeginOverlap node but then stop the execution of this event (well, actually, i’ve used a check overlap system after, but to simplify, i’ve cutted it out)
  • a Disable Input node after the EndOverlap node (and I used a check overlap system and rebuild pick up system after a little time no one stand on that pickup)
    So, i’m sure the button could be used for that pickup.
  • And then, the execution to pick up this pickup (like itself mentioned) is starting from the F input button node from the Pressed exec out pin.

I hope it helps!