I am attempting to mimic the effect for LH using a custom resource created for each city hub like so,
I then added this resource to each city hub using this code,
All of this works and I can see my total city count going up in my global resource pool. The problem comes when trying to use this new resource pool to increase unrest as more cities are added. I lowered the tax base by 10 initially and then set up the following code and it sort of worked,
The problem lies in that it only calculates for the city it is in so it only counts 1 ever. I tried a variation of the shard call request used in most spells like this,
But this did not work, I am kind of stuck at the moment until I can get a hint how to get a total city count that I can then apply as a value to multiply against.
Thanks for any help guys.
Oh I also did not add anything new to elemental.str so not sure whether this matters or not other than for appearances.
Just out of curiosity, where do you get the CityCount and UnitOwner_GetNumCityCount variables from? Did you see them at other code parts? Is there a reference manual somewhere? Or did you just made them up?
I created the custom resource CityCount as a non stored resource copied from the shard mana generation resource. I tried the UnitOwner_GetNumCityCount copying the basic format for spells that get shard counts.
What exactly are you trying to do? If all you want to do is add 10 global unrest for every city, just do
<GameModifier> <ModType>Player</ModType> <Attribute>AbilityBonus</Attribute> <StrVal>A_Additive_Unrest</StrVal> <Value>10</Value> </GameModifier>
in each of the cityhubs.
Oh, , I wish I had known that is what that did sooner. Thanks Heavenfall yet again for making sense from nonsense.
One question: Is there a way to make it scalable depending on map size? I suppose the answer is no, but thought it was worth to ask anyway.
Oh, and by the way. I know it is already resolved, but just thinking about similar problems: Maybe you could add an additional step to solve it. Right now each city produces one "CityCount" which is a global resource not storable. Maybe you could have "CityCount" at level of cities and then each CityCount would produce a global resource called GlobalCityCount.
Why do I say this? Because you have two "CityCounts", the one at city level and the one at global level. Maybe if you add this additional step and use "GlobalCityCount" in your formula it would work.
Hi! It's me again. In case someone is interested, I have managed to do what was asked in the OP.
First, I defined the resource in CoreResources.XML
Then I included an additive ability in CorePlayerAbilities.xml. This is like the global variable that will store the city count
Next in each cityhub in CoreImprovements.xml I add this
The result is that each city has a variable called [CitiesCount] available that can be used when calculating expressions.
Hope this helps.
There are many great features available to you once you register, including:
Sign in or Create Account