What did I do... I tried to structure the code a little more, using sub-events (events inside of each others).
The E key pressed will start an event where, depending on the state of the game (is the player inside the car ?), it will do different things.
- if the player is out of a car, the game tries to find a car near the player. The first one found will put the player inside it by calling a function, and passing it the car.UID. This way, only this car will be activated, as the function starts by selecting only this car (Car.SelectByUID, event 9)
- if the player is in the car, we just get out of it, disabling every car's movement and enabling the player to move.
The only difference with the screen capture from before is the "Stop loop" I added on event 8, as it will stop as soon as a car is found near the player.
The functions are here to make it clearer.
Well, I didn't handle the scroll as your problem was with the car selection/activation... If the scroll is on the player, then you should "Pin" the player to the car he is in. Right now, you put the player in the car, then drive the car, but the player stays in place. Use the pin behavior, activate it in the getInCar function after putting the player inside the car, and deactivate it in the getOutofCar function