Browse docs
AI Medic
Reference for AI Medic in ambulancejob.
AI Medic
setAiMedicState(state, reason?)
- Purpose: Updates the AI medic status shown on the death screen UI. Use this when you override the built-in AI medic via
Config.Functions.onAiMedicRequestand need to update the UI from your own system. - Arguments:
state(string): One of"idle","requesting","dispatched","driving","arrived","reviving","finished","failed","cooldown".reason(string?): Optional failure reason when state is"failed"—"not_enough_money","medics_online","spawn_failed","disabled".
-- Show "AI medic on the way"
exports["sky_ambulancejob"]:setAiMedicState("driving")
-- Show failure
exports["sky_ambulancejob"]:setAiMedicState("failed", "spawn_failed")
-- Reset to idle
exports["sky_ambulancejob"]:setAiMedicState("idle")
getAiMedicState()
- Purpose: Returns the current AI medic state.
- Returns:
string— the current state (e.g."idle","driving","reviving").
local state = exports["sky_ambulancejob"]:getAiMedicState()
isAiMedicActive()
- Purpose: Checks if the AI medic is currently active or pending.
- Returns:
boolean
local active = exports["sky_ambulancejob"]:isAiMedicActive()
To override the built-in AI medic with your own system, use the
Config.Functions.onAiMedicRequest hook in config/functions.lua. Return false to prevent the default AI medic from dispatching, then use the exports above to update the death screen UI.-- config/functions.lua
Config.Functions.onAiMedicRequest = function()
exports['my-medic-resource']:sendHelp()
return false -- prevent built-in AI medic
end