So I've been trying to work this out over a matter of days now, and I'm really desperate for some help.
To give you a scenario. The player can call multiple 'police cars.'
For this, I create the police car and add 1 to the global variable for Police Calls
I then get construct 2 to associate the Global Variable for Police Calls specifically to the police car's instance variable called Call_ID.
When the Police Car reaches it's destination, it parks, then construct 2 will spawn 2 police officers and will set the police officer's instance variable Call_ID to the same one the police car has, so the police officers from that police car have the same Call_ID instance variables.
After they search around the place for a time, they will head back to their police car.
So once the total search timer is 0, the boolean 'ReturningToPoliceCar' is set to true.
This is where it gets really complicated.
There is a sprite object that determines when the police officer goes back to the car called PoliceOfficer_GetIntoPoliceCar. This object has the same Call_ID instance variable as the police officers. It will only tell the police officer to go back to the police car if the police officers' boolean "ReturningToPoliceCar" is true and they are overlapping the object that tells them to get into the car.
The police officer needs to go back to the police car they came out of.
I can do this if there is only one police car and the 2 police officers from that car, but when it comes to more than one police car present, it stuffs up. Police go to the wrong car!
Here is what I have: http://prntscr.com/941p6p http://prntscr.com/941p92
I know it's a complete mess. I think I'm going wrong at lines 72, 76 and somewhere between 77-80.
I've become really lost with this. I've deleted the whole code and started again and I still can't seem to get it right.
I can get it right if there is 1 police car with the 2 officers for the one police car but once there is 2 police cars with a different pair of police officers, it becomes complicated.
I need to somehow tell construct 2 which police car is for what police officers so when they overlap or collide with the PoliceOfficer_GetIntoCar object, they go to the right police car and get deleted, but I'm so lost in how I can tell construct 2 that when it doesn't know which police car or what police officers are for what car to begin with. =[
The game has the capacity to provide an unlimited amount of police cars if really necessary, I have to keep it open for that flexibility.
If any of this doesn't make sense please add my skype at lukenecklace so I can further explain/show and then once resolved I can share it here.
Please help and thanks so much in advance.