ai-death
Downed players, respawn at the nearest hospital, medic revives with a medikit, doctor calls and check-in treatment.
ai-death decides what happens when a character goes down. The player lies in a death animation and waits for a medic. After a timer they can wake up at the nearest hospital for a fee. On-duty medics revive in place with a medikit, and hospitals offer paid treatment while few medics are on duty.
What it does in the game
- Going down. The player lies in a death animation (slumped in a vehicle seat, a ragdoll in water, nothing while carried). They can still look around, chat, talk on push to talk and open the pause menu; every other control is off. A down screen shows the countdown.
- Reconnecting. A player who leaves while down comes back down. The down state is stored on the character (
isdead, the key QBCore uses). - Calling a doctor. While down, press G to send a distress call to the medics. There is a wait between two calls (panel). The down screen shows how many medics are free.
- Respawn. When the countdown ends, the down screen offers the hospital. The player wakes up at the nearest hospital's wake-up spot. The hospital fee is taken from the panel's accounts in order; a player who cannot pay goes free. When Lose items is on, the inventory is emptied.
- Medic revive. An on-duty medic who uses a
medikitrevives the closest downed player within 3 m, where they lie. When Revive fee is above 0, the revived player gets a bill from the medic's job (paid later). Anyone else who uses amedikitheals themselves. - Check-in treatment. At a hospital's check-in point, a player pays the treatment price and is healed fully. It works only while at most Medics for check-in medics are on duty.
- Health refill. GTA slowly gives back health when you are not hurt for a while. ai-death turns that off by default (panel switch).
- Hospital blips. Each hospital can show a map blip.
Installation
Installed by the AI Core recipe. By hand: ensure ai-death after ensure ai-core. It needs ai-core and OneSync.
- The medikit item is named
medikit. Make sure it exists in your inventory's item list. ai-death registers it as usable with whichever inventory runs. - Add your medic job (default
ambulance) in ai-core (admin panel, Jobs) and list it in Medic jobs. - AI Core uses the first supported death script that runs (see below).
Panel settings
Admin panel > Death and hospitals. Defaults come from data/settings.json and data/hospitals.json.
Rules tab
Respawn: a downed character waits for a medic; after the time it can wake up at the nearest hospital.
| Setting | What it changes | Unit | Default |
|---|---|---|---|
| Wait before respawn | Seconds a downed player waits before the hospital option appears. 0-3600. | s | 300 |
| Hospital fee | Taken when waking up at the hospital; players who cannot pay go free. 0-1,000,000. | $ | 1,000 |
| Lose items | Waking up at the hospital empties the inventory. | off | |
| Health refills by itself | GTA slowly gives back health (up to half) when you are not hurt for a while. Off: only healing, medics and items give health. | off | |
| Paid from | Money accounts tried in order for the hospital fee and treatment. Up to 5. | bank, cash |
Medics: medics on duty revive downed players with a medikit; downed players call them from the down screen.
| Setting | What it changes | Unit | Default |
|---|---|---|---|
| Medic jobs | On-duty members of these jobs revive with a medikit and get the doctor calls. Up to 10. | ambulance | |
| Treatment price | Check-in treatment heals fully for this price. 0-1,000,000. | $ | 250 |
| Medics for check-in | Check-in works only while at most this many medics are on duty. 0-100. | 2 | |
| Revive fee | A medic's medikit revive sends the revived player a bill from the medic's job; the job's account gets it when they pay. 0 = free. 0-1,000,000. | $ | 0 |
| Doctor call wait | Seconds a downed player waits between two doctor calls. 10-3600. | s | 60 |
Hospitals tab
One record per hospital. Defaults: Pillbox Medical, Sandy Shores Medical, Paleto Bay Medical.
| Setting | What it changes | Default for a new hospital |
|---|---|---|
| Name | The hospital name, shown on the blip. 1-48 characters. | empty |
| Wake-up spot | Where players wake up, facing your direction. | 0, 0, 0 |
| Check-in | Where players pay for treatment. | 0, 0, 0 |
| Map blip | Shows the hospital on the map. | on |
| Blip look | Sprite, colour and size (shown when Map blip is on). | sprite 61, colour 1, size 0.7 |
Commands
None. Admin tools revive and heal through AI Core's medical layer, which calls ai-death.
Keybinds
Each player can change these in GTA's key settings (FiveM section); the owner changes the defaults in the admin panel (Keybinds).
| Default key | What it does |
|---|---|
| G | Call a doctor while down (death_distress). The down screen shows the key that is bound. |
The hospital option at the end of the countdown and the check-in points use ai-core's prompts (E by default).
What it stands in for
No fxProvide. It answers exports.qbx_medical:Revive and exports.qbx_medical:IsDead, and the client event hospital:client:Revive (sent by QB scripts and admin menus) revives the player. The down state uses QBCore's isdead metadata key.
Other death scripts
AI Core's medical layer also supports qbx_medical, ars_ambulancejob, qb-ambulancejob, esx_ambulancejob, tgiann-ambulance, wasabi_ambulance (v1 and v2), osp_ambulance and brutal_ambulancejob. Stop ai-death and start one of them: admin revives and every ai-* script keep working. Doctor calls go through AI Core's EMS layer, which also reaches tgiann-policealert and wasabi_ambulance_v2. See Compatibility.
Known limits
- The countdown runs on the player's game clock; the server checks the time again before the respawn.
- A refused revive bill is written to the log as a warning; the revive still counts.
- Log channels:
deaths,revivesanddistress.