Actually you can ask chatgpt or copilot to write you the code
While true, it's not a helpful answer here, especially if you don't know where to start

.
To give a partial answer: If you know programming in general, and python more specifically, then not too hard.
You need to first activate the debugging mode in your civ4.ini file, otherwise you'll not get any error messages, and you'll just start up with a broken process.
After that, you'll need to figure out where to hook in your code, and if there is a suitable option.
e.g. there is a trigger for building a city. Means if you want to have code run after building a city, you can easily do that. But there is e.g. no trigger for an unit attacking, so there you cannot easily hook in code.
And after that, you need to be able to figure out what Civ4 specific API calls to make. They are pretty standardized, but might take a while to understand the system.
Now I hope that someone who's more recently modded Civ4 to point in the direction of the debug mode, the Civ4 API, and the best option to hook in the code.
(and let's hope an admin doesn't have to dig back in his memories again because the last answer could have needed more details...)
EDIT: After checking the question again, I'm not sure if there's the right trigger in the files though

.