Unhappiness... Help needed with Mod

shanepg

Chieftain
Joined
Nov 9, 2011
Messages
30
I've written some very simple mods that change the costs of units etc.

But I've come unstuck trying to alter the general level of unhappiness in the civilisation. I know some ppl increase the happiness caused by buildings etc but I'd like to alter the base level of unhappiness. However I couldn't find any reference to unhappiness in the xml. Does anyone know where it is?

So, as an alternative I thought I could alter the handicaps of the difficulty level.
For chieftain I did this:

<GameData>
<HandicapInfos>
<Update>
<Set HappinessDefault="18"/> (from 12)
<Where type="HANDICAP_CHIEFTAIN"/>
<Set NumCitiesUnhappinessMod="30"/> (from 60)
<Where type="HANDICAP_CHIEFTAIN"/>
<Set PopulationUnhappinessMod="30"/> (from 60)
<Where type="HANDICAP_CHIEFTAIN"/>
<Set ProductionFreeUnits="10"/> (from 7)
<Where type="HANDICAP_CHIEFTAIN"/>
<Set ProductionFreeUnitsPerCity="5"/> (from 3)
<Where type="HANDICAP_CHIEFTAIN"/>
</Update>
</HandicapInfos>
</GameData>

Obviously the bits in ( ) not included in the code.

Does anyone know why this doesn't make any difference to happiness level?

I'm absolutely certain the paths and build etc are correct because when I remove this code and have ONLY this code:

<GameData>
<Units>
<Update>
<Set Cost="10"/>
<Where Type="UNIT_WARRIOR"/>
</Update>
</Units>
</GameData>

A warrior does cost only 10.

HOWEVER... If both bits of code are in like this:

<GameData>
<Units>
<Update>
<Set Cost="10"/>
<Where Type="UNIT_WARRIOR"/>
</Update>
</Units>
<HandicapInfos>
<Update>
<Set HappinessDefault="18"/>
<Where type="HANDICAP_CHIEFTAIN"/>
<Set NumCitiesUnhappinessMod="30"/>
<Where type="HANDICAP_CHIEFTAIN"/>
<Set PopulationUnhappinessMod="30"/>
<Where type="HANDICAP_CHIEFTAIN"/>
<Set ProductionFreeUnits="10"/>
<Where type="HANDICAP_CHIEFTAIN"/>
<Set ProductionFreeUnitsPerCity="5"/>
<Where type="HANDICAP_CHIEFTAIN"/>
</Update>
</HandicapInfos>
</GameData>

Nothing changes. A warrior costs 40 and happiness is unchanged.

I'm sure I'm making a simple mistake but I can't figure it out.

Also, does anyone know if you have to exit Civ 5 and re-enter it every time you make an adjustment to a mod - I'm getting tired of the first 15 seconds of that start movie!

Thanks a lot.
 
Code:
<GameData>
<HandicapInfos>
<Update>
<Set HappinessDefault="18"/> (from 12)
<Where type="HANDICAP_CHIEFTAIN"/>
</Update>
<Update>
<Set NumCitiesUnhappinessMod="30"/> (from 60)
<Where type="HANDICAP_CHIEFTAIN"/>
</Update>
<Update>
<Set PopulationUnhappinessMod="30"/> (from 60)
<Where type="HANDICAP_CHIEFTAIN"/>
</Update>
<Update>
<Set ProductionFreeUnits="10"/> (from 7)
<Where type="HANDICAP_CHIEFTAIN"/>
</Update>
<Update>
<Set ProductionFreeUnitsPerCity="5"/> (from 3)
<Where type="HANDICAP_CHIEFTAIN"/>
</Update>
</HandicapInfos>
</GameData>

OR

Code:
<HandicapInfos>
 <Update>
 <Where type="HANDICAP_CHIEFTAIN"/>
 <Set>
  <HappinessDefault>18</HappinessDefault>
  <NumCitiesUnhappinessMod>30</NumCitiesUnhappinessMod>
  <PopulationUnhappinessMod>30</PopulationUnhappinessMod>
   ....
 </Set>
 </Update>
</HandicapInfos>

You see where I'm going with this?

Also, does anyone know if you have to exit Civ 5 and re-enter it every time you make an adjustment to a mod - I'm getting tired of the first 15 seconds of that start movie!

This depends. Sometimes when you build it automatically updates the mod browser. And sometimes it doesn't, and when it doesn't, you have to restart the program.
 
Thanks.

The second version you stated looked simpler so I tried that and it didn't work.

The first one however, did work. Thank you.

<GameData>
<Units>
<Update>
<Set Cost="10"/>
<Where Type="UNIT_WARRIOR"/>
</Update>
</Units>
<HandicapInfos>
<Update>
<Set HappinessDefault="18"/>
<Where type="HANDICAP_CHIEFTAIN"/>
</Update>
<Update>
<Set NumCitiesUnhappinessMod="30"/>
<Where type="HANDICAP_CHIEFTAIN"/>
</Update>
<Update>
<Set PopulationUnhappinessMod="30"/>
<Where type="HANDICAP_CHIEFTAIN"/>
</Update>
<Update>
<Set ProductionFreeUnits="10"/>
<Where type="HANDICAP_CHIEFTAIN"/>
</Update>
<Update>
<Set ProductionFreeUnitsPerCity="5"/>
<Where type="HANDICAP_CHIEFTAIN"/>
</Update>
</HandicapInfos>
</GameData>

Also (I know this might be a bit dumb) but how do you insert code in the forum like you have?
 
Hm. Weird. Maybe I was a bit wrong on that one. I'll look it over and see what was the error, because it usually works.

Took me 2 seconds to find it. I forgot to put <Update></Update> between the Where and /Set.

It's updated. You can use the second one now, it will work.
 
Also (I know this might be a bit dumb) but how do you insert code in the forum like you have?

No questions are dumb :)
use the tool with the '#' symbol to do it automatically, or type in: open bracket, CODE and a close bracket. And then the same with a backwards slash to close the code section.

So ["CODE] ["/CODE] without the quotes.
 
Hm. Weird. Maybe I was a bit wrong on that one. I'll look it over and see what was the error, because it usually works.

To avoid the issue you mentioned, I usually just stack them all together directly. That is,
Code:
<GameData>
  <HandicapInfos>
    <Update>
      <Set HappinessDefaut="18" NumCitiesUnhappinessMod="30" PopulationUnhappinessMod="30"/>
      <Where Type="HANDICAP_CHIEFTAIN"/>
    </Update>
  </HandicapInfos>
</GameData>

While that sort of layout's a bit harder to read in one sitting, it's better when you're editing every value in a table in a non-linear way. In my own mod, I had to do this with the Eras table, editing pretty much every major modifier for each era. So it's really easy to see when you've accidentally left out a modifier in one era, because that line will be shorter than the others. That sort of thing.
 
No questions are dumb :)

There are no stupid questions, just stupid people. And the way you spot the stupid people is that they won't ask questions.

So ["CODE] ["/CODE] without the quotes.

Also, you can embed the code within a Spoiler tag like
Spoiler :
Code:
this
if you're inserting a huge amount of it and don't want to clog up the thread. Note that the tags won't work the other way around; the (CODE) has to be inside the (SPOILER).
 
Back
Top Bottom