Is there a way for me to catch a event of creating a trade route?

There isn't an event when a trade route is created (you'd also need one when a trade route ends or is plundered), but you can get the information you need via pPlayer:GetTradeRoutes() which returns an array of tables holding trade route info - where the FromID and FromCity members hold the info you will need.

Code:
local pPlayer = Players[iPlayer]
for tr in pPlayer:GetTradeRoutes() do
    if (tr.FromID == iPlayer) then
        -- tr.FromCity has (at least one) outbound trade route
    end
end

Hook up a handler for the PlayerDoTurn event, clear all the players cities of any dummy buildings adding the effects you want, then loop the trade routes and add back dummy buildings.
 
Back
Top Bottom