Iamblichos
Prince
Is there a way to get all military units of a specific civ to build a specific improvement? I see the Unit:CanBuild function but I assume this applies to units that have a workrate value?
http://www.picknmixmods.com/
whoward69's dll has a mod component which has these units building improvements and founding cities as they ought.
Links at
HTML:http://www.picknmixmods.com/
Just for clarification (though it may only be me that's confused), your idea is rather than make unique versions of every unit for the civ (still not completely awful with SQL, but more than a couple lines), just give every unit the ability, and then turn it off with Lua where it's not wanted?Player and Unit CanBuild event handlers are ONLY called as an additional check to see if something can be built on a plot. If the unit can't build the thing, they will never get called, so every unit that can possibly build the thing will have to a) have a workrate and b) have an associated build. However, SQL can be used to make such updates in only two lines.
Player and Unit CanBuild event handlers are ONLY called as an additional check to see if something can be built on a plot. If the unit can't build the thing, they will never get called, so every unit that can possibly build the thing will have to a) have a workrate and b) have an associated build. However, SQL can be used to make such updates in only two lines.
-Yep-Just for clarification, rather than make unique versions of every unit for the civ , just give every unit the ability, and then turn it off with Lua where it's not wanted?
Just for clarification (though it may only be me that's confused), your idea is rather than make unique versions of every unit for the civ (still not completely awful with SQL, but more than a couple lines), just give every unit the ability, and then turn it off with Lua where it's not wanted?
Thanks, yes I indicated in my first post that I already knew how to accomplish this. This also requires a few more edits though in Unit_AITypes and Unit_Flavors, if you want the AI to be able to have interest in doing the improvements. Not interested in doing in that for several reasons, namely ALL civ military units will behave this way even if they are a different civ. They might be blocked from making the SpecificCivRequired improvement, but I don't find that to be all that clean of a method. I opted, to change those tables for two units, but a better way might be to modify the DLL for a Trait that can enable such behavior without it grabbing all military units for all civs at all times and at all places.I believe you can do it without using Lua - in the Improvements table there are columns called SpecificCivRequired and CivilizationType. They are used for the existing unique improvements like Kasbah, Feitoria, Chateau etc. So you can achieve your goal by doing the following:
1. Give all military units a WorkRate.
2. Give them the Build that builds your improvement.
3. Set that improvement as available only to a specific civ by using SpecificCivRequired and CivilizationType.
(As whoward69 noticed, for points 1 and 2 you only need a few lines of SQL code.)
This also requires a few more edits though in Unit_AITypes and Unit_Flavors, if you want the AI to be able to have interest in doing the improvements.
Changing those values will have no effect on military units attempting to perform work actions, as, without a DLL mod, the AI never considers units with a combat value for tile improvement duties.