Bazaar developer reference

Bazaar developer reference

Every function in the game's code, with its code, the functions it calls and the functions that call it, and how to hook it from a plugin.

What do you want to do?

Each goal below names the game functions to hook for it, and a Lua event when a Lua mod alone can do it. A function's page shows its code, what calls it, and the hook declarations to copy. The plugin-writing guide in the SDK explains how to write and register a hook.

Every turn

Do something at the start of each player's turn

Combat

Change how strong units are in combat

React to a unit dying

Cities

Change how fast cities grow

Change a city's yields

Change a tile's yields

Change what a city can build

Change what things cost to build

React to a city changing hands

Empire

Change gold income

Change happiness

Change research costs

React to a new tech or policy

Units

React to a unit being created

Change how far units move

React to a great person being born

AI and diplomacy

Change how the AI feels about a player

Change which trades the AI accepts

Bazaar's own tools

Add your own Lua functions

Watch notifications and popups