Hi ThichN,
Let me start by saying I completed the mod yesterday and I enjoyed playing it very much! As you've indicated previously, this is still an alpha version but you already managed to introduce some very fun and interesting features, and of course as I've said before the quality of the graphics and overall polish of the mod is just first rate!
@tootall_2012 Yes, that's right! The legion gets capped based on population. Hope it didn't put you in too much of a bind. Did you feel it was too soon for the cap (I could lower it in the code)?
As you discussed in a previous post with Knighttime, since the mechanism to prevent cities from building legions when the cap is reached isn't in place, I still had 3 of my cities that could keep building this unit therefore I was able to slightly pass my cap (25 legions for a population of roughly 200 citizens).
In case this helps, cap limits play a vital role in my Battle of Italy (BoI) scenario and as such I implemented two different mechanisms to track and prevent unwanted or surplus units:
1. Sometimes, when the Allies captured an Italian city, it would still be producing an Italian Infantry unit which I obviously didn't want. So in my onCityProduction.lua file I added this bit of code which deleted the unit as soon as the city produced it and gave a warning to the player to review their city production...
Code:
function onCityProduction.onCityProduction(city,prod)
if city.owner == object.pAllies and civ.isUnit(prod) then
if prod.type == object.uFanteriaVeterana then
text.simple("The " .. prod.type.name .. " built in " .. city.name .. " was removed.\n^\r^This is a reminder that the Allies may only build either\n^city improvements or 'Capitalization' in their cities.\n^\r^As such, you should check your cities production\n^status screen to ensure they aren't building units.","Illegal Production Eliminated!",object.monexone)
civ.deleteUnit(prod)
end
end
end
I imagine in your case, you could modify the code to only delete a unit if it exceeded the cap?
2. In the second case, on given turns the Allies are required to withdraw units through the event file. But this caused a problem if the unit was loaded on a truck at the time that the witdrawal was scheduled. So I added the following code in my onActivate.lua file that always tracks the maximum number of unit as specific type has. If, when its the unit's turn to activate, it exceeds it's allowable limit, I delete the unit and give a message stating why...
Code:
-- DELETING ALLIED INFANTRY/ARTILLERY TYPE UNITS THAT WEREN'T WITDRAWN AS PER SCHEDULE
-- Reason: It's possible that some units may not have been withdrawn because they were being tranported by trucks at the time
-- See also onTribeBeginTurn.lua -- PARTIAL UNIT.TYPE DELETION FUNCTION section where I prevent withdrawing units from the 'unit.location ~= object.ltransportPoint' because this could cause an error when trying to unload the truck afterwards
if civ.getTurn() >= 19 then
-- UNITED STATES UNITS
-- GI Veteran
if unit.type == object.uGIVeteran then
local GIVeteran = 0
for unit in civ.iterateUnits() do
if unit.type == object.uGIVeteran then
GIVeteran = GIVeteran + 1
end
end
if GIVeteran > counter.value("# GI Veteran") then
civ.ui.text("The " .. object.uGIVeteran.name .." located at (" .. text.coordinates(unit.location) ..") was belatedly withdrawn from the theater as part of a previously scheduled departured!")
civ.deleteUnit(unit)
end
end
Finally, since you are using a cap for multiple units, may I suggest you implement a dashboard, again similar to what I've done in BoI (which is accessible by pressing on the keyboard '2' key), that dynamically tracks not only the number of current active unit types but their maximum allowable limit?
Of course, these are merely suggessions for you to review in the case they may be useful to you. Feel free to use or discard them at your own convenience.
Oddly, I couldn't open your .sav file. I'd love to see screenshots, if you're up for sharing.
In this screen shot, you can see that I started my Roman Empire at the very tip of an isolated peninsula and had to expand ever eastward as a consequence...
Near the end of the scenario, as I was the dominant power on the board, all the other powers had joined an alliance against me. I had no option but to wage war (in this scene I'm making inroads against the Iberians and the Kushans, with the Hittites just east of Kausambi city)...
Even launching a maritime invasion on the other side of the world again against the Iberians and this time Egyptians!
I attached my last save game in case you are able to open this one.
It may also be the case that you were just unlucky, and the food add didn't trigger before your unit was killed. This has happened to me. But I'll take your suggestion of a popup into consideration!
To be honest, in my play through, I didn't really pay much attention to the Sheperd/Woodsman units. They didn't 'chirp' very often and when they did, it was never really clear what city they may have added their bonus or even how significant it was. It's also not clear if there is a maximum range for them to operate from your cities before the effect is nullified altogether.
Finally, I noticed there are many units for which you are removing the health bar (Settlers, Sheperd, Woodsman, etc). I'm just curious as to why you took this approach?
EDIT: One final note, I noticed that the Coastal Fortress doesn't appear to trigger when a city is attacked by a naval unit (I came across a similar situation when play testing civ2units Reformation scenario but we couldn't figure out why). I checked the ToTPP Configuration screen and none of the disable dialogs boxes are checked. Have you, or anyone else, experienced the same problem with your mod (or other scenarios)?