sman1975
Emperor
Greetings,
I'm working on a mod that adds units throughout the tech tree, for example, it adds 8 UUs, one for each Era of the normal game.
I'd like to make it possible to upgrade a unit to the next Era's version, once a civ discovers the prereq tech (pretty easy to do).
I'd also like to limit the number of each Era's units (also easy to do using the MaxPlayerInstances element).
---------------------------
My problem is that I'd like to limit the total number of units at 3 for each Era, for a max of 24 total units, assuming you never upgraded any units.
Unfortunately, when it's possible to upgrade a unit, the game lets you do this - and does not check the MaxPlayerInstances numbers before upgrading the unit.
This means I can build 3 "ancient" units. When I get to "classical" I can build 3 "classical" units, then upgrade the 3 "ancient" units. I now have 6 "classical" units.
Ultimately, I can end up with 24 "Information" units if I plan accordingly. This is definitely game breaking, as these latter units are pretty OP.
---------------------------
I can think of some LUA ways of preventing a player for "producing" a given Era unit if there are already too many fielded. But I still can't figure out a way of preventing an upgrade if there are too many of that Era's units already in the game.
Does anyone have any suggestions on how to pull this off?
Thanks!
I'm working on a mod that adds units throughout the tech tree, for example, it adds 8 UUs, one for each Era of the normal game.
I'd like to make it possible to upgrade a unit to the next Era's version, once a civ discovers the prereq tech (pretty easy to do).
I'd also like to limit the number of each Era's units (also easy to do using the MaxPlayerInstances element).
---------------------------
My problem is that I'd like to limit the total number of units at 3 for each Era, for a max of 24 total units, assuming you never upgraded any units.
Unfortunately, when it's possible to upgrade a unit, the game lets you do this - and does not check the MaxPlayerInstances numbers before upgrading the unit.
This means I can build 3 "ancient" units. When I get to "classical" I can build 3 "classical" units, then upgrade the 3 "ancient" units. I now have 6 "classical" units.
Ultimately, I can end up with 24 "Information" units if I plan accordingly. This is definitely game breaking, as these latter units are pretty OP.
---------------------------
I can think of some LUA ways of preventing a player for "producing" a given Era unit if there are already too many fielded. But I still can't figure out a way of preventing an upgrade if there are too many of that Era's units already in the game.
Does anyone have any suggestions on how to pull this off?
Thanks!