View Full Version : Resource flow commerce bonus to specific city? +possible additional questions


C~G
Dec 29, 2006, 03:36 AM
I have played with an idea about mod that would require certain amount of creativity with game concepts but the problem is that all I can really do is some XML editing since Python and SDK are of the limits. Currently I'm kept back by this problem. I have tried to look around for an answer but I'm just dazzled with this. The answer might be simpler than the question.

Is there possibility that certain specific city gets commerce bonus as long as certain resource to that city is provided and only this specific city can have this bonus from this resource?

Only possible solutions I have come up are example using TheLopez's Building Resource Converter Mod to make national wonder that produces new resource from resource provided and this new resource then provides the bonus only to this city OR building national wonder that works like Granary giving commercial bonus when certain resource is available (similar to health bonus from wheat). I don't know are either of these possible?

If so, how and if not, would be someone interested to make such mod component?

Duke176
Dec 29, 2006, 05:05 AM
with that mod you mentioned there were files modded in sdk?
if so why don't you open them with notepad++ and look for modifications made. In reality sdk it's quite "easy" to understan. it a bit harder to be modified or created, but you would have 1stly an idea on how it works. (To learn my basic knowledge of SDK i made it and it worked).

So you could focus on the part in which the presence of a certain building add the bonus to the city...

I order to easy trace the row you need you will have to look for something like:


//Give another 25% if the city has a hospital
//Check for a hospital in the city
if (pCity->hasActiveBuilding((BuildingTypes)GC.getInfoTypeFo rString("BUILDING_HOSPITAL")))
{
iPopulationChange += iCurrentPopulation / 4;
}
}

From Tutorial of Zafzo - http://forums.civfanatics.com/showthread.php?t=183339

You will probably find something like this in one of files modded in that mod you mentioned.

if (pCity->hasActiveBuilding((BuildingTypes)GC.getInfoTypeFo rString("BUILDING_HOSPITAL")))

This row tells: if - that plot with that city has within an active builiding called "BUILDING_HOSPITAL - than do something.
The same will be with that wonder.
after that row you will see the part of code where the game assign the bonus to that city only.

C~G
Dec 29, 2006, 07:10 AM
Thanks for the info Duke176.

I just have started to play with XML files and the many tutorials been extremely helpful for me. Unfortunately when it comes to python etc. I seem to very soon lost my head to the vast amount of lines. It's dark journey alright since more I tried more I got sunken deeper to the mud.

Have to try what I can come up. Thanks for pointing out to general direction and more. :)

Possibly more to come when I have time to test this...

Duke176
Dec 29, 2006, 07:59 AM
AN EXAMPLE OF WHAT I MEAN:

all right open CvCity.cpp (from mod files) and look for (search)

iCityBonusAmount = getNumBonuses((BonusTypes)iJ);

For ex. this an expressione that assigns at int (so numerical) iCityBonusAmount = the number of getNumBonuses((BonusTypes)iJ) - where iJ rappresent the number assigned to that particular bonus inside the index Lopez created in the lines little before this part.

if you want that int returns only the number of Bonuses of certain kind use this expression:

iCityBonusAmount = getNumBonuses((BonusTypes) (GC.getInfoTypeForString("BONUS_XXXX")));


In this way you use getNumBonuses((BonusTypes) eBonus); function to recall the counter of bonuses and you use the function GC.getInfoTypeForString("NAME OF BONUS INSIDE XML BonusInfos.xml") to recall that kind of bonus you want to be counted.

Again I suggest you to take a look at Zafzo Tutorial on How to add a mission to unit and try to understand various passages inside the SDK - it's not so hard as it seems in the begin - so after you will understand much better other modifications.