Basically, for my first game, just to learn the basics of Unreal, I’m just doing a very small remake of Slender The Eight Pages. I have 5 pages scattered and I’ve been able to get a counter that goes up one everytime I collect a page. I just can’t get the game to end once I’ve collected all 5 pages or better yet for the game to quit. I’ve been searching all over and can’t find a solution. Please help
Hey there @MR_DELORIAN! Welcome to the community! First we’ll have to figure out where your logic is failing. A couple tests to do would be to verify your score is being read correctly by popping a print string/text of your Target score function there and show if the target amount is correct, then check the actual score the same way.
If your page finding logic is working correctly, you can make a quick check on your PageFound event at the end that checks how many pages have been collected variable you have there. If it’s equal to what you want, then issue the quit node.
How would I accomplish this?
hi,
in your event PageFound after setting the the Score make a Branch and check if Score >= 5, if true QuitGame.
hope this helps you
cheers
You’ve got it! Now you need to connect that score variable to the top of the >= node, then connect either a reference to your max score variable or just put in 5 manually (I recommend the reference for best practices). Then after the branches true statement connect the Quit node mentioned before and you’ve got it!
@MR_DELORIAN yes sorry i fell asleep
you will see this operator nodes a lot
there are many more like equal, not equal greater,…
is best to use >= or <= than because if you use == it only finishes if its 5 and if there is a case when it updates twice you will never end, so for safety >= than
hope this helps you
happy coding
It worked!! Thank you so much for your help!! Sorry it’s taken a bit to answer. The game now ends after the score reaches 5, which is exactly what I wanted. Thank you again!!
hi,
no problem, glad it helped you