Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: LogLady on December 22, 2017, 10:25:51 PM

Title: Lap system
Post by: LogLady on December 22, 2017, 10:25:51 PM
Hi!

For some long time I've been cracking my head trying to figure how to make a checkpoint and lap system that prevents the player to "cheat" running the track backward and completing the track. Right now I have a gameObject that holds an arrayList (array maker) containing the checkpoints of the track. The car player hits the checkpoint gameObject and add 1 to an interger variable and checks if it equals the number of checkpoints. If equals a lap is complete. What is happening is that if the player goes to the checkpoint 9 and run backwards and hit checkpoint 10 (the last checkpoint in this example) a lap is considered complete. If the player run to lets say checkpoint 3 and then run backward 7 times the lap will be considered complete too. How do I prevent this to happen and only count the lap complete if the player runs correctly?

Thanks for your help!
Title: Re: Lap system
Post by: tcmeric on December 23, 2017, 01:19:12 AM
If this is a single player game, have the triggers (check points) disable after they are hit. Then reset them all, once your total is hit. Then they cannot be used again.
Title: Re: Lap system
Post by: LogLady on December 23, 2017, 09:36:52 AM
Sorry! I forgot to tell that it is a local multiplayer game.

Edit: Even disabling the previous checkpoint and only leaving enabled the next one, the player can enable the last checkpoint and race the track backward to the finish line and a lap would count anyway. Sure, the player would lose the race to the other opponents bug it is buggy and not elegant .  :-\
Title: Re: Lap system
Post by: tcmeric on December 23, 2017, 11:43:14 AM
Have for example 3 states on each car in a loop, and 3 checkpoints (or however many you want).

Each checkpoint has an INT variable. 1, 2, 3.

On each car, have 3 states. One, Two and Three.

As the car passes each checkpoint (trigger), check your state (for example State one), does an INT compare for the current check point fsm. If true, go to next state (two). If false, do nothing. This can force each car to go in order.

This would take care of the multi player car problem at least  8)
Title: Re: Lap system
Post by: LogLady on December 23, 2017, 04:37:13 PM
I will give a try. Thanks for your reply!