A problem making my score rise when moving

So I have a working score system but to combat cheating in my game I want to make it so that the player only scores points when they’re moving. I thought I could do this the same way I let the score system know my player is dead, with a custom event that sets “Is Moving” to true when player input keys are pressed. However unreal had other ideas, maybe I’m just doing something wrong. Not too sure.

I’ll post some pics, see of anyone could help me.

Thanks in advance to anyone who can help!

Hey Adam,

Do you set IsMoving to false anywhere? A lack of input won’t do it automatically.

You might have to poll the player’s velocity to find out when he stops.

It could be easier to set the value of IsMoving directly in this case

Hi, thanks for the reply. Event tick is in use on my Score blueprint, should I run the event tick through the Set Is Moving, back to the branch? If not what Event do you suggest I use? Also how do I give my Set Is Moving a target? I didn’t know that was possible.

Thanks for the help.

Sorry for the delayed response.

I was imagining that you would add the nodes above to your player blueprint graph and set IsMoving on its PlayerScore reference. Do you think that will work?

No worries, and Player_Score Is it’s own separate blueprint so I’m not sure how that would work.

The image above (score2.png) looks like the graph belonging to your player blueprint, is that right?

It already contains a PlayerScore variable that it was using to execute the IsMovingEvent. You could instead use it to set the value of IsMoving directly during the Tick event (you might have to add the Event Tick node to the graph).

Ok, I understand now, how do I add a target to the Set and I have an event tick on that blueprint already for something unrelated, what should I do?

Drag a pin from the PlayerScore node, drop it on an empty part of the graph, search for “Set IsMoving” and select it. That should should give you the set node already hooked up to the PlayerScore variable.

If you already have some functionality connected to the tick event, insert a sequence node to keep things separated.

Can you verify that the Vector Length of the player’s velocity ever goes above zero while moving? Also double check that the PlayerScore variable reference is being set to the actor instance that exists in the level.

Not sure if that’s what you meant but the velocity changes while the character moves from -600 - 600 on the X and the same for the Y

How would I check that? That variable was made by making a variable then searching in the variable type for Player_Score which is the only thing named that in the project and when I hover over “Player Score” It comes up with “Player_Score” So I’m pretty sure it’s referencing the right thing.

Ok but do you assign a value to the PlayerScore variable anywhere?

If not or you’re not sure add this to your player blueprint’s event graph

Well that made everything work, thanks so much man!