Scripted enemies repeat the same three lines forever. You can make a boss that taunts you about how you're fighting instead — no dialogue tree, generated at runtime.
Feed the model the game state
The trick is turning the current situation into a short prompt:
local state = ("The player has %d HP left, is using a %s, and has dodged %d attacks.")
:format(player.Health, weaponName, dodgeCount)
local taunt = ai:ask(
"You are a smug arena boss. Taunt the player in one short line based on the situation.",
state
)
Now the boss says different things when you're low on health versus when you're winning — because it's reading the actual state, not a fixed script.
Keep it cheap and safe
- Cache by a rounded state so similar situations reuse a line instead of paying again.
- Rate-limit per player so a spammer can't run up your usage.
- Filter the output before it appears over the enemy's head.
The open-source Cortex kit handles caching, per-player limits, and moderation for you: https://github.com/cortex-rbx/roblox-ai-kit
Top comments (0)