How does the enemy choose its units?

jimbob27

Emperor
Joined
Mar 2, 2006
Messages
1,430
Location
London
I've modded my game to change some of the units values, and I want to make the AI more aware of this. I thought some of the units like the submarine and nukes were kinda underpowered, so I fixed them..... the only problem is now it feels like I'm cheating whenever I use them, because the AI doesn't seem to realise their effectivness. I'd like to get it so the agressive civ's build tons of nukes, because at the moment they never build any. There must be a value attached to either the civ or the unit, that regulates how often they're built. Any kind of help would be much appreciated.:)
 
If you look in the civ leaderheads (or maybe just the civ) file, you can bias civ's to a particular type of unit. Look at India for an example -- if I'm interpreting it right, they have a bias towards workers (which, honestly, doesn't make sense to me considering they have more efficient, faster-moving if not -working ones -- so I could be wrong).
 
jimbob27 said:
I've modded my game to change some of the units values, and I want to make the AI more aware of this. I thought some of the units like the submarine and nukes were kinda underpowered, so I fixed them..... the only problem is now it feels like I'm cheating whenever I use them, because the AI doesn't seem to realise their effectivness. I'd like to get it so the agressive civ's build tons of nukes, because at the moment they never build any. There must be a value attached to either the civ or the unit, that regulates how often they're built. Any kind of help would be much appreciated.:)

There is an AIWeight value on every unit that you can adjust to cause the computer to be more or less likely to prefer certain units. Since the AI isn't aware of spellcasting ability I have used it in FfH to make sure the AI builds casters as commonly as it does melee type units.

Negative AIWeights also work well if the AI seems to be obessed with a certain unit for no good reason.
 
Cheers for the info guys...... but I think I still need a bit more help ;) I'm kinda new to all this.

Kael, where are these values located? In the leaderheads xml I found something that said <UnitAIWeightModifier> but I'm not sure if these are the ones I want. I changed a load of them to say ICBM but it didn't seem to affect anything.
 
Sorry for being a pain here, but I still can't get it to work. I fiddled around with the <aiweightvalue> in the unitinfo.xml, but I couldn't get it to have any effect.

Instead of creating a mod the usual way, I just backed up and edited the original xml, so I'd be able to load a suitable savegame to test the changes. Do you reckon this has something to do with it? ( I did this cos if I made it the proper way, my save games would be incompatible, so I wouldn't have a game to test the changes with).

I loaded up the game and shift-entered a few turns.... then entered worldbuilder, and still, nobody was building nukes despite all the parameters being met. They all vote no on the nuclear proliferation act..... yet none of them build any.

I tried a few different values in there, because I wasn't sure what would work. I tried 1,2,20 and 600.... and none of them seemed to make the blindest bit of difference. I'm fed up with having wimpy AI!
 
Any more idea's guys? I've been trying to get this to work for ages now, and I still can't get the idiot AI to build a single missile!
 
All of the units have that function set to 0, so I would guess it is non-functional function. :p
 
Top Bottom