Adding a yield that gives great person points

Johan de Witt

Prince
Joined
Jun 28, 2005
Messages
415
Hi there, I have a question regarding a mod I am making.

I would like to add a yield that adds directly to great person generation. Is there a way to do this? I can't find anything in the XML's and I'm not really good with Lua (yet).

Moderator Action: Moved to the main forum.
Because the tutorials subforum is only for tutorials, not for questions ;).
 
No, you can't do this in XML. You CAN do it in Lua, but like pretty much everything else, there's no way to tell the AI that this'll happen. So if you're intending for these GPPs to be instead of some other yield, then the AI will make its decisions as if there were no GPPs involved.
 
Isn't it possible to direct the AI through flavors?

Only for those things where the AI actually uses Flavors. Some tables don't HAVE Flavor declarations, and others (such as Specialists and Improvements) don't seem to use the ones they have. No matter what Flavor you give a Specialist, the AI will only use it if it thinks it gains more yields by using the specialist than it'd get from working a tile instead. The Flavors are ignored, and the AI simply goes by the known yields (and specialist-generated Great Person points) of each.
Likewise, when the AI's deciding whether Improvement A on a tile should be replaced by Improvement B, it compares before-and-after yields to see whether it's worth doing at all; if A was adding something like Happiness, Great Person Points, or some brand new yield you've added, then the AI will see A as worthless and replace it with B regardless of what Flavors you use.

Also, Flavors have limitations. The AI makes its grand strategy decisions based on a lot of non-Flavor factors, so anything you do through Lua after-the-fact simply can't be taken into account. For instance, let's say you've added a supplementary system that adds 10 Happiness to each player while in a Golden Age, through a simple Lua override. So far so good, right?
Okay, what happens when a player is sitting at -5 Happiness from its normal sources? A Human would know that it's okay, that the +10 will bring you up above zero. A Human will also know that in eight turns, that's going to end, so you need to be building Happiness-producers, but there's no need to rush any of them. An AI won't have either of these; it'll react to the -5 the same way it would in a normal game, i.e. emergency Happiness-boosting methods like rushing a +Happiness building, turning on Avoid Growth, and so on). During the GA's duration those actions are unnecessary, and it won't change its behavior once the GA ends.

You can get around this somewhat by using hidden buildings (so the +10 Happiness I mentioned is managed through an actual building in your capital that adds +10), but it still won't work perfectly. (As before, it won't understand that that bonus can/will go away at some point.) And if you're adding an entirely new Yield, then none of the existing AI methods will value it correctly.
 
I'm not sure how it will impact the AI, but I am planning to add a yield next to food that gives regular soldiers.

So the more food you collect, the more basic soldiers you get. I know it's quite different from what the AI usually does to produce a military, but I could still make it want to produce much more food when going offensively?
 
So the more food you collect, the more basic soldiers you get. I know it's quite different from what the AI usually does to produce a military, but I could still make it want to produce much more food when going offensively?

No. I'm trying not to repeat myself, but for many things, Flavors do not matter. The AI uses them when deciding which building to build, or which unit to build, but it does NOT generally use them when evaluating things like tile yields on individual tiles, so when trying to decide between using a 2-food tile and a 1-food, 1-production tile, you can't make it suddenly decide to see the 2-food tile as considerably more valuable (which it would be under your system). Likewise, in normal AI behavior you can't make it suddenly think that a +1 Food farm is now more valuable than a +2 Gold trading post.

There are grand strategy / city strategy entries that CAN be used to make certain Flavors seen as more valuable, but they're VERY dangerous to mess around with. For instance, in the CityStrategies file, there are two tables that can be adjusted to modify how the AI sees certain Flavors, but it's a very on/off thing; you don't want cities going into emergency "need food improvements" mode every time you want to build a unit.
 
Top Bottom