PDA

View Full Version : Free Upkeep in Castles



Fat Buddha
01-21-2007, 00:08
Anyone know what it would take to have castles accept the free upkeep attribute?

I am trying to have some free upkeep units in cities and others in castles. Any thoughts?

Thanks

Foz
01-21-2007, 01:26
Well for the unit portion of things, I don't think it's possible to differentiate between units that can be free in a castle versus ones that can be free in a city - there's just the one attribute, free_upkeep_unit. However, units do not become free upkeep unless the particular settlement can actually build the given unit, so this will in fact give you a way to differentiate between city-free and castle-free units, as almost nothing is able to be built in both. Thus in the case of say the English, town militia would never be free upkeep in a castle as they can never be recruited there, and likewise units like dismounted english knights would never become free in a city as the city will never be able to recruit them. So really, that fact should be perfect for your purposes.

As for the castles giving free upkeep, this should be as simple as adding a line like "free_upkeep bonus 3" to the "capability" section of each level of castle wall in the file, of course substituting in the number of free upkeep slots you intend that castle level to give. The castle and city walls are the first few things that appear in the export_descr_buildings.txt file, and so should be easy to locate.

Fat Buddha
01-21-2007, 02:17
Thanks, worked like a charm.

Im trying to force the campaign AI to build up armies for war but disband them afterwards. To that end im significantly increasing the maintenance cost of armies and hoping it will be smart enough to know it has to disband units if it wants to build. With luck this will be all it takes and i wont have to poke around the "I" aspect of the AI to make this work. In all likelihood it wont be that easy.

thanks for your help

Fat Buddha
01-21-2007, 05:34
In case anyone is curious. It doesn't appear that the AI is willing to disband a unit for any reason.

Any guesses as to where this behavior may be changed?

Thanks

alpaca
01-21-2007, 14:44
In case anyone is curious. It doesn't appear that the AI is willing to disband a unit for any reason.

Any guesses as to where this behavior may be changed?

Thanks
Probably not at all. Such stuff is usually hardcoded.

Fat Buddha
01-21-2007, 23:57
Probably not at all. Such stuff is usually hardcoded.

Unfortunate. Oh well.

Thanks

Snipafist
01-22-2007, 00:06
Unfortunate. Oh well.

Thanks

I believe this is one of the areas where the computer's psycho-aggression in the vanilla diplomacy works to its own interests. It ensures that old units get killed off and will be replaced with higher quality units. Unfortunately, it also ensures the AI gets into half a dozen wars and gets torn to pieces and is impossible to reason with, so I'd call it a net loss.

SilentResident
01-26-2007, 11:44
An way is to mod the export_descr_buildings.txt file.

Simply, add the (without the "")
" free_upkeep bonus 9 requires factions { byzantium, } "

in the capability of all the Core Buildings / Walls and you will get free Upkeep for more units per settlement.

R'as al Ghul
01-26-2007, 12:45
However, units do not become free upkeep unless the particular settlement can actually build the given unit, so this will in fact give you a way to differentiate between city-free and castle-free units, as almost nothing is able to be built in both. Thus in the case of say the English, town militia would never be free upkeep in a castle as they can never be recruited there, and likewise units like dismounted english knights would never become free in a city as the city will never be able to recruit them.

Yes, but what if you move a city-recruited unit into the castle?
As you've said, the attribute "free_upkeep" is connected to each unit. Once you mod a free upkeep slot for castles I don't see how you want to prevent city-units to hang out in castles for free.
I'm not saying that's a bad thing but it won't work as you suggest!?

R'as

FactionHeir
01-26-2007, 13:07
jousting lists and training grounds are supposed to give castles the free_upkeep capability but so far moving any unit into the castle or building any unit type didn't actually trigger that capability.
Does that mean that it is inherently bugged?

R'as al Ghul
01-26-2007, 13:41
Does that mean that it is inherently bugged?

In the vanilla game (and LtC) there's an entry "free upkeep bonus 1" at the wooden castle level. All other castle levels don't have that line.
Without testing I'd assume that if you add those lines to the other castle line structures like motte_and_bailey, castle, etc. it should work. Judging by the edu file it was intended for castles to have free upkeep slots.

R'as

Foz
01-26-2007, 20:07
Yes, but what if you move a city-recruited unit into the castle?
As you've said, the attribute "free_upkeep" is connected to each unit. Once you mod a free upkeep slot for castles I don't see how you want to prevent city-units to hang out in castles for free.
I'm not saying that's a bad thing but it won't work as you suggest!?

R'as
You missed what I said earlier, and that is that the unit only becomes free upkeep if it can be recruited at the current location (we know this is the case because spear militia do not become free upkeep in a town until you build the building that lets the town recruit them). No city units are castle recruitable, ergo they can never be free upkeep there.


jousting lists and training grounds are supposed to give castles the free_upkeep capability but so far moving any unit into the castle or building any unit type didn't actually trigger that capability.
Does that mean that it is inherently bugged?
See what I posted as reply in the bug thread. The gist is that they don't work because none of the castle-recruited units can be free upkeep (in the EDU this is set) so you get the free upkeep slot, but it's useless since no unit that is produced in a castle is also allowed to be free upkeep.


In the vanilla game (and LtC) there's an entry "free upkeep bonus 1" at the wooden castle level. All other castle levels don't have that line.
Without testing I'd assume that if you add those lines to the other castle line structures like motte_and_bailey, castle, etc. it should work. Judging by the edu file it was intended for castles to have free upkeep slots.

