Need Help with a Luxury Resource mod

Sonereal

♫We got the guillotine♫
Supporter
Joined
Mar 31, 2008
Messages
14,928
This is my first "real" mod besides minor tweaks and whatnot I did for gamespeeds in Civ4 and mods and overall I'm pretty sure I have what I'm trying to do nailed down except one. One of the changes in my mod is that all the luxury resources have different happiness values (to balance out the new yields when improvements are built on them). The problem is that I don't know how to make the happiness bonus stack. I've looked everything through the resource sections and can't find anything that looks remotely right for the change.

Any idea where I should look? So far this is my only hold-up. :sad:
 
I think i may not be understanding you correctly because changing the value for happiness gained from a resource is right on the resource itself, it's the second line in fact. not sure what you mean by stacking though, you would just change each one to whatever it is you want that resource to give and the system would add them together.

Grabing one at random with the line in question in red:

Spoiler :

Code:
<Row>
			<Type>RESOURCE_DYE</Type>
			[COLOR="Red"]<Happiness>5</Happiness>[/COLOR]	
	<TechCityTrade>TECH_CALENDAR</TechCityTrade>
			<Description>TXT_KEY_RESOURCE_DYES</Description>
			<Civilopedia>TXT_KEY_CIV5_RESOURCE_DYES_TEXT</Civilopedia>
			<ResourceClassType>RESOURCECLASS_LUXURY</ResourceClassType>
			<ArtDefineTag>ART_DEF_RESOURCE_DYE</ArtDefineTag>
			<PlacementOrder>3</PlacementOrder>
			<ConstAppearance>50</ConstAppearance>
			<MinAreaSize>3</MinAreaSize>
			<MaxLatitude>90</MaxLatitude>
			<RandApp1>25</RandApp1>
			<RandApp2>25</RandApp2>
			<Player>67</Player>
			<Flatlands>true</Flatlands>
			<GroupRange>3</GroupRange>
			<GroupRand>15</GroupRand>
			<IconString>[ICON_RES_DYE]</IconString>
			<PortraitIndex>16</PortraitIndex>
			<IconAtlas>RESOURCE_ATLAS</IconAtlas>
		</Row>

Edit: Actually do you mean make the tile bonuses stack? If so I think thats currently normal that tile bonuses don't stack(IE forest on a plain gives the same as forest on a hill or forest on grassland) though i'm not sure if thats a bug or working as intended because i could argue for eiter way being valid.
 
I have the part down already. The thing about it is that in-game, having multiple units of the same luxury resource doesn't net you more happiness. You get the happiness bonus for just one of each luxury resource and the others are meant to be traded off.

For the purpose of my mod, this would be a disaster since each resource has different happiness and yield bonuses.

For example, Incense gives one happiness but having four of them, in my mod, should give 4 happiness. However, in Civ5, having four incense only give 1 happiness.
 
I have the part down already. The thing about it is that in-game, having multiple units of the same luxury resource doesn't net you more happiness. You get the happiness bonus for just one of each luxury resource and the others are meant to be traded off.

For the purpose of my mod, this would be a disaster since each resource has different happiness and yield bonuses.

For example, Incense gives one happiness but having four of them, in my mod, should give 4 happiness. However, in Civ5, having four incense only give 1 happiness.

Oh okay thats unfortuantly easy to answer but not in your favor, it's a global define as far as i can tell.


Code:
<GameData>
	<defines>
		<Row Name="HAPPINESS_PER_EXTRA_LUXURY">
			<Value>0</Value>
		</Row>
	</defines>
</GameData>
Sorry I'm at work and it takes a long time to post.

EDIT:
Actually looking over the GlobalDefines.xml the table is set for Variant data entry and at least one of the defines uses a text value... try setting the value to true and see if it throws an error or if it accepts the value and has each extra supply it's defined happiness.

EDIT EDIT:
you could also try just deleting the whole define and see if the default isn't set to do what you want since they way it shows there it's forcing all luxuries to give 0 happiness no matter what there value is. if thats the case then deleting the global override should make make it so that every instance of the luxury gives the defined happiness.
 
Code:
<GameData>
	<defines>
		<Row Name="HAPPINESS_PER_EXTRA_LUXURY">
			<Value>0</Value>
		</Row>
	</defines>
</GameData>
Sorry I'm at work and it takes a long time to post.

EDIT:
Actually looking over the GlobalDefines.xml the table is set for Variant data entry and at least one of the defines uses a text value... try setting the value to true and see if it throws an error or if it accepts the value and has each extra supply it's defined happiness.

EDIT EDIT:
you could also try just deleting the whole define and see if the default isn't set to do what you want since they way it shows there it's forcing all luxuries to give 0 happiness no matter what there value is. if thats the case then deleting the global override should make make it so that every instance of the luxury gives the defined happiness.

Deleting it may be better. Changing that number, I think, will give a flat happiness bonus across the spectrum.

I'll test it tomorrow.

Thank you for the help.
 
Deleting it may be better. Changing that number, I think, will give a flat happiness bonus across the spectrum.

I'll test it tomorrow.

Thank you for the help.

Yep if you changed the 0 to a 3 it would give a flat 3 accross the board but my worry is if something else depends on that referance being there then deleting it would be bad, so if you change the value from 0 to TRUE then it might just ignore the entry, though the fact that the current value is an integer it makes me doubt it would accept a boolean response, but then again no where else in the XML is a type set to variant either so maybe it will work.

Oh and you're welcome, I figure if I'm asking questions myself I ought to answer any that I can myself.
 
That didn't work. For some reason, setting the Global Define option for extra resources to delete doesn't do anything but the opposite (+1 happiness for extra luxury resources). Meanwhile, the other changes I made aren't being recognized at all.
 
That didn't work. For some reason, setting the Global Define option for extra resources to delete doesn't do anything but the opposite (+1 happiness for extra luxury resources). Meanwhile, the other changes I made aren't being recognized at all.

Rats, if deleteing the tag HAPPINESS_PER_EXTRA_LUXURY sets all extra luxuries to +1 then that means the default setting for HAPPINESS_PER_EXTRA_LUXURY is 1 and thus it's set globaly and not by the individual resources. Which is a bad thing for you and those wanting to do something like you are, it means we are most likely stuck untill they release more info on the code and even then it probably won't be able to be done with XML alone. :sad:

EDIT: I'll play with it when i get home tonight and see if I can get anything to work since the value is set to variant, maybe a boolean value will give it a different responce, or it mey just error. who knows.
 
Setting the value to "True" did the same thing as deleting the value. +1 happiness. But my other changes aren't showing up for some reason. :blush:
 
the HAPPINESS_PER_EXTRA_LUXURY value applies to each additional TYPE of luxury you have. It is a bonus for having multiple types of luxuries. Sadly there is no mechanism to add additional happiness for larger quantities of a given resource.
 
Back
Top Bottom