Teardown: How to Make Chase Vehicles

A guide on making vehicles compatible with the AZC chase system.

 

Introduction

This guide will go over the simple structure and workings of vehicles that are used by the AZC chase mod.

Structure overview

Let’s look at the structure of a chasevehicle, we’ll be looking at the EU – Police Van from the base pack.
As with any spawnable object, it’s an instance, but the contents need to be structured carefully.
The main focus is the “chaseOperator.lua” script. This script contains all the inner workings of the vehicle, and can be examined when you create a local copy of the base pack mod. (its in the scripts folder)
The script has three children, the vehicle itself which has the “chasecar” tag, a body which contains the lights, and a communicator body which is empty and also has the “chasecar” tag.
If you want to know how the lights work, I’d recommend checking the mod out yourself, its pretty self explanatory. This body is also not required, as not all cars have emergency lights.
The vehicle is unchanged from any other non chase vehicle, and the communicator is just and empty body. That’s a pretty simple structure!

How to convert a vehicle

Converting let’s say a base game vehicle isn’t that difficult. You need to create a new script instance, which should be the chaseOperator script (or whatever script you made to control the vehicle). Then you should add the base game vehicle instance as a child to the script, don’t forget to add the “chasecar” tag to it. Next we need to add the empty communicator body, so add a new body instance as a child to the script, and add the “chasecar” tag to it. Now we should have something like the screenshot above (except for the lights body, but we don’t need it in this example).
All you need to do next is turn the script (which contains the vehicle and communicator body) into something spawnable, for which there are loads of guides online. And tadaa, a vehicle that’s compatible with the AZC Chase Controller!

Other important stuff

The vehicles use the key “azc.hasmaster” (bool) to know if the master script (= controller) is present. vehicles built into a map will activate before the controller mod, so they will always give the warning, but you can ignore it in that case.

The way the vehicle knows to halt or chase is the tag “lightson” on the communicator body. If the tag “lightson” is “1” then the vehicle will chase, if it’s “0” then it will brake and wait. (you can see how the controller changes this if you make a local copy)

You can change how frequently a light flashes by changing the value of the “blink” tag of a light in the lights body. The chaseOperator script will also automatically vary the start time of multiple lights to make them flash correctly.

The sirens can be modified too, and the vehicles automatically switch between two sirens on random intervals.


Thanks to Artzert for his great guide, all credit to his effort. you can also read the original guide from Steam Community. enjoy the game.

Related Posts:

Post Author: Robins Chew

Leave a Reply

Your email address will not be published. Required fields are marked *