Download

Could A beginner get some help with his blueprint?

Hey everyone. So I’m trying to make a very basic game to help learn the engine and all that jazz.

The basic idea is that you run around in a level and shoot the static targets, and when all the targets are shot, you win the game.

http://i.imgur.com/cT5x1ts.png heres what it looks like. very basic low-poly stuff. but you get the picture right. you shoot all the targets and then you win.

now here (http://i.imgur.com/2BMIgmQ.png) is what my blueprint looks like. I really don’t know what I’m doing and I’m just brute-forcing my way through this.

here’s my logic. when the target is destroyed it gives 1 point. these are all added up and when the total is >= to the number of targets (which is the “total” variable at the top) the game ends which I have represented with a screen shake since I cant figure out how to make the game actually end.

except, when I shoot both the targets, they disappear correctly, but there is no screen shake so I have no way of knowing if my clump of math nodes are working correctly and if the screen shake is happening at all.

So I’m coming to you all. Is there a simpler way of doing this, why isn’t my method working, and could you explain it all like you would to a layman?

Thanks guys.

I’m new to all this too, but I can see right off the bat that your Play World Camera Shake is not connected to any kind of event. (The white arrows on the top are empty.) You do have an event in the blueprint – the Event Tick.

Here’s what I would do if I wanted to call the Camera Shake function once all the points were acquired: from the Event Tick, create a Branch node, which checks whether a variable is true or false. In this case, the variable should represent the player’s success in shooting all the targets. The Branch node will have two outputs, a True output and a False one, and from the True one, connect to the Play World Camera Shake.

For the record, though, here’s how I check to see if my code is firing or not: at the point of trouble I’ll add a Print String node, and tell it to say something like, I don’t know, “This is not firing” or “failure” or what-have-you. Then when I test the game, if that sentence is printed, I know something’s gone wrong.

This might help.
Check out the “print string” NODS.
It can help show you in gameplay if the points are being added/changed by printing numbers on the left side of the screen during gameplay.

ALSO.
Notice how on your camera shake nod how their is no path connected to the left white arrow key.
Right now from what I can see is that basically you are not telling the camera to shake at all under any conditions.
The red path is basically just information on how you want it TO shake I believe, not WHEN you want it to shake.

additional comment: your EventTick connected to the SET 2 points is basically saying set my points to 2 every second. So I think that will definitely collide later when you try to make it so that the camera shakes when you get 2 points because your basically saying the player will ALWAYS have 2 points. (do not quote me on that though I’m just theorizing)

My advice is this. make 2 BOOL Variables called “Is Target One Destroyed” and " Is Target 2 Destroyed". Now drag those bool variables into the blueprint and it gives you an option to either SET or GET it. Choose SET. Connect your “Destroy Actor” node to one of them.
So that it goes
(Destroy actor -> “SET” Is Target X Destroyed “TRUE” -> “SET Point” to one) after that make 3 Branch variables. Connect one after each of the SET point nodes. Drag your “Is Target destroyed” Variables into the blueprint again but this time set it to GET and connect it to the branch, drag the “TRUE” node to the final branch and make that final branch connect to the play camera shake.

I might test this myself to make sure it works, but for now try using some BOOL variables, they are extremely helpful.

Hope I helped a little.

Hello nurgle,

it might be very helpful for you, to understand how Blueprints work. This Link might help you understand.

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/FlowControl/index.html

Agreed, there is some significant flaws in your blueprint setup. The blueprint node will only run if it is connected through the white line.

So what is currently happening with your blueprint is:

Every Frame set Total = 2.

Target 1 hit -> Points = 1
Target 2 hit -> Points = 1

What you want to do here is get the current points and add 1 to it, not set it to 1 because this ignores your current score.

The simplest possible way to achieve what you want is to fix the above part and then change your event tick to go into a branch with a condition of Points >= 2 and on true play the camera shake.

I will throw together a quick example of a better more modular way to do this and upload shortly.

Here is my very quick example that I made.

The way I did it allows for you to add as many targets into the level as you want and it will calculate the win based on you shooting all of them, this will save you a lot of time further down the road. I am working with the first person blueprint template as it’s the fastest starting point.

What you will want to do is create a “Target” Blueprint. So just create an actor blueprint and put your target static mesh inside it. Then you can put the below code on it. You will notice that I am casting to the projectile for hit detection, this prevents a player from walking over and touching the target etc. If it has been hit by a projectile, which would be your arrow then it will destroy the target and cast over to the game mode blueprint which has the variables for target hits and total targets and it will get the current TargetsHit score and increase it by 1. This was a critical error in your setup.

c64794be4eac0ae82aac7c328332cb53cb91b5b8.png

The gameMode blueprint has the total number of targets in the level and then checks how many targets have been hit. If the TotalHit is >= the TotalTargets then it just prints win at the moment but that is where you would put your camera shake/gameover.

You will notice the “Event Begin Play” node checks for all of the “Targets” that are in the level and then sets the TotalTargets as that number. This makes it so that you can just duplicate the targets as many times as you want in the game and it will continue to work properly.

279836e13ae596ecb3bbf974baeb0ad86a88ce00.png

To take this a little bit further you could add a UMG that shows the number of targets and the TotalHit on screen rather than using a print screen.