Navy Upgrade Issue

OrionVeteran

Deity
Joined
Dec 25, 2003
Messages
2,443
Location
Newport News VA
I have completed work on my combined forces mod and have put the mod through testing. My (Python) approach for naval units was to get the AI to send old units to a specified city where they would be combined (actually deleted and replaced) by a new fleet unit. The problem I ran into was the AI decided to upgrade these units before the python could convert them into a fleet unit. Upgrading these old ships is what I was trying to avoid! Current code specifies eligible ships to create a fleet unit must be 2 Eras below the current era for the player. If I choose only one era below the current era, then I risk pulling one or more ships that might be necessary for defense. Does anyone have an idea on how I could change my approach to selecting ships to create a fleet unit?
 
Just an idea, never tested it -
Try adding a new UNITAI (in XML and C++ code), add it to the unit info you wish to prevent from upgrading. Add it to the NotUnitAIs of the upgraded unit info. Assign this UnitAI to any unit in game for which you want the AI to decide to combine forces (or whatever it's called).

This unit won't be able to upgrade to a unit with this NotUnitAI. I think.
 
Just an idea, never tested it -
Try adding a new UNITAI (in XML and C++ code), add it to the unit info you wish to prevent from upgrading. Add it to the NotUnitAIs of the upgraded unit info. Assign this UnitAI to any unit in game for which you want the AI to decide to combine forces (or whatever it's called).

This unit won't be able to upgrade to a unit with this NotUnitAI. I think.

Thanks for the idea. However, I discovered and fixed a bonehead mistake in my Python and now the code actually converts the units before the AI gets a chance to upgrade them. :D
 
Back
Top Bottom