Problem with numbers...

XerbSys

Chieftain
Joined
Oct 5, 2010
Messages
19
Hello,

I've got the following problem:
while

<Update>
<Where Name="UNHAPPINESS_PER_POPULATION"/>
<Set Value="2"/>
</Update>


exactly does what it should do

<Update>
<Where Name="UNHAPPINESS_PER_POPULATION"/>
<Set Value="0.75"/>
</Update>

sets the value to "0" and not to "0.75". ".75" instead of "0.75" has the same effect. Any ideas?

Thanks a lot!
 
Ok, I would except that, if the next line in the original Globaldefines.xml wouldn't say

<Row Name="UNHAPPINESS_PER_OCCUPIED_POPULATION">
<Value>1.34</Value>
</Row>

...

or have I just to accept that "UNHAPPINESS_PER_OCCUPIED_POPULATION" is a totally different mechanism than UNHAPPINESS_PER_POPULATION? :mischief:
 
Well tbh I have not played with either of those values, but I have tried adjusting other elements of Defines(science per pop) doing 0.1 or .1 numbers and it reverts to 0, I never tried inreasing 1.1 or > in decimals as I had a need to reduce science per pop not increase it.
 
Value is stored in teh SQLite schema as a variant, which means it can store anything (int, float, string, etc), but how it is used will depend on the C++ core, and if that's expecting an int for the value any decimal part will be dropped, so just because "X does it this way", implies nothing about how Y will behave
 
Thanks for all the answers, now I'm searching for a workaround to reduce the unhappiness for each citizen without disabling the whole happiness mechanism

My Idea is to take an early world-wonder like Stonehenge and apply the functionality to this world-wonder. This is definitely possible, as the forbidden palace does exactly this.

My problem now is, that

<Buildings>
<Update>
<Where Type="BUILDING_STONEHENGE"/>
<Set UnhappinessModifier="-25"/>
</Update>
</Buildings>

simply does nothing. Any ideas?

Thanks a lot!
 
Thanks for all the answers, now I'm searching for a workaround to reduce the unhappiness for each citizen without disabling the whole happiness mechanism

If you're looking for an across-the-board decrease, like making all population generate 0.75 unhappiness instead of 1.0, the best way is to change the Unhappiness multipliers for Eras or Handicaps. So the unhappiness per population will still be 1, but playing on Prince will now have a 75 modifier instead of a 100, which has the effect of making population only add 0.75 per. This can be done for all handicaps through a simple one-line SQL mod.

As others have said, just because one field allows a decimal (1.34) doesn't mean that any others will take anything other than integers. But there are so many other modifiers (stored as integers but representing decimals) that it's not hard to work around this limitation. In my own mod, population generates 1.2 unhappiness but I have a larger number of happiness-producing buildings, so I know it works just fine.

But you want this to be tied to a Wonder, which is completely different. For that, you should be using exactly the same syntax as for other wonders with that sort of effect. I don't have the XML in front of me, but as long as you're using the right schema AND loading your mod correctly (including any OnModActivated commands), then it should work just fine.
 
I believe, correct me if I am wrong, but I believe that it doesn't recognize the - as a negative.
 
Top Bottom