Zachary_Alan
Member
I need the guide point for the pedestrians in my GTA 2 styled game to find the nearest direction object so they can start the loop of walking along sidewalks. Long story short, I want them to get the nearest ped direction object, using a variable called resetPoint. This is the code I used:
I rewrote all the code for both the ped guide, and the actual peds (which what all the peds really do is follow their guide, which does work using instance_nearest)
I tried to make a special reset point, (using resetPoint = instance_nearest(obj_pedReset) but that still didn't work. I made a debug key so I can see what point they are going to. According to that, the id is just "1". Sometimes they will move linearly in a random direction, or they will follow one of the car objects.
What's funny is that I accidentally made it so that they get into any car they are close to, so sometimes they will go to a random parked car and start driving it, or they will chase a car that's driving down the road, or they will chase their own car after I steal it and when I get out they get back into it. But, it stopped being funny and it turned into a massive headache.
Code:
resetPoint = instance_nearest( x , y , obj_pedTopLeft) or instance_nearest( x , y , obj_pedTopRight) or instance_nearest( x , y , obj_pedBottomLeft) or instance_nearest( x , y , obj_pedBottomRight);
I tried to make a special reset point, (using resetPoint = instance_nearest(obj_pedReset) but that still didn't work. I made a debug key so I can see what point they are going to. According to that, the id is just "1". Sometimes they will move linearly in a random direction, or they will follow one of the car objects.
What's funny is that I accidentally made it so that they get into any car they are close to, so sometimes they will go to a random parked car and start driving it, or they will chase a car that's driving down the road, or they will chase their own car after I steal it and when I get out they get back into it. But, it stopped being funny and it turned into a massive headache.