How to prompt the player with how many doors they have opened?

Hi, I’m having trouble implementing a counter to prompt the player with how many doors they have opened. I basically want a counter that goes up every time a new door is opened, and I was wondering if anyone could help me with this? Any help will greatly appreciated, but here’s a few images of the blueprint scripting for the door itself…

37639-capture3.png

On the door actor, maintain a boolean variable which keeps track of whether it has been opened for the first time.

Every time the door is toggled open or closed, you want to set that initial boolean to “true”. If its the first time the door has been opened by the player, you want to increment an integer counter on that players character object.

You can send the player which opened the door to the “Door Open” event, and that will let you access any of the player characters public variables.

If the player dies or the level restarts, you will want to set all the doors to “closed” and reset their boolean flags to “unopened”.

As for prompting the player, you can either use a simple “print” node to print something to the screen or create a UMG widget which displays the number of doors opened.

Thank you for your response, but could you provide visual aid? I’m relatively new at blueprint scripting. :frowning:

Yeah, I just attempted what you told me to do, but I have literally no idea on how to do it. :confused:

No, not really. I’m quite busy making my own game. I’d have to pretty much create your whole blueprint graph for you and you would not get the right kind of value out of that (which is learning and self sufficiency). Take my instructions one step at a time, try to implement them, and figure out how it all works together. When you’re doing it, ask these questions to yourself: Where do you get stuck and confused? does the logic make sense? is anything missing? Does the technical stuff confuse you? etc. The answers to these questions should help you focus on the areas you need to focus on improving. I’m guessing that since you’re new to blueprints, you’re going to have to spend a few days figuring out how to get blueprints to work together. There are lots of video tutorials which can walk you though this, and there are lots of good content examples within the library to look at.

Start with your door actor. Can you give it a boolean variable? Can you make it public?

I just created a boolean variable, “DoorOpenFirstTime?” and set public

Alright, it should be set to “false” when the door is reset. Create a “reset” function and set that value to “false” and set the state of the door to “closed”.

Then, you’ll want to create a custom event which toggles the door open and closed. When that event is fired, you will toggle the door open state between “open” and “closed”. You’ll want to give the event an input parameter which contains the player character which opened the door. Then, you can create a simple “branch” conditional which checks whether the “DoorOpenFirstTime” is false or not. If its false, you can increment a “door counter” integer on the player character which opened the door.

You’ll also need to have some way to trigger this event on the door actor. Maybe you have a collision area trigger which also looks for an input key from characters? There’s an online tutorial series which goes through the whole door opening and closing stuff, so I’ll leave that to you to find and implement.

Hi, I can’t figure this out. I was wondering if it would be possible just to create a integer variable, and then increase the value every time a door is open?

I have an alternative…I could have a trigger on the other side of the door that could increase the counter instead, so having the player enter the other side of the door will increase the counter instead. I was wondering if you could help me out with that by any chance, because I’m pretty sure you don’t need to have any of my values now?

A player could just open and close the same door over and over again. That wasn’t what you were looking for, was it?

Here’s a bit of a tangent which you may find valuable:

Several years ago, I was working on a software project for school at my university. Every time I ran into a problem I couldn’t handle, I’d try to come up with a work around. My professor saw me doing this, and then said, “Don’t do that. Let your requirements drive your design. Don’t let your design and requirements be driven by your shortcomings. Learn and overcome rather than design around them.”

Best advice ever. I feel this may be relevant to you right now. So, be very careful about why you’re changing your design / approach. This is a perfect little project for you to use to get familiar with blueprints. Get it right, because you’re going to need to know how to do it right on hundreds of future problems.

Thank you for that advice. I’m currently studying games development at college right now, but in September I’ll be starting computer science at university. I’m worried though, because I don’t really have any knowledge about programming…is there any advice that you could give me, or any sources that you could provide me so that I have some sort of prior knowledge before I start university? We’ll most likely be using C++
p.s The tutors at college have only covered blueprint scripting. :frowning:

Once you’ve opened the door, the door stays open. I want the player to actually enter the area on the other side of the door, so couldn’t this be possible using trigger volume? I was going to have it, so whenever the player activated the switch it prompted the player with how many doors they have opened. However, I want the player to actually explore beyond the door to officially be counted as opening the door, so that’s why I thought a trigger volume is an alternative.

  1. Switch majors to computer science. Its better for your career, yet 100% relevant to game dev. It’s the best advice I can give you.
  2. Get really good at mathematics, especially linear algebra. Learn to love it, learn how to apply it.
  3. Don’t wait for your classes to teach you how to code. Download VS2013 CE and invent super simple C++ programming projects to do while going through a good C++ primer.
  4. Don’t ever give up, no matter what. Push harder if you fail.
  5. Check out your local game dev meetups. Check out gamedev.net

Blueprint scripting IS programming. Getting good at programming automatically makes you get better at blueprint scripting because it lowers your learning curve. Getting good at blueprints will help your programming a bit as well. It’s really all about how you organize information and perform calculations on it.

The course that I applied for is Computer Science (Games Technology) :slight_smile: Could you provide me with a link to visual studio, because I don’t know which version to download. :confused:

I’m currently downloading visual studio professional 2013. I got it for free, because I’m a student. :slight_smile: