Thanks for the feedback, I havent done any work on the mod since because I've been too busy playing civ 4 and testing it for myself
Also, I have another unrelated project I'm working on that I need to give priority over this mod.
Its on my to do list
The algorithm you presented is similar to how I was going to implement it, but its going to be a bit more extensive than just a random chance in one city. Think world epidemics
Since my mod doesnt do anything to the map globe view I doubt it is my mod that is causing the problem (I havent played a game with it yet though).
I think the best way to learn is to read the code I've written, and also take a look at the mods provided by Firaxis eg desert war.
You'll need to know how to program otherwise you wont know what you're doing. I'll describe the basic steps for adding a new random event.
My code is quite modular. This means you can go away and write your own event and then post it here and I can put it in with relative ease (if you dont totally mess up the structure
).
As an example, say you want to make a flood. Here are the steps:
- Create a file called RandomEventFlood.py and write all the code that does the flood in there. A good idea is to copy one of the other files there and then change the code around a bit.
- If your flood needs a popup screen, open the RandomEventsScreen.py file and write the screen handler code there. You should only add 2 functions:
setEarthquakeScreenVars - allows you to pass variables from RandomEventFlood.py so they can be shown in the popup text
showEarthquakeScreen - code to show the screen
You'll also need to add an entry to the updateScreen() function. Have a look at the other events as an example.
You will also need to create some class variables in the init function at the top of the RandomEventsScreen.py file, and should clearly mark what the flood variables are so that its easy for me to change.
- If your flood needs IO (input/output, so you can save stuff between save/loads) then you'll need to open the RandomEventsIO class and add the needed functions in there. You'll need a "set" and "get" function and the data will need to be a basic data type like int or string or whatever. Take a look at the file and use what I've already done there as a start.
- open the RandomEvents.py file. Here you'll need to put in your class constructor call for your flood and change the event handler code so that the flood will occur. Have a read of the file to see how I've done it for other events - its relatively easy to follow.
- add any constants that will be used by your flood to RandomEventsConstants.py