Skip to main content
We’ll build an enemy ESP in five small steps: health text and a health bar in the ESP builder, then boxes and head dots drawn on the overlay, colored by visibility and controlled from a menu.
Start from a project made with spd new (see Getting started) and keep spd watch running. The script reloads on every save, so each step shows up in game right away.

Step 1: Health text

esp elements live in the user’s ESP builder. The user places and toggles them; your code only supplies the value. Replace src/index.ts with:
evaluate runs every tick for every enemy pawn. Returning null hides the element on that pawn. Open the ESP builder: “health” is there, showing the preview text.

Step 2: Health bar

A bar takes a fraction, or an object when you want to set the colors. Add:
colorMode: "value" blends from color when empty to colorAlt when full. Keys you leave out keep whatever the user set in the builder.
When several elements need the same data, compute it once per pawn with context: esp.class("enemy", { context: (pawn) => ({ hp: pawn.m_iHealth }) }), then read ctx.hp in each evaluate(pawn, ctx).

Step 3: Boxes on the overlay

Builder elements are laid out for you. For free-form drawing, use render. Reading entities goes in tick, drawing in render: draw calls throw anywhere else. Add the imports at the top and the listeners at the bottom:
render.boundsOf returns the pawn’s box on screen, or null when part of it is behind the camera.

Step 4: Head dot and visibility

Store whether each enemy is visible, and pick the color from it. Replace both listeners:
isVisible returns null without a map, hence the === true. render.worldToScreen returns null for points behind the camera.

Step 5: Menu toggle

Give the script a page in the menu with a switch and two colors. Values persist in the user’s configs. Declare controls once, at the top level:
Then read them in the listeners:
Pressing F6 flips the switch in the menu too.

Full script


Next steps

esp

Icons, style keys, context, element handles.

render

Every draw call, text, textures.

ui

Sliders, combos, hotkeys, reactive labels.

entities

Bones, hitboxes, schema fields.