Correct me please. Creating random number

To people with experience, this blueprint might look completly wrong but I am new to unreal engine and to me this would make sense. Please feel free to correct my mistakes. I am trying to create a random number.

What this will do is on press assign a new value to the int and on release print it.

What do you want to know?

If you want to print on released key, that’s ok. You also could just trigger the print from the set Node, so it will print immediately when key is pressed

i am doing a board game so i want the player to move forward the amount that the random number is. the random number thing that i made above is in the blueprint of the counter that will move

Hey @JFMGamingYT!

So are you just seeking advice on implementation? Or maybe ideas on how to clean this up? So far what you have does work as intended. and there does not seem to be anything wrong with it.

Any additional information you can provide will be a big help in solving your problem.

when i start game and press the button binded to random number event it doesnt desplay anything to my screen. and if it possible to make it cleaner and mabye work better then that information will help.

Where is that “InputAction Random Number” event? In the PlayerController? In the level blueprint? In an actor? If it is in an actor, make sure that the “Enable Input” parameter for that actor is True.

it is an actor. so where abouts would i put the enable input parameter?

You can enable input as follows with a blueprint node:


The documentation is really useful here.

And make sure, that the input is not consumed by any other actor before your actor is reached. There’s some infos on this here in the docs.

1 Like

would i still do this if i moved all the stuff i did into the third person character blueprint or would i do something else. also i have moved it into the third person character blueprint and the random number print now but when it tries to change the location of the player (not the third person character) it says this

That error means that the “Player” variable is empty when you try to call SetActorLocation on it. Make sure that it contains something before trying to access that something.



Hi there

Perhaps you wanted to call the player reference in two possible ways:

ive done it like this


If you have a single player game, you may not need another variable for referencing the player character. If this variable is not set correctly, this node set actor location will not be executed.

The thing im trying to reference is a model i made and it is called player which isn’t the thirdd person character but the screenshot is in the third person character blueprint. The variable for player is the player blueprint which has no script (nothing in event graph) but is just an actor and the variable for the player is an object reference.

Idk if this information can help but here you go anyway.

Typically you only use input on a player controller actor. If your actor is only some non player controlled actor (maybe AI controlled??), you could do a GetAllActorsOfClass to get access that actor that you placed in the world (take care, GetAllActorsOfClass should not be called too often, especially not in tick!). So maybe do this in BeginPlay and keep that reference.
In your other actor, define a custom event, that executes your Random Number code.
Then, in your actual Player Character, call that event using the reference.

I tried a similar game idea for the past week and spent the whole week trying to figure out how to get that random number refernced into another blueprint and never did it.

I just made an example:

BP_TestActor with custom event.


Place this one into the level.

In your player Character, that does receive input:

Note: here, I’m just using a simple keyboard event.
AND: I simply call GetAllActorsOf Class on each event, not keeping a reference at beginplay. Also not doing any checks here - just for demo.

And, of course, you also can access the variable “RandomNumber” via the BP_TestActor reference in your player character. Or create and call any other custom events.

I hope this helps you to solve your problem

Hi there,

I can’t really see how I can help you.
Can you please explain the logic you’re trying to achieve?