Help making Garrison unit

woodelf

Bard
Retired Moderator
Joined
Jun 12, 2003
Messages
15,036
Location
Gallery
Is there any place in the XML files to put a max number of a specific unit allowable in a city? I know it can be done globaly, but can locate where it might be done in a city square. I'm hoping to allow 2-3 garrison units that can't leave the city.

Thanks
 
I doubt it can be done by the XML files alone....how do you mean by 'can't leave the city'?

If they can only be built there but not leave, you could require a dummy structure for their construction. Then, a script could detect when X of those units are on a tile, and remove that building from the underlying city. When a unit dies it could re-add the building.

That particular implimentation is likely possible, but I don't know for sure.
 
By can't leave the city I'm going to give it a movement of zero so it has to stay put. I want them to be good city defenders and not much else, but also limit how many get built per city.
 
Do not give them a movement of zero. Make them immobile. If you give them a movement of zero and then try to move them the game will freeze.
 
Okay, but how exactly? If I make the terrain impassable can't they still go by road? I even looked at the ICBM unitInfo.xml and can't see how they made that immobile.

edit : Found the Domain_IMMOBILE spot. Thanks for the heads up
 
To make a max amount in one city I think you need to mess around with python. You should be able to check through every city at the start of every turn to see how many of a certain type of unit it has, and disable/enable the ability to build a new one based on that.
 
Messing around with python isn't likely to happen. I figured it wouldn't be something easy enough for me to do. Thanks for clearing that up.
 
Back
Top Bottom