R'as
Yup they'll have free upkeep slots then, but they won't do anything until you designate some castle-recruited units as free upkeep capable. The actual attribute is free_upkeep_unit, and you'll need to add it to anything that you want to allow to be free upkeep in a castle (again, the unit has to be able to be produced at that castle to become free upkeep).

Hope that helps everyone.

R'as al Ghul
01-27-2007, 10:51
You missed what I said earlier, and that is that the unit only becomes free upkeep if it can be recruited at the current location (we know this is the case because spear militia do not become free upkeep in a town until you build the building that lets the town recruit them). No city units are castle recruitable, ergo they can never be free upkeep there.


Ah, I see. I wasn't aware of that.

:bow:

Foz
01-27-2007, 19:43
Well, seeing as it's a royal pain in the butt to go through the file and set all the units to be free_upkeep_unit, I wrote yet another of my nifty programs to do it for me (and you!).

Basically this is intended as a fix for the problem where the free upkeep slot from tourney fields doesn't work (due to no castle recruitable units being able to be free upkeep). See the earlier posts of this thread for a complete explanation of the problem. I just tried it myself and had some Sherwood Archers receiving free upkeep in one of my castles :smile:

Here's what happens with the fix applied:

- Castle units can fill free upkeep slots in castles where they can be recruited (i.e. a dismounted gothic knight can be free provided you've built the barracks level that recruits him at the castle you want him to be free at).
- City units can fill free upkeep slots in cities where they can be recruited.
- City units will never fill free upkeep slots in castles as they can never be recruited there.
- Likewise castle units will never be free upkeep in cities since they can never be recruited there.

As a side benefit, this will also make any free upkeep slots that you give to castle walls work correctly too (people have speculated that castles are supposed to have free upkeep slots, because the first level castle DOES have 1 free upkeep slot).

Anyway, here's the file patcher: http://www.goldeneaglecomics.com/Files/Free Upkeep.exe

Put it in the directory with your export_descr_unit.txt file, run it, and out pops New EDU.txt which you'll have to rename to export_descr_unit.txt after you've backed up your old one. Enjoy!

R'as al Ghul
01-30-2007, 15:13
Hey Foz,

I totally missed this post. Thanks for your .exe file. It's appreciated.
Now, for me and others that do follow this, I still need to edit the export_descr_buildings.txt to enable the upkeep slots for castles, right?
In vanilla there's only one level of the castle line that has the upkeep bonus, that's the wooden castle. I assume that I need to copy/paste that line into all the other castle levels?

R'as

Foz
01-30-2007, 19:01
Hey Foz,

I totally missed this post. Thanks for your .exe file. It's appreciated.
Now, for me and others that do follow this, I still need to edit the export_descr_buildings.txt to enable the upkeep slots for castles, right?
In vanilla there's only one level of the castle line that has the upkeep bonus, that's the wooden castle. I assume that I need to copy/paste that line into all the other castle levels?

R'as
You're quite welcome.

Yes you'll need to edit the export_descr_buildings.txt file if you intend to have upkeep slots granted in castles by anything other than the wooden castle and any tourney fields you've built. Personally, I made the 2nd through 5th castle levels grant 1 to 4 upkeep slots respectively, taking the 1 slot that the 2nd level castle has to indicate intent of an upward scale from there. It seems only fitting since I don't think the lowest level castle recruits anything at all (therefore no use for upkeep slots), and the castle units typically have higher upkeeps than the militia units, so 2 less free upkeep slots in a castle than the same level city would have seems to make the free upkeep slots about balanced in amount they'll give you free.

R'as al Ghul
02-03-2007, 10:34
I've tested this now and it works even with savegames.
It's a very nice change. I think this is as intended by CA.
I'm not far enough into the campaign to give an educated opinion but having those free upkeep slots certainly does help my economy and so I suppose it does the same for the AI. It may even encourage the AI to keep some good troops garrisoned in castles.
:medievalcheers:

Suraknar
03-05-2007, 06:54
So far the AI seems to keep 1 unit in castles...as per vanilla, has been a breeze taking over citadels and I play at VH-VH (no boasting intended, just stating observable fact).

Thank you Foz and everyone for this discussion here, I am gonna change this for castles. And see how it goes :)

As for the economy I agree it will help, I usually just mod the faction I intend to play with to start with several million coins, but I noticed many nice changes in M2TW from CA to address economical issues, so I am trying this Vanilla...still..I am in financial trouble by turn 50.

Pode
04-13-2007, 00:59
Unfortunately it does not appear to be design intent, as the abberrant free upkeep castle line is missing in the leaked 1.2 I got. Shame, it seems to be a great idea, and I'll be using this mod.

Huskerchaos
05-11-2007, 17:59
Does this still work after patch 1.2? I'm sure it does and I've screwed something up, but I don't notice this working after making all the above changes.

Does the free castle unit's look the same as the city (the blue background) or show the same mouse over message?

Thanks-I'd really like to get this working.

-Amon-
06-12-2007, 11:33
hi there !

i download freeupkeep.exe,when i run this an error screens comes up to screen like "freeupkeep.exe blah blah with error..do you want to send a report? 1-send an error report 2- don't send."..

any solutions?

barocca
06-12-2007, 12:08
make doubly sure the exe is in the correct folder
in the directory WITH export_descr_unit.txt - it needs to read that file to create the output file.

B>