How to fix "Integer + Integer” is calculated twice in Blueprints.

I am creating a racing game project following along this tutorial → “BP Time Attack Racer: Lap Display & Respawn Handling | 07 | v4.8 Tutorial Series | Unreal Engine - YouTube]” on the Unreal Engine YouTube channel on how to make a BP Time Attack Racer. The issue is with this blueprint custom event:

In my game on UE 5.0.3 It will add the value twice. Meaning it goes from “lap 1 to lap 3 to lap 4” instead of “lap 1 to lap 2 to lap 3 to lap 4” as it should according to the video. I have attempted the solution of reordering the nodes as suggested in this post → "Integer + Integer" is evaluated twice, first time?. But now it turns it from “lap 1 to lap 2 to lap 4”

This is the only Issue I am having and this is for an important project. Does anyone know what causes this and what is the solution. Any help will be greatly apprecaited :slight_smile:

Hmm, it could be a variety of factors that cause the issue for you:

  • It could be the Race Complete that doesn’t work properly which makes it skip 1 lap.
  • Make sure that the lap counting logic is only being executed once per lap. It is possible that the lap counting logic is being called twice by accident, causing the lap count to increment by 2 instead of 1.
  • Check if the collision detection for the lap counting is working properly. It could be that the lap counting is being triggered twice when the player crosses the finish line because of a problem with the collision detection.
  • Make sure that the lap counting logic is properly resetting when the player starts a new lap. It could be that the lap count is not being reset when the player starts a new lap, causing it to increment by 2 instead of 1.
  • Make sure that the lap counting logic is not being affected by any other variables or logic in your game.
  • Try to reproduce the issue in a new, empty project to see if the problem is specific to your current project or if it is a general issue.

The logic should basically be: If False Actual Lap = Actual Lap + 1.

This was the problem. I noticed the debug sting I put in place was triggering twice as well every time I went trough the trigger box. Turns out it was because I had “Generate Overlap Events” set to true on my Vehicle static mesh. Came to that conclusion via this forum post →
OnComponentBeginOverlap firing twice
.

Thanks @EliasWick :slight_smile:

Awesome and great job finding a solution! I have done the same thing many times before :stuck_out_tongue: