I have something similar with walls, where I have a series of progressively more advanced walls that take progressively more advanced Artillery units to bypass, so there's an arms race between offensive and defensive technology. But I don't want walls to just vanish when the tech to build better ones is developed and leave cities vulnerable even to things that the older walls would protect against. So I have them set up so that you can no longer
build obsolete walls after the tech for the newer ones is developed, but the walls don't actually disappear until a newer one is actually built in the city.
So my entry for City Walls, which are the earliest iteration, looks like this:
Code: Select all
[building_city_walls]
name = _("City Walls")
genus = "Improvement"
flags = "VisibleByOthers"
reqs =
{ "type", "name", "range", "present"
"Tech", "Masonry", "Player", TRUE
"Tech", "Construction", "Player", FALSE
}
graphic = "b.citywalls"
graphic_alt = "-"
obsolete_by =
{ "type", "name", "range"
"Building", "Curtain Walls", "City"
"Building", "Bastions", "City"
"Building", "Fortifications", "City"
}
build_cost = 60
upkeep = 1
sabotage = 50
sound = "b_city_walls"
sound_alt = "b_generic"
helptext = _("\
City Walls make it easier to defend a city. They give a +200% bonus to the\
defense strength of units within the city against Land and Wheeled units. They are\
ineffective against airborne and sea units as well as artillery units and\
armored vehicles.\
City Walls also prevent the loss of population which occurs when a\
defending unit is destroyed by a ground unit.\
They are made obsolete by Construction and the development of more\
effective Curtain Walls; however, old walls remain standing until new ones\
are built.\
")
Curtain Walls, which are the next iteration up, look like so:
Code: Select all
[building_curtain_walls]
name = _("Curtain Walls")
genus = "Improvement"
flags = "VisibleByOthers"
reqs =
{ "type", "name", "range", "present"
"Tech", "Construction", "Player", TRUE
"Tech", "Military Architecture", "Player", FALSE
}
graphic = "b.city_walls"
graphic_alt = "-"
obsolete_by =
{ "type", "name", "range"
"Building", "Bastions", "City"
"Building", "Fortifications", "City"
}
build_cost = 60
upkeep = 1
sabotage = 50
sound = "b_city_walls"
sound_alt = "b_generic"
helptext = _("\
Curtain Walls make it easier to defend a city. They give a +200% bonus to\
the defense strength of units within the city against Land and Wheeled\
units, as well as Catapults. They are ineffective against airborne and\
sea units as well as gunpowder Artillery units and armored vehicles.\
Curtain Walls also prevent the loss of population which occurs when a\
defending unit is destroyed by a ground unit.\
They are made obsolete by Military Architecture and the development of more\
effective Bastions; however, old walls remain standing until newer ones\
are built.\
")
And so on.
The practical effect of this is that, when you develop Masonry, you can build City Walls (which I'm thinking about renaming "Palisades", because the City/Curtain Wall distinction keeps confusing even me), which protect against most ground units, but can be bypassed by Catapults or any other Artillery unit. When you develop Construction, you gain the ability to build Curtain Walls, which protect against Catapults, but can still be bypassed by Cannons or better, but lose the ability to build City Walls. However City Walls that were already built don't immediately get sold off like Barracks did. They remain, and remain effective, until you actually build Curtain Walls (or Bastions or Fortifications, which are the next iterations, enabled by Military Architecture and Ferroconcrete Construction, respectively) in the city. Even then, it's not until the turn
after the new walls are built that the old ones get sold off. I think the obsolescence check happens before the production check, so on the turn the new walls are built, the old ones aren't yet obsolete when it's checked. You can go in and manually sell them off if you want the cash faster, or just wait until the next turn when they're sold automatically.
I have the wall effects set up to explicitly exclude older walls when there's a newer wall in the city, so they don't double up on the turn between the new ones being built and the old ones being sold off, like so:
Code: Select all
[effect_city_walls]
type = "Defend_Bonus"
value = 200
reqs =
{ "type", "name", "range", "present"
"Building", "City Walls", "City", TRUE
"Building", "Great Wall", "Player", FALSE
"Building", "Curtain Walls", "City", FALSE
"Building", "Bastions", "City", FALSE
"Building", "Fortifications", "City", FALSE
"UnitClass", "Artillery", "Local", FALSE
"UnitClass", "Armor", "Local", FALSE
"UnitClass", "LTA", "Local", FALSE
"UnitClass", "Light Air", "Local", FALSE
"UnitClass", "Air", "Local", FALSE
"UnitClass", "Helicopter", "Local", FALSE
"UnitClass", "Missile", "Local", FALSE
"UnitClass", "Sail", "Local", FALSE
"UnitClass", "Sea", "Local", FALSE
"UnitClass", "Brown Water", "Local", FALSE
"UnitClass", "Green Water", "Local", FALSE
}
(The Great Wall acts as Curtain Walls in all cities, so it overrides local City Walls, but it doesn't force the sell-off of local City Walls like building actual Curtain Walls or better in the city would. It also never goes obsolete, which is my policy for Wonders that are still extant, but it gets a lot less effective as technology improves and more and more of what the enemy's fielding bypasses it.)
Also, annoyingly, the tech-tree skein generator for the Research tab apparently doesn't distinguish between positive and negative tech requirements, so City Walls appear on the tech tree under both Masonry and Construction, with no indication that the latter makes it so you
can't build them. and likewise for the more advanced walls.