Mod-Modders Guide to Fall Further

Wasn't my unit, but I'll try to get a more complete explanation of what he saw happening when he logs in tonight.
 
Back on topic to modding, not bugs -

Things I need to know for the purpose of Food Further

Is there a way to determine how much food surplus or penalty a town has, as well as its population? (I'd think pop would be easy.)

Is there a way to determine if a summoned unit, like a skeleton or Aurealis, has lost its summoner?

Python for both of these is fine. The second one is important for the sake of balance, the first one might let me teach the AI how to USE the food transfer units as well.

EDIT: Of course, if there's a way for me to have a summon die if it's summoner is no longer around (gets deleted, dies, is eaten by a Flesh Golem) in XML, I can make Food Further modular, which would be pretty awesome.
 
You can't really "determine" anything in XML, you can just use prereq fields, and there isn't a "Masterless slave" prereq. Summons die at the start of the turn if their master is no longer alive.

pCity.getFoodTurnsLeft() -- Turns till growth
pCity.isFoodProduction() -- Tells you if food is being used to build junk
pCity.foodConsumption(false,0) -- Tells you how much food the city currently eats per turn
pCity.foodDifference(true) -- Tells you how much spare food per turn the city gains
pCity.growthThreshold() -- Tells you how much food the city needs to grow (total)
pCity.getFood() -- Tells you how much food is stored toward growth
pCity.setFood(int) -- sets the amount of stored food
pCity.changeFood(int) -- adds/subtracts to stored food level
pCity.getFoodKept() -- Pretty sure this tells you how much food is maintained by things like the Granary. That or it tells you how much of that which is currently stored was carry-over from before instead of directly harvested
pCity.getMaxFoodKeptPercent() -- tells you the percent of food maintained after growth


And pUnit.getMasterUnit.isNone() indicates that a unit doesn't have a master. Check it for pUnit.isMustDie() to know if it previously had a master (losing your master forces this flag to be triggered, though there are a few other things which can do it, most of them clean themselves up quickly)
 
I can make that work, I think. I appreciate the help with those tags.
 
Soo... Noticing that merging is a bit more of a pain than usual. :lol: Trimmed a few new files, so now WinMerge won't work correctly. Have to do it by hand. :wallbash:

Yes, this post is entirely to complain. :lol:

Edit: Actually, turns out the problem is that the old file had spaces, rather than tabs, and WinMerge can tell the difference.... Did a simple Find/Replace, and it works now. Any reason the older files used spaces in the first place?
 
Yeah, sorry about the trimming. Generally if you trim your own corresponding file then it is pretty easy to merge together again. There are a few which we trimmed. Using Find/Replace with Notepad++ makes trimming pretty quick.

Lots of the old files used spaces all over, I think the default Firaxis had them, that or Kael's excel exporter pops them out with spaces instead of tabs. I try to zap spaces when I find them, used to avoid them for precisely the issue you just had, pain to merge against FfH updates. But now that we don't merge back, I zap leading spaces when I notice them.
 
You mean that spaces and tab are differently handled in XML?

BTW, when merging the source code, I frequently notice that some lines differ only with a space or a tab. Does this screw up the code or not?
 
XML ignores tabs and spaces (you could literally not use an in an xml file, and have everything written on a single line if you want to be mean to other modders), but the merging tools don't.

Python cares about it more. It can actually run fine if spaces are used instead of tabs, but mixing the two up can cause some problems. IDLE hates spaces, yet oddly its recommendation of how to fix mixing tabs and spaces is to turn every tab in the document into spaces, which makes you need to go though every line of the code to change them back by hand. To make things worse, there doesn't seem to be a way to make it display the tabs and spaces differently so it is really easy to loose your place.
 
I'm working on a module to allow normal units to become commanders, and I have two questions:
1 - Is there someplace that actually explains, from step one, everything involved in creating a module using the new system? Everything I've found is about new capabilities.
2 - How will allowing Arcane units to command other units interact with the new system for Dominate? Are the dominated units treated just like other followers (aside from the "can't leave the commander" feature), or are there other things going on behind the scenes that I'll need to account for?
 
There isn't a step-by-step on creating modules in the new system from the ground up. I will see if I can find my old walkthrough on how to build a module and spruce it up a bit. If someone else has it bookmarked and laying around they might swing by and provide a link. There are probably also some tutorials in the main tutorial subforum as well.

The Dominated units would count against your command limit, but you would be able to continue to dominate units while commanding your limit worth of other units. The only big difference with the dominated units is that you cannot delete them. You should still be able to have them leave the commander, but if they do leave they return to the previous owner's control. Also if their commander dies they return to control of the previous owner. Though if that player is dead, then they become a normal unit under your control.
 
There isn't a step-by-step on creating modules in the new system from the ground up. I will see if I can find my old walkthrough on how to build a module and spruce it up a bit. If someone else has it bookmarked and laying around they might swing by and provide a link. There are probably also some tutorials in the main tutorial subforum as well.
I'll try to puzzle it out through trial and error in the meantime, then.
The Dominated units would count against your command limit, but you would be able to continue to dominate units while commanding your limit worth of other units. The only big difference with the dominated units is that you cannot delete them. You should still be able to have them leave the commander, but if they do leave they return to the previous owner's control. Also if their commander dies they return to control of the previous owner. Though if that player is dead, then they become a normal unit under your control.
That's what I needed to know, thanks! My main concern was that I would somehow break Dominate by giving the Archmages access to a normal command limit.
 
It'll likely be a while till I can write up much, so I will say that the MAIN important thing is that you need to have the *.schema file which is referenced at the start of the XML you are using in the module in the SAME FOLDER as the XML file. Otherwise nothing works.

Hrm.. other thing is that folder structure doesn't matter, you can slap everything in a single folder if you want, or you can place everything in subfolders to sort it out. You MIGHT need an MLF if you use subfolders, I didn't test that out that I can remember right now.

Also avoid using spaces in your folder names and any DDS names, if any of the DDS are used for promotions. It messes them up to have spaces in the name.

Rename all files to be *_%n.xml, where * = anything you want and %n = original XML filename. If you rename the schema (don't think you HAVE to, but it is good practice) then make sure to point that line early in the XML file at the new name.



If an Archmage had a Command Limit, dominate would work wierd and annoy people:

Archmage has command limit of 3, 3 adepts follow him, he goes out and Dominates 3 heathens. Now 6 units follow him. One of the Adepts dies. He has 5 followers, so nobody can join him.

Archmage 2 has command limit of 3, nobody is following him, he goes out an dDominates 3 heathens. Nobody can choose to follow him, because he has 3 followers already.



HOWEVER, you could re-write how Domination works so that it increases your command limit by 1 when it attaches the dominated unit to you. Then write a function in onUnitKilled which finds out if the unit had a commander and was assigned a "previousOwner", that indicates taht it was dominated, so you go reduce the prior commander's command limit by 1 slot.


That should make thing works for you.
 
If an Archmage had a Command Limit, dominate would work wierd and annoy people:

Archmage has command limit of 3, 3 adepts follow him, he goes out and Dominates 3 heathens. Now 6 units follow him. One of the Adepts dies. He has 5 followers, so nobody can join him.

Archmage 2 has command limit of 3, nobody is following him, he goes out an dDominates 3 heathens. Nobody can choose to follow him, because he has 3 followers already.

Just a little thought. I would find that system neither wierd, nor annoying. I don't see any reason dominate should allow commanding things beyond your command limit. Having to use up one of your command slots to hold the dominated victim, would be a good counterbalance to the power of the spell. Aside from that, Mind III could AllowPromotions all the Command limit boosting ones, so you could spend xp to become better, and essentially specialise an archmage in dominating heroes, immortals, and other big scary things.
 
I just hadn't wanted to give Archmages Command slots, since that allows "easy access XP" for them. So you could rewrite Dominate to require free command space instead of limiting it to a certain number of dominated units. Would be a pretty easy rewrite. I'd reccomend you make Mind III itself give +1 Command Limit, maybe also MetaMagic III and Spell Extension III, rather than allowing access to the Commander Promotions for the limit boosts. Though that would mean that a Meta II + Spell Extension III archmage without Mind III would still have 2 Command Slots. Well, unless you use an effect promotion which required MetaIII+MindIII or SEIII+MindIII and granted the bonus Command Limit only then.
 
About Domination, what do i have to change to up the amount off units one can dominate. i think 3 is too few.
Also when you have an archmage who commands 3 units and you cast lichdom ,you loose the units you where commanding. just lost Mizquitzli this way
 
The limit is set in python, CvSpellInterface.py.

Hadn't considered upgrading and minions, I'll have to take a glance at precisely how that messes up. Might wind up being more of a hassle than it is worth and we'll just say that such a radical transformation disrupts your concentration ;)
 
Quick question: Can you apply a promotion through python to a unit who can't usually get that promotion? (for example, giving March to an Adept)
 
Back
Top Bottom