No World Wonders for AI mod?

mike20599

Chieftain
Joined
Oct 23, 2010
Messages
17
Does anyone know of a mod that prevents the AI from building any of the world wonders, or know of an easy way to prevent them? Thanks.
 
I know of no such flag that would prevent the AI from building a building, so I think this is impossible.

Maybe you can try to find something in the HandicapInfos.xml. CreatePercent maybe??? I'm not too sure.
 
You can try going into each Civ's leader file and lowering their individual Wonder Flavor. That should at least make them less inclined to build wonders.
 
^ of course the simple solution slipped my mind.

Yeah just set all the leader FLAVOR_WONDER to 0.

(oh, and also set WonderCompetiveness to 0 too)
 
I suppose you could also go to AI strategies and simply change them to never build wonders, either by removing the necessary scripting to do so or by adding a script so they don't.
 
I tried changing FLAVOR_WONDER and WonderCompetiveness to 0, but that didn't work. I don't think I know enough about modding to try any scripting changes.
 
The only non-LUA way to do it that comes into my mind is to set AIWorldConstructPercent in HandicapInfos to a very high value...
 
Actually, now that I think about it, you can probably use <Civilization_BuildingClassOverrides>.

Just set it to something like this:

Code:
	<Civilization_BuildingClassOverrides>
		<Row>
			<CivilizationType>CIVILIZATION_SPAIN</CivilizationType>
			<BuildingClassType>BUILDINGCLASS_PETRA</BuildingClassType>
			<BuildingType/>
		</Row>
	</Civilization_BuildingClassOverrides>

But you'd have to do one for every wonder for each civ, so it'd be kind of tedious. It's how the game stops City States and Barbarians from building wonders.
 
You can do in SQL, using less code than that. But this method only makes sense if always the same civs are played by the AI.
 
The only non-LUA way to do it that comes into my mind is to set AIWorldConstructPercent in HandicapInfos to a very high value...

So basically they will still try to build them but if I put in 10000 for AIWorldConstructPercent, it will take them 100x the normal production cost?
 
AI should ignore building anything that takes them more than 50 turns to complete.
 
Wouldn't setting wonder flavors to 0 still result in the AI building it sometimes? I thought the flavor values were randomized within a range of 2. If you set the flavor to -2, that may work.
 
You can do in SQL, using less code than that. But this method only makes sense if always the same civs are played by the AI.

Well, I was implying he would make an entry for every wonder each time for every civ. So 40 Wonders X 34 Civs, for a grand total of 1,360 entries... which is actually beyond tedious. Though, it wouldn't matter which civs the AI plays, as you would be making entries for all of them. Not exactly feasible, but it is a way to accomplish blocking AI from building wonders completely with just XML.
 
Try setting the current flavors for all wonders to 0 (so if a wonder has a culture, gold, and science flavor, set all of those to 0). The AI will then always look to build something else.
 
Tomatekh said:
Though, it wouldn't matter which civs the AI plays, as you would be making entries for all of them.

Then it would also affect the human player.
 
Well, I was implying he would make an entry for every wonder each time for every civ. So 40 Wonders X 34 Civs, for a grand total of 1,360 entries... which is actually beyond tedious. Though, it wouldn't matter which civs the AI plays, as you would be making entries for all of them. Not exactly feasible, but it is a way to accomplish blocking AI from building wonders completely with just XML.

If you were to do a buildingclassoverride on all wonders for all civs, you could just set the building type to null in every wonder buildingclass, so you just do it once to each wonder. But then the human player can't build it either, so there's no point in doing this.
 
I'm surprised no one mentioned this, but this I found to be the easiest way to do it (in lua):
Code:
-- create dictionary, for quick access
local wonders = { }
for buildingClassInfo in GameInfo.BuildingClasses("MaxGlobalInstances = 1") do
	wonders[GameInfo.Buildings[buildingClassInfo.DefaultBuilding].ID] = 1
end

-- no wonders for AI
GameEvents.CityCanConstruct.Add(function(iPlayer, iCity, iBuildingType)
	if wonders[iBuildingType] and iPlayer ~= Game.GetActivePlayer() then
		return false
	end
	return true
end);
Just putting that in a lua file should do the job.
 
I'm surprised no one mentioned this, but this I found to be the easiest way to do it (in lua):
Code:
-- create dictionary, for quick access
local wonders = { }
for buildingClassInfo in GameInfo.BuildingClasses("MaxGlobalInstances = 1") do
	wonders[GameInfo.Buildings[buildingClassInfo.DefaultBuilding].ID] = 1
end

-- no wonders for AI
GameEvents.CityCanConstruct.Add(function(iPlayer, iCity, iBuildingType)
	if wonders[iBuildingType] and iPlayer ~= Game.GetActivePlayer() then
		return false
	end
	return true
end);
Just putting that in a lua file should do the job.


Doesn't the game need to recognize a new script as part of a mod before it lets the thing run? (Great thinking, BTW; you aren't the only player frustrated by an AI civ snatching a wonder away from his own civ when he was 1-2 turns short of finishing.)
 
Doesn't the game need to recognize a new script as part of a mod before it lets the thing run? (Great thinking, BTW; you aren't the only player frustrated by an AI civ snatching a wonder away from his own civ when he was 1-2 turns short of finishing.)
Well, it does, but I sort of implied that thing.
 
Back
Top Bottom