Couldn't find these variables--please help!

isnorden

Amnesiac Modder
Joined
Jul 6, 2012
Messages
608
Location
Madison, Wisconsin, USA
I'm planning to write a mod that does two things:

  1. Reduces city-related unhappiness (both population and number of cities) for all civs. The problem won't vanish altogether, but should be easier to manage.
  2. Gives India a new advantage, "Sacred Cattle". Any improved source of Cattle in their cities gives +1 Faith and Food per turn, plus a one-time +1 Happiness boost. (Why the Food bonus when most people in India don't eat beef? Because milk and butter are still acceptable to eat in their culture--even sacred under the right circumstances.)

Problem #1 looks like something I could fix with a couple of <update> statements, if I knew the name of the right variable(s). Unfortunately, I can't seem to find the files anywhere in Civ 5's XML or Lua folders. :confused:

Problem #2 looks like a cross between unique-building code and religious-belief code. But Pastures aren't defined as buildings anywhere I looked; and the bonuses shouldn't go to everyone with a Pasture full of cows, just to India. How do I specify this combination of restrictions?

I don't expect someone else to write the mod for me, just to point me in the right direction so I can do the coding; could any of you please help out? Many thanks!
 
There is a trait column that modifies bonuses gained from resources (or at least improvements?). The yields are YIELD_FAITH and YIELD_FOOD.

As for a one time happiness boost, you'll probably need a unique building for India that replaces the Palace that grants +1 Happiness.
 
There is a trait column that modifies bonuses gained from resources (or at least improvements?). The yields are YIELD_FAITH and YIELD_FOOD.

As for a one time happiness boost, you'll probably need a unique building for India that replaces the Palace that grants +1 Happiness.

Thank you for the pointers..although it's the Pasture (the actual Happiness source, buildable once per herd of cows) that would need replacing. Does the game's XML code define unique land improvements anywhere? If it does, that's what India will be getting. :)
 
Thank you for the pointers..although it's the Pasture (the actual Happiness source, buildable once per herd of cows) that would need replacing. Does the game's XML code define unique land improvements anywhere? If it does, that's what India will be getting. :)


Yes, you can make Unique Improvements for civs. Look in the Terrain folder, then in Improvements. In the Improvements table, you should see columns for SpecificCivRequired and CivilizationType. Keep in mind that this won't replace the Pasture, it will just give you an additional Improvement type for India. It would take a lot more work to make it so India can't build Pastures, only the replacement.

Another problem I see is that there isn't a column for Happiness in the Improvements table. As Happiness isn't a Yield, you're going to have to figure out some other way to get that to work. I'd go with Putmalk, and create a building of some sort that gives +1 Happiness if you have a sorce of cows.
 
Yes, you can make Unique Improvements for civs. Look in the Terrain folder, then in Improvements. In the Improvements table, you should see columns for SpecificCivRequired and CivilizationType. Keep in mind that this won't replace the Pasture, it will just give you an additional Improvement type for India. It would take a lot more work to make it so India can't build Pastures, only the replacement.

Another problem I see is that there isn't a column for Happiness in the Improvements table. As Happiness isn't a Yield, you're going to have to figure out some other way to get that to work. I'd go with Putmalk, and create a building of some sort that gives +1 Happiness if you have a sorce of cows.

I decided to drop the Happiness bonus in favor of doubling the resource Yield where cows were available; attaching a phantom building to the improvement is beyond my technical ability. (The game treats cows as a luxury resource anyhow, so having more of them should increase Happiness indirectly. It also makes sense that a culture would allow protected animals to breed more... ;-) )

As for having the new construction replace the Pasture--the rule should actually be a little more complicated. Ideally, India could still build regular Pastures for horses or sheep; but cows would always get the replacement structure. How would I code this? I've never seen anything similar in other mods, so I have no idea where to begin.
 
Back
Top Bottom