AI has hardcoded commando powers on all mounted units

HotFusion

Chieftain
Joined
Dec 15, 2009
Messages
69
I saw that this mod adds a free commando promotion to all mounted units, which I didn't think sounded fun at all. So I edited the xml and removed it. But, AI mounted units can still use my roads, even though they don't have commando. This innate power doesn't show up on their unit summary, and my own units don't get this power. It looks like it was hardcoded :crazyeye:

Is there a way to fix this?

EDIT: Okay, I found a workaround. Apparently, the mod really is granting the AI am invisible commando promotion to its mounted units. I went into CIV4PromotionInfos and changed <enemyroute> from 1 to 0, effectively breaking the Commando promotion. I went back into the game, and the AI's elephants are no longer moving 3 tiles a turn in my territory. I then completely removed the now-broken commando promotion from the game by setting its techreq to TECH_SPECIAL_PROMOTION.

You can restore commando's old functionality by creating a new copy of the commando promotion and giving it a new name (I called it Commando2). This new promotion will look and function exactly like the old one in the game (even the title is the same, because we only changed the xml name, not the text string name), but it won't get accidentally (?) added to the AI units.

Personally, I decided that the game is better off without Commando at all. It was tolerable back before Warlords, but now it feels like a cheat code. I made sure that units that should have it (e.g. spies) got the new commando2 promotion, but set the techprereq to TECH_SPECIAL_PROMOTION for both versions.
 
So it turns out that the problem is more pervasive than I thought. I just noticed that AI spearman (and apparently only spearman) can use hostile roads, but only actual "roads" (e.g. the improvement enabled by Monarchy). They do not get this ability when I use paved roads. Other contemporaneous units, such as archers, do not get this ability at all.

There may be other unit/route combinations that have this issue.
 
Wow, that explains a lot. I did the same thing you did, and was having a very hard time figuring out how the AI was deepstriking my cities. I had just assumed it was caused by something remaining in the cache rather than hardcoding though, I'd only played one game after my 'no free commando for horses' tweak.
 
There is definitely some weird stuff going on here. Even after my fix, the problem still appears, although less often. It could indeed be a cache problem like you say. That would explain the random and inconstant nature of the issue. I just deleted my cache, and we'll see if that helps.
 
This issue made me quit my current game in anger, it's too f'ing annoying to deal with small packs of horses far inland every. damn. turn :mad:
 
I've also experienced this in a game last night, though I had no idea that they were actually supposed to be hardcoded. I couldn't figure out how the AI could consistently penetrate units into my interior to destroy my workers (which seemed to be their key targets). Furthermore, I observed this occuring with riflemen and grenadiers and not just cavalry. I only pinpointed it as a real issue when I saw a large stack of grenadiers (with one or two units of cavalry) move three tiles through my territory. I believe it was either roads or paved roads which they had traveled on. Anyway, the issue is fairly gamebreaking at the moment, though with a few other minor exceptions the current beta seems to be the most stable and well-rounded release yet.
 
How to fix this! Its so freaking annoying that they can run in my territory just like that! They destroyed 3 of my 8 Cities JUST LIKE THAT! Only because I didn't think they could run that fast in my area with their damn crossbowmen
 
How have you given it to spys then?
 
This commando thing is close to being a game breaker! Is there no one, excepting maybe guru "Afforess", that can fix it? How about those of you that have friends that work on other Mods (C2C example) could those folks help.

This great mod may likely live and die with this issue.

Buck
 
Since when does the bug exist ?

The svn log of the mod has a suspicious entry:
Code:
------------------------------------------------------------------------
r561 | afforess | 2012-01-21 23:33:46 +0100 (Sat, 21 Jan 2012) | 1 line

[B][U]Pathfinding[/U][/B] and memory changes from Koshling + AIAndy
------------------------------------------------------------------------
r557 | afforess | 2012-01-20 02:10:58 +0100 (Fri, 20 Jan 2012) | 1 line

Major update, bug fixes, C2C DLL merge
------------------------------------------------------------------------
(current revision is r570)

