carEvent
Module: vehicle_parts.lua
What it does
Applies a targeted effect to a specific component of the vehicle the player is currently inside. The affected part is controlled by the part parameter. Effects range from destroying parts (engine, muffler, battery, tires, gas tank) to repairing them, refueling, toggling the driver window, and giving the player a key for their current vehicle.
Trigger type
carEvent
Parameters
| Parameter | Type | Default | Valid Values | Description |
|---|---|---|---|---|
part |
string | none (required) |
"Engine", "FlatTire", "RepairTires",
"GasTank", "Refill", "Muffler",
"Battery", "FixEngine", "OpenWindow",
"GiveKey"
|
The vehicle component action to perform. See the table below for details on each value. |
| Value | Effect |
|---|---|
"Engine" | Sets engine condition to 0 (destroys it). |
"FlatTire" | Pops a random one of the four tires. |
"RepairTires" | Repairs all four tires. |
"GasTank" | Empties the fuel tank to 0. |
"Refill" | Fills the fuel tank to 100. |
"Muffler" | Sets muffler condition to 0 (destroys it). |
"Battery" | Destroys battery condition and drains battery charge to 0. |
"FixEngine" | Sets engine condition to 100 (fully repairs it). |
"OpenWindow" | Toggles the front-left (driver) window open or closed. |
"GiveKey" | Adds a key for the current vehicle to the player's inventory. |
Examples
Blow the engine while driving
{ type="carEvent", part="Engine" }
Pop a random tire
{ type="carEvent", part="FlatTire" }
Give the player a key for their current vehicle
{ type="carEvent", part="GiveKey" }