[Request / Help] Yield from Wonders

Gaston1337

Chieftain
Joined
Dec 8, 2014
Messages
3
Hello everyone.

I am quite new to modding and for now I have mostly just copied different codes from Civilizations in the game and altered them as good as possible.
I have also seen that there is this "yield"-function, e.g. gaining +1 Gold :c5gold: for every forest tile, or for every building of a certain kind, or for the population of a city.

Now my question is: I would really like to make a wonder which yields +1 Gold :c5gold: and +1 Happines :c5happy: for every unemployed citizen.
Does anyone out there know a way to include the number of citizens without a workplace into the code of a building / wonder?

Thanks to everyone in advance.
 
Gold per tile of a specific terrain type in the city radius is easy because there is a pre-existing database table for it which has already had its behavior defined. That is not the case for a hypothetical wonder which gives good per unemployed citizen, you would have to use lua to achieve that.
 
Ah, okay, thanks for the answer - even though it's a pity it doesn't work.
About LUA, how complicated is it? Do you think it would be possible for someone to learn some basics / look through some tutorials and then be able to do this?

I mean, I can't believe modding is so complicated in Civ5 when the workshop on Steam is full of stupid Civs who have totally random traits which are definitely not just copied from another ingame Civilization.
 
Moderator Action: Moved to the SDK & LUA subforum.

Unfortunately this isn't simple. You would have to loop through the plots that the city owns, check if those plots are worked, count up the number that are, and subtract that plus the number of specialists from the city pop to get the number of unemployed citizens. Which is a bit of a pain (why didn't firaxis include a getNumNonWorkingCitizens function in the api?)
 
Number of unemployed citizens in a city is shown in the "slackers box" in the City View, so you can borrow the code from that

Code:
local slackerType = GameDefines.DEFAULT_SPECIALIST
local numSlackersInThisCity = pCity:GetSpecialistCount(slackerType)
 
Back
Top Bottom