Variable in blueprint actor won't reset

Hey guys!

I am making a racing game. I made a simple track and created a StartLine as well as some checkpoints, so that I know the player did make a lap through the track and didn’t just do shortcuts.

The plan is that the Checkpoint have some Boolean “HasBeenActivated” variable, so that only the first time in a lap the player goes through it counts it. Then the plan is for once you hit the star line again with all the checkpoints passed then we count one lap, save the time, reset the checkpoint passed counter and reset the “HasBeenActivated” variable for the checkpoints so that we can check again if the player passed through all checkpoints.

The problem is that I am not able to reset out the “HasBeenActivated” variable. So when the player goes on the next lap, it doesn’t count up when you cross checkpoints. I created a variable in the StartLine blueprint of the class “BP_InvisCheckpoint_C”, and I even set the HasBeenActivated variable as visible in the BP_InvisCheckpoint blueprint. I don’t know what’s going on.

Here is the startline crossing blueprint script.

This is the checkpoint blueprint script.

Thanks for the help

Looking at the top BP, I dont see any loop that goes over every checkpoints and resets their state. The variable Invis_checkpoint_c, it should be an array of checkpoints and you need to go through each of them, resetting their ‘Si Activated’ property, don’t you think?

So What I would do is make Invis_Checkpoint variable to an array of type Invis_Checkpoint_C and make it public. Once i place the startline in the map, I would go over each checkpoint instance in the map and add them to this array.

I have never dealt with arrays in blueprints. Can you point me to some documentation please?

This should get you started:

Also take a look at one of the videos posted in youtube about Blueprint basics. You can find it in the unrealengine channel

I’m trying this, but when I convert the variable to array, I can’t access the ‘HasBeenActivated’ variable from within. There is the GET function but I am not sure how to use that. If you can make a picture for me, I’d appreciate it.

What you need is a for each loop to iterate through each item in the array and do something with it. watch this:

This was my solution

Thanks! I managed to solve it!