• 📚 Admin Project Update: I've added a major feature to PictureBooks.io called Avatar Studio! You can now upload photos to instantly turn your kids (and pets! 🐶) into illustrated characters that star in their own stories. Give it a try and let me know what you think!

Quick Modding Questions Thread

In my ever-going battle to get the AI to build air units in the late game, I am wanting to try a new method. Upon discovery of flight, I want to automatically have an airport and 3 fighters and 2 bombers spawn in every AI city, similar to how missionaries spawn upon the discovery of a new religion. Any advice on how to proceed would be appreciated.
 
In my ever-going battle to get the AI to build air units in the late game, I am wanting to try a new method. Upon discovery of flight, I want to automatically have an airport and 3 fighters and 2 bombers spawn in every AI city, similar to how missionaries spawn upon the discovery of a new religion. Any advice on how to proceed would be appreciated.
Event
 
Here is the code I am attempting to use to have an airport and three fighters and two bombers placed in each AI city whenever a team discovers flight [airport] and assembly line [fighter and bomber]. If anyone can point out any flaws in the code it would be much appreciated as I am not getting any python errors in the log, yet the game is not producing the desired result:
 

Attachments

  • pic1.JPG
    pic1.JPG
    121.8 KB · Views: 9
  • pic2.JPG
    pic2.JPG
    61.5 KB · Views: 9
Last edited:
Are you using K-Mod ? If so, are you sure the Python callback(s) has been enabled ? Is there anything being printed in the log(s) at all ?

Update: There is no need to enable callbacks here since CvEventManager.onTechAcquired should always be called.

What is __LOG_TECH set to ? perhaps it is false since higher up there seems to be a __LOG_ALL that defaults to false (keep in mind that I am looking at the AdvCiv source but I think the code should be similar)

Another update: If you are using K-Mod (or any other mod that uses bug), then it seems that that particular event may/should be handled by BugEventManager.py
 
Last edited:
I am using MMod, which is my mod built off KMod which was actually put together with the assistance of karadoc originally and then with f1rpo last year. I will try to put the function in bugeventmanager
 
Last edited:
Difficulty levels apply many modifiers not just to the human player, but to AI players as well. Does anyone know for sure (I couldn't find it easily in the source code), in case of several human players with different difficulty levels, what exactly gets applied to the AI players? Modifiers from the first player? From the highest difficulty? Some kind of an average?
 
Back
Top Bottom