Bazaar developer reference

UnitReplaced

An announcement: the game made a new unit in place of an old one. The parameters are the old unit's owner and ID, and the new unit. It runs when a unit upgrades, is captured, is given to another player, is a captured civilian handed back to its first owner, or is a barbarian unit that changes sides, and when a city-state gives a unit to a major civilization. The old unit may already be gone, so use its owner and ID only to tell which unit it was. Bazaar has already copied the plugin values that carry over to the new unit.

It does not run for a unit sent to a city-state from its diplomacy screen, which arrives there some turns later as a new unit, or for trade units the game makes again, because the game gives the new unit no link to the old one. A unit given to a city-state with its Gift order, inside the city-state's borders, does run it.

Where it fires