[Question] What is the best / most modular way of changing building effects?

Depending on how much I enjoy FE and how much point I see in doing this after playing the game for a while, I might see if I can mod the building effects in an interesting way.

What I want to try out is adding to (almost) every building an effect that kicks in when the city is idle, and for the buildings that already have an when-idle bonus add something else. If possible, I want to do this in as non-invasive and modular way as possible, so that it doesn't break anything else and would work with balance patching without immense amount of work to get it running again.

I really like the concept of having an effect when the city is idle, and would like to expand that to a point where you think a lot about building new buildings as you sacrifice the idle benefits of everything while you're building. It might be a pain to balance, but I find this as an interesting little project to try out and help the community with.

So, my question is, if I begin work on this, what are the more advanced things I have to keep in mind to pull it off as well as possible? Of course this applies to a lot of modding so I hope answering this might help others, too. I'm a decent programmer (without XML experience), so I'm most intersted in the finer points, things to avoid and modularity, as I don't think I'll have problems with actually making the effects happen.

Thanks.

6,869 views 5 replies
Reply #1 Top

Making a modular change to improvementtypes is actually really easy. You can add effects, sometimes modify existing ones and sometimes remove them.

When making a modular change to improvementtypes, what you need to realize is that all the building's effects are still in place. That's it.

Let's say I want to make a workshop increase gildar income by 10% if the city is idle (its production is going to waste). All I need is this:

    <ImprovementType InternalName="Workshop">
<GameModifier>
            <ModType>ResourceMultiplier</ModType>
            <Attribute>Gold</Attribute>
            <Value>1</Value>
            <PerTurn>1</PerTurn>
            <IsProductionQueueEmpty>1</IsProductionQueueEmpty>
            <Provides>+10% Gildar when the city is idle</Provides>
            <UpgradeComparisonID>3</UpgradeComparisonID>
            <UpgradeComparisonTooltipValue>1.1</UpgradeComparisonTooltipValue>
            <Calculate InternalName="Calc" ValueOwner="OwnerCity">
                <Expression><![CDATA[[IsProductionQueueEmpty] * 0.1]]></Expression>
            </Calculate>
            <Calculate InternalName="Value" ValueOwner="OwnerCity">
                <Expression><![CDATA[[Calc] + 1]]></Expression>
            </Calculate>
</GameModifier>
</ImprovementType>

since the Workshop can be upgraded you'll also need to do a similar modifier into the Mason, Mill, Slave Pen and Labour Guild. Remember to keep the <UpgradeComparisonID>3</UpgradeComparisonID> the same. It should be unique for your modifier, ie not the same as one used for those buildings already.

If your intent is to change an existing modifier, or remove it, you should act as if you are counter-acting it. If a building produces 3 gildar per turn and you want it at 0, you need to do a new modifier that removes 3 gildar per turn.

+1 Loading…
Reply #2 Top

Thanks, that's a thorough answer and very helpful.

I guess tooltips are updated to include info from all modifiers from the building? If you put in a counter effect like the -3 gildar/turn you mentioned, will the tooltip display both the +3g and -3g per turn info? Or is it smart enough to realize the net effect is 0 and not include that in tooltips?

Reply #3 Top

It is not smart enough to do that.

You could experiment with giving your new modifiers the same ID as the old ones, just to see what happens.

Reply #4 Top

Also, are there any limits / effects as to how big a value the UpgradeComparisonID is? To avoid conflicts with other mods, should I just use a arbitrary value, say 36 for all of my changes?

Reply #5 Top

Good thinking. I don't know.