This Lua script is designed for controlling traffic lights in a game environment. It allows you to interact with traffic lights, change them to green, and automatically reset them to red after a specified duration.
- Automatically detects nearby traffic lights.
- Sets traffic lights to green when specific conditions are met.
- Resets traffic lights to red after a customizable duration.
- Provides visual notifications for traffic light state changes.
You can customize the script's behavior by adjusting the following parameters in the script:
SEARCH_STEP_SIZE
: Step size to search for traffic lights.SEARCH_MIN_DISTANCE
: Minimum distance to search for traffic lights.SEARCH_MAX_DISTANCE
: Maximum distance to search for traffic lights.SEARCH_RADIUS
: Radius to search for traffic lights after translating coordinates.HEADING_THRESHOLD
: Player must match traffic light orientation within this threshold (degrees).TRAFFIC_LIGHT_POLL_FREQUENCY_MS
: Polling frequency (ms) for quicker detection.TRAFFIC_LIGHT_GREEN_DURATION_MS
: Duration to keep the traffic light green (ms).
- Install the script in your game environment.
- Customize the parameters in the script to match your preferences.
- Run the script in your game environment.
The script displays on-screen notifications when the traffic light state changes. Notifications include:
- "Traffic light set to green." when a traffic light is set to green.
- "Traffic light reset." when a traffic light is reset to red.
This script is available under the MIT License. See the LICENSE file for details.
This script was created by TheStoicBear.