Traffic and Driving

● ARCHIVED · READ-ONLY
Started by mike_your_bro 1 posts View original ↗
  1. Hello all, I am starting this thread to ask if anybody could help me figure this one out.

    I had success figuring out my unit conversion, thanks in part to a member here who posted in that thread, and I could really use some help here.

    Here's the deal:

    I want to be able to go to a vehicle, preferrably a car but am having trouble finding sprites for one, and another issue with making a vehicle that travels on land and has the same basic walking limitations as the player. What I am trying to accomplish is my character goes to the car, and presses enter, and then can choose where to drive, (mike's house, chris' house, 7-eleven) and then the car drives there automatically. Now, I don't necessarily have a problem getting a vehicle to take me somewhere, I know how to use 'transfer' and I know how to use 'set move route', but what I want is, for instance, between chris' house and mike's house, there are several traffic lights, and I want the car to [if within a certain distance of the intersection and light turns yellow or is already yellow] then the car slows down, and stops at the designated spot(a stop bar on the ground, doesn't necessarily have to be a visible thing), and if it's already red, the car does the same thing, and once it is green, the car continues on it's path to [location].

    So far, to test an idea I had, I made a map with the entire route mapped out along the roads. I do NOT however know how to set up this system yet, and would REALLY appreciate any help you can give. A screenshot of an example would be great, otherwise a nice descript response would help considerably.

    Not very good at 'actual' scripting, though I definitely know the ACE system very well. Thanks in advance!

    (P.S. If you manage to get it working yourself and can manage to upload it so I can see and test it, that would be great too. Amazing, actually!)

    EDIT: I managed to get it working a little bit, not sure how to make it all work together perfectly but here's basically what I did:

    The first event is the actual traffic light. It is only one page at this point, as I deceided to keep it as one page that has a move route than 3 pages with different sprites.

    The move route is set in the event options, not by calling the 'set move route' command.

    I have the original sprite set as the button in the rtp, the green one.

    Then I have the light's move route have this:

    wait (however long)

    change graphic > yellow button

    control switch = yellow light > on

    wait (however long)

    change graphic > red button

    control switch = red light > on

    wait (however long)

    change graphic > green button

    control switch = red light > off

    wait (very short time, less than a second)

    control switch = yellow light > off

    and I set the move route to 'repeat'

    then i have a spriteless event on the road(about 3 blocks from the intersection) that has this(basically)

    -page one

    switch green light is on

    parallel process

    player speed 'normal'

    -page two

    player touch, same as character(? cant remember exactly), and it has a custom move route for the player:

    player speed '4x slower'

    step down

    step down

    wait '900' frames

    (i made the wait longer because as soon as the switch 'red light' turns on it stops anyways)

    -page three

    blank page

    then there is an event at the intersection where i want the player to stop for a red light until it turns green again, it does this when switch 'red light' is on:

    custom move route for player 'wait 900 frames'

    i haven't tested it with an automated vehicle yet, that makes you go along a designated path, but it seems as though it should work. when i tested it originally i just was sprinting down the road, when the light turns yellow it slows my guy down tremendously, like i wanted, but the red light does not make my guy stop and wait for green, i have free control over my guy, just really slow, and when the light turns green i actually go back to normal speed.

    SO, it seems as though I BASICALLY have the traffic light working how i wanted it to, i would love to hear some input from anybody regarding this, have you tried it, thought about it, gave up on it, etc.

    the thing i really could use a little help on is this:

    because i want the driving to be predetermined, i want the entire trip to be a specific route, with the lights varying from time to time, so it seems a little more realistic. I need to figure out how to continue along the route AFTER my car is stopped at a traffic light.

    EDIT: I got it working, basically I mad the light change graphics, and control a switch for each, yellow and red light. the default for green is just a PARALLEL process that makes the player 'move down' or 'move left' or whatever i need, and if they hit the light-check event on the road and the light is:

    green: parallel, sets player speed to normal driving speed, continues to run 'move down' parallel process

    yellow: slows player, moves player to stop bar on road

    red: stops player, waits as long as 'red light' switch is on.

    i have uploaded the roads map so you can see it if you would like:

    Click here to download the Driving Sample Game