I am completely new to UE4 and making games. I am making a quiz game where the user runs into a collision box and a multi choice question appears. I want to add a counter to count how many times they press the A key for example, to count how many questions they got correct and display it at the end.
Here are my blueprints for one hit box.
Any help you can give to a newbie would be very much appreciated!
276322-
Hi, here’s how I you can do it. Make an integer variable for counter, I called it “Counter”. Put Get and Set of that variable and connect them like on the picture below.
Basically what you get now now is every time you press the A button, your value from Counter variable will be increased by 1 and it will Set that as the new value for Counter variable in the Set node.
You could also do it like this
It’s pretty much the same, except that now instead of increasing the Counter value through “Integer + Integer” node where you can specify the value by which you want to increase the Counter, we are now increasing it by 1 and you can’t change that. It’s “Increment” node, and it will increase value by 1.
For getting the counter value to display you will need to create a widget and have a text box or something that you modify to equal the value of the “count”. I have a bunch of beginner friendly blueprint tutorials that I think will help you get a good foundation of how this can work. Check out video #10 I created a “score” box for the player but you can just as easily have this be the number of button clicks
I wrote everything in Word doc but I can’t upload it here, so it’s on the link
I tried to explain why we do some things but I didn’t go into much details because you said you know Widgets so I assume you covered it all by now.
Also I’d recommend you to watch this youtube channel it has great tutorials for beginners and I think that you’d have almost everything you need for your game once you’re done with his beginner tutorials.
Hahaha, you’re welcome, you deserve it. I started learning UE month ago and I was lost until I found your tutorials. Haha, I guess you can leave it to the community to spread it