Civilization IV/Python Tutorial
This page contains unnecessary drivel. As our aim is to present helpful and complete guides for games, pages do not need to contain unnecessary information, such as the names of contributors, or mini guides for editing. If you are qualified, pleaseto remove the drivel, and then remove this template from the page.
Python can be used to modify the behavior of Civilization IV, and is essential if you want to create a new game. This tutorial for python originated from the Civilization Fanatics Center forum, and will provide basic information on how to modify the game.
Python can be used to:
- Make complex scripts causing events to happen on a trigger. For example, you can make it so that if you take the holy city of a religion, all Civs following that religion will declare war on you.
- Edit the interface. Pretty much all of the game interface is generated dynamically by python, and can be edited in python. You can make new buttons, alter the layout of the Civilopedia, change the way the tech tree is generated... and even radical changes such as a small dancing pig in the corner of your screen, with music. There are limitation to this - mouseover texts, for example, are far better suited to the SDK.
- Generate new map types. I haven't tried this myself, so it might not be covered too well in this tutorial.
- Edit the AI behavior. However, the SDK may be more suitable for this task.
Python can't be used exactly how you might want to use it. While the amount of things you can do in it is quite large, there are limitations on Python section of the code.
Additional tutorials for programming Python on general include GBM's python tutorial, which gives a brief outline of how to program in python.