RDE_AIPD DOCS
RED DRAGON ELITE // AI SYSTEMS

Cops That See.
Not Cops That Teleport.

rde_aipd is a true line-of-sight AI police system for ox_core — cops only react to what they can actually see, with dynamic threat assessment, a physics-based tackle, and a realistic witness system with panic delay and night modifiers. StateBag-synced, Nostr-logged, production-ready.

01 / Start Here

Overview

Every other police script is either paid, ESX/QB-only, or a laggy mess with braindead AI that just runs straight at you. rde_aipd is built ox_core-native with true line-of-sight detection, dynamic threat calculation per unit, and a realistic witness/911 pipeline instead of instant omniscient cops.

Core Principle Cops only know what they can see or have been told. Line-of-sight, field-of-view cones, and a witness call pipeline replace the old "every NPC instantly knows you committed a crime" model.

Why this over other police scripts

Other Police Scriptsrde_aipd
Static wanted levelsDynamic, decay-based wanted system
Dumb AI that just runs at youTrue line-of-sight AI with threat assessment
Discord webhooks (deletable, bannable)Decentralized Nostr logging — permanent
0.5ms+ idle resource usage< 0.01ms idle
02 / Start Here

Quick Start

server.cfg
-- Dependencies first — order matters!
ensure oxmysql
ensure ox_lib
ensure ox_core
ensure ox_inventory

-- Optional: Nostr logging (highly recommended)
ensure rde_nostr_log

-- The AI police system
ensure rde_aipd

No SQL import needed — tables auto-create on first run. Already on a previous version? Just git pull — v1.0.6-alpha is a drop-in replacement, same config structure, same DB schema.

03 / Reference

Configuration

Witness System

config.lua
Config.WitnessSystem = {
    fieldOfView            = 240.0,   -- NPC cone of vision (degrees)
    proximityGraceDistance = 8.0,     -- "heard it" radius bypassing FOV+LOS
    intimidationDistance   = 8.0,     -- walk toward witness → they flee, no 911
    panicDelay             = { min=1500, max=3500 },
    nightTimeModifier      = 0.60,    -- phone chance multiplier at night
    combatSuppression      = true,    -- active gunfire suppresses witness calls
}

Tackle System

config.lua
Config.CopTackle = {
    sprintTime         = 300,    -- sprint windup before impact (ms)
    playerRagdollMin   = 3500,   -- player stays down this long (ms)
    tackleForce        = 8.0,    -- impact force on player ped
    triggerDistance    = 4.5,    -- max distance for tackle (m)
}
04 / Reference

Nostr Logging

First-class rde_nostr_log integration — every critical event is logged to the decentralized Nostr network, permanent and cryptographically signed.

EventNostr Tag
Wanted level changewanted_set
Player arrestedplayer_arrested
Crime committedcrime_detected
Officer killedofficer_down
Player surrenders / escapesplayer_surrendered / player_wanted

Disable completely with Config.Nostr.enabled = false — zero overhead, zero side effects.

05 / Reference

Exports

ExportSideReturns
getWantedLevel()Clientnumber
copsCanSeePlayer()Clientboolean
getPlayerThreatLevel()Clientnumber (0-100)
getPlayerFatigue()Clientnumber (0-100)
setWantedLevel(n)Client
surrender()Client
LogCrime(type, coords, witnessed)Client
06 / Reference

Debug Commands

Enable with set police_debug "true" in server.cfg.

CommandDescription
debugpoliceDump full system state to console
testwanted [1-5]Set wanted level instantly
testwitness [TYPE]Force the full witness/911-call flow
clearcopsDespawn all pursuing units
07 / More

Common Pitfalls

Cops don't leave the minimap after wanted clears

Blip removal happened in an async thread that ran one tick after ClearAllUnits().

Fix: blips and tasks are now cleared synchronously in the same frame (v1.0.6-alpha).

Cops drive toward the player after wanted clears

Departure direction was cache.coords + random_angle × 500 — a random angle could point directly at the player.

Fix: departure is now always computed as the exact opposite vector from the player.

No witnesses / cops never spawn

Older builds used IsPedFleeing() as a hard filter — GTA sets all nearby NPCs to flee on crime, guaranteeing zero witnesses.

Fix: FOV/LOS-based witness detection replaces the flee-state filter in v1.0.6-alpha.

Tackle doesn't feel physical

The original tackle lacked directional momentum.

Fix: now uses the cop's forward vector + ApplyForceToEntity, with a sprint windup and asymmetric ragdoll durations (cop recovers faster, trained).

08 / More

FAQ

Does this require rde_nostr_log?

No — it's optional. Without it, the system continues to work exactly the same, just without decentralized logging.

How many wanted levels are there?

6 — from a minor warrant up to maximum response with helicopters and roadblocks. Decay only happens when no officer has eyes on you.

Can admins be exempt from wanted?

Yes — set Config.AdminSettings.exemptFromWanted = true.

09 / More

Changelog

v1.0.6-a

Complete witness system rewrite, cop despawn race condition fix, physics-based tackle with forward-vector momentum.

v1.0.1-a

Fixed truncated Debug(...) calls that broke Lua parsing on resource start.