I looked at the diff of the sources between r557 and r561 but there was nothing dealing with movement cost. Maybe looking at the changes before or after that will reveal something.

On the other hand, I currently have no tool chain to compile any changes done to the sources ... :rolleyes:
 
CIV4UnitSchema
<element type="bEnemyRoute" minOccurs="0"/>
change to
<element type="bEnemyRoute" minOccurs="-1"/>
Afforess_CIV4UnitSchema
<element type="bEnemyRoute" minOccurs="0"/>
change to
<element type="bEnemyRoute" minOccurs="-1"/>
Would this do anything?

CIV4PromotionInfos
Change all
<bEnemyRoute>1</bEnemyRoute>
to
<bEnemyRoute>0</bEnemyRoute>

*U right click and edit on these files and control-f for find. eg. control-f <bEnemyRoute>1</bEnemyRoute>
 
why would you edit the xml schema file ?
And is a value of -1 for minOccurs even allowed ? (if it is xml schema it might not but I don't know if civ4 even uses a conforming schema validator)

Anyways, I wanted to try your suggestion but when I created a testgame I didn't even notice the bug anymore, even without doing any changes beforehand. Weird.
 
It worked in a way that it was possible to work around the bug with your suggestion, but it made the civic useless unfortunately.
 
This is strange. I tested it in a quick game which I set up with World Builder and enemy units (Spearmen, Warriors) where not moving through my territory with any abnormal speeds.

But in my current savegame I had an enemy stack wondering around inside my borders and while Macemen and Trebuchets where limited to 1tile/turn I *think* that a Crossbowman travelled 2 tiles in one turn.
I didn't check this on the mounted units though, they still have the commando promotion for me and are therefore allowed to move faster through my territory.
 
This is strange. I tested it in a quick game which I set up with World Builder and enemy units (Spearmen, Warriors) where not moving through my territory with any abnormal speeds.

But in my current savegame I had an enemy stack wondering around inside my borders and while Macemen and Trebuchets where limited to 1tile/turn I *think* that a Crossbowman travelled 2 tiles in one turn.
I didn't check this on the mounted units though, they still have the commando promotion for me and are therefore allowed to move faster through my territory.

I have already tested this around 5 times with my friend in Hot Seat multiplayer game. The enemy units have moved in mud roads and paved roads faster than they should. So far they have been spearmen, crossbowmen, horsemen, longbowmen ect. Almost every possible unit. I have made sure, that they DO cheat. I see a soldier on 1 tile. I press enter and next turn it has moved atleast 2 tiles or more, depends on the road.
 
I have already tested this around 5 times with my friend in Hot Seat multiplayer game. The enemy units have moved in mud roads and paved roads faster than they should. So far they have been spearmen, crossbowmen, horsemen, longbowmen ect. Almost every possible unit. I have made sure, that they DO cheat. I see a soldier on 1 tile. I press enter and next turn it has moved atleast 2 tiles or more, depends on the road.

I believe you. I think I tested it mostly with paved roads although I also had an area with normal roads. But it was smaller and maybe I missed the issue there. Will give it another attempt.
 
I cannot really reproduce the error with a game set up in world builder. I will attach the savegame here so that maybe somebody can tell me if I'm missing something.

what the save basically does is to have an ai unit that sits in my territory and wants to travel back to it's own city. I'm at war with the other player. the unit travels across normal roads, I also tried cart paths and paved roads instead. The unit used is a crossbowman but I also tried a spearman, swordsman, regular infantry and several others
The enemy unit doesn't try to pillage or anything it just tries to move back towards its own city at 1 tile/turn speed.

I also tried giving them technologies in world builder to see if one of those provides some false bonus but it didn't change anything either.

I tried to lure the unit to attack my own city to provoke other ai functions being called ( unitAttackMove() for example ) but it won't attack me, even on deity and even when I gave them strong advantages and removed all my city defenders.

So a save in which pressing 'end turn' will have an ai unit move at abnormal speed would be great.
 

Attachments

Back
Top Bottom