Elucidus
Jan 04, 2007, 08:15 AM
I was wondering if there is a way to add a tech prerequisite to villages and towns. I mean I know I can add it, it just doesn't seem to do anything. The cottage grows reguardless of whether you have the tech or not.
Any help would be appreciated.
Gaurav
Jan 04, 2007, 09:38 AM
I was wondering if there is a way to add a tech prerequisite to villages and towns. I mean I know I can add it, it just doesn't seem to do anything. The cottage grows reguardless of whether you have the tech or not.
Any help would be appreciated.
I like this idea. But I think some SDK modding would be required.
Sto
Jan 04, 2007, 10:37 AM
Yes , the tech prerequire is not taking in count when upgrading an improvement :
in CvPlot.cpp in doImprovement :
if (GC.getImprovementInfo(getImprovementType()).getIm provementUpgrade() != NO_IMPROVEMENT)
{
changeUpgradeProgress(GET_PLAYER(getOwnerINLINE()) .getImprovementUpgradeRate());
if (getUpgradeProgress() >= GC.getGameINLINE().getImprovementUpgradeTime(getIm provementType()))
{
setImprovementType((ImprovementTypes)(GC.getImprov ementInfo(getImprovementType()).getImprovementUpgr ade()));
}
}
You can add it if you have some C++ experience . But I think you can do that with Python also , using a more extricate way . ( using the event onImprovementBuilt and onTechAcquired , with 3 different improvement set of cottage ) . Using C++ should be more simple :crazyeye:
Tcho !
Impaler[WrG]
Jan 04, 2007, 10:46 AM
Tech pre-requistes for improvments currently only block the building of the improvment, upgrading is unaffected. It should be a simple matter to do. Ok found line of code on CvPlot.cpp, line 505
if (GC.getImprovementInfo(getImprovementType()).getIm provementUpgrade() != NO_IMPROVEMENT)
Ask you can see it just checks to see if an Improvment has an Upgrade and if so it increments the counter, this is within a "do Improvment" function which itself runs only for an improvment being worked which is why you improvments need to be used to upgrade.
The tricky part is that Improvments in themselves dont have any Tech requirment info, rather the "Build" has the requirment and their is not nessarily a one to one corelation between the builds and the improvments, though thats the case with the defaut Firaxis assets. The best solution is probably adding a PreTech tag to the ImprovmentInfo and adding a check for it in the above line of code to prevent upgrade untill the apropriate tech is discovered.
EDIT: Sto beat me too it :(
Vehem
Jan 04, 2007, 01:13 PM
Hmm - if we key improvements to require existing improvements in the tile (upgrading an existing improvement), this could be really interesting...
Workerbuild: Unimproved -> Cottage
Workedtile: Cottage -> Occupied Cottage
Workerbuild: Occupied Cottage -> Hamlet
Workedtile: Hamlet -> Bustling Hamlet
Workerbuild: Bustling Hamlet -> Village (Requires Tech)
Workedtile: Villlage -> Market Village
Workerbuild: Market Village -> Town (Requires Tech)
Workedtile: Town -> Busy Town
If the worker-build times increase dramatically with each improvement, we could change the "cottage-spam-and-forget" strategy to require a more concentrated effort to build busy commerce centres.
Gaurav
Jan 04, 2007, 03:31 PM
Hmm - if we key improvements to require existing improvements in the tile (upgrading an existing improvement), this could be really interesting...
Workerbuild: Unimproved -> Cottage
Workedtile: Cottage -> Occupied Cottage
Workerbuild: Occupied Cottage -> Hamlet
Workedtile: Hamlet -> Bustling Hamlet
Workerbuild: Bustling Hamlet -> Village (Requires Tech)
Workedtile: Villlage -> Market Village
Workerbuild: Market Village -> Town (Requires Tech)
Workedtile: Town -> Busy Town
If the worker-build times increase dramatically with each improvement, we could change the "cottage-spam-and-forget" strategy to require a more concentrated effort to build busy commerce centres.
Micromanagement is what Firaxis was trying to take away with this game.
Trojan Sheep
Jan 05, 2007, 04:15 PM
One less... elegant solution that may serve your needs would be to change towns and villages to provide hamlet gold (easy enough to do in the xml). Then make the tech you want required to "allow" villages and towns, give +1 gold to villages and +2 gold to towns. Should be able to just use printing press as a template for the tech.
Obviously doesn't keep them from actually growing, but it's a possible solution if you're just worried about the extra money.