How could I make a lap counter?

Werewolf

Probably not a real Werewolf
aa
Apr 12, 2011
873
309
I'm looking to create a kart track for a map. I already have the track itself built, along with the other logic for starting / ending the race. However right now it only lasts one lap and I'd like to make it longer.

Does anyone know of a way I can make it count the number of laps a player has completed, accounting for each individual player (the track supports a maximum of 6 players right now). I'd like a minimum of 3 laps, though more would not hurt.

I want to avoid a situation where a player can simply drive cover the finish line, then reverse back though it for it, or situations where Player1 is on the last lap but Player2 who is a lap behind wins because they crossed the finish line ahead of Player1 (I hope that last one makes sense!)

A bonus (but not essential) feature would be for players to be able to set the number of laps before starting the race, so that if they wished they could have just 1 lap or increase it to 5.
 

MoonFox

L10: Glamorous Member
Mar 17, 2015
739
74
quick thing I can think of: is make it like payload race and use numerable capture points as "laps"
 

Coding Ethan

L2: Junior Member
Oct 12, 2014
93
109
Use multiple "checkpoints" so you have to go through 1, 2 and 3 to count as a lap.
 

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,257
999
I think you'd need to set each player's targetname as they went through a checkpoint, using for example: AddOutput > targetname > check1. You'd use filter_activator_class to ensure that a player's targetname would only be set if they already had the correct targetname from the previous checkpoint. Then for the lap count, you would set the finish line to require the targetname from the last checkpoint of the third lap.

Example:
  • Starting point (finish line)
  • Checkpoint 1 gives players targetname of check1
  • Checkpoint 2 gives players targetname of check2 if they have the targetname check1
  • Finish line gives players targetname of check3 if they have the targetname check2
Repeat for each lap...
  • Checkpoint 1 check4...
  • Checkpoint 2 check5...
  • Finish line check6...
On the third lap...
  • Checkpoint 1 check7...
  • Checkpoint 2 check8...
  • Finish line awards victory to the player with targetname check8.