[MODCOMP] Building Resource Converter Mod v0.2

TheLopez

Deity
Joined
Jan 16, 2006
Messages
2,525
Location
Oregon
Building Resource Converter Mod
By: TheLopez

Last Updated 08/20/10

Version: 0.4BtS
Patch Compatibility: Beyond the Sword v3.19
MP Compatible: ?
Download Mod v0.4BtS

Version: v0.3w
Patch Compatibility: Warlords v2.0.8.0
MP Compatible: ?
Download Mod v0.3w

Version: v0.2
Patch Compatibility: v1.61
MP Compatible: ?
Download Mod v0.2

Description:
Adds the ability to specify that a building should take x number of resources
available in a city and output y number of new resources.

I have tried to test the code as best as possible to make sure buildings react
correctly when a resource is added to a city that the building can use.
Please report any inconsistent behavior as soon as you find it so I can fix the
issue and make a new release.

-----Notes to Modmakers-----

If you want to use this mod component in your mod I have tried to make things
as easy as possible for you. In the SDK files I have added
// < Building Resource Converter Start > and
// < Building Resource Converter End > in all of the places where changes
were made.

As part of the changes to the SDK files I have also included two new methods in
the CvBuildingInfo class and exposed them to python they are:
Spoiler :

[PRE]
bool isRequiredInputBonus(int iBonus);
int getRequiredInputBonusValue(int iBonus);
int getRequiredInputBonusCount();
bool isBuildingOutputBonus(int iBonus);
int getBuildingOutputBonusValues(int iBonus);
int getBuildingOutputBonusCount();
[/PRE]

Last, I defined new XML tags in the CIV4BuildingsSchema.xml file. Here is an
example of how to use the new tags which need to be added after the
<iNumFreeBonuses>0</iNumFreeBonuses> tag in the building definitions found in
the CIV4BuildingInfos.xml file:
Spoiler :

[PRE]
<RequiredInputBonuses>
<RequiredInputBonus>
<BonusType>BONUS_SALTPETER</BonusType>
<iBonusAmount>2</iBonusAmount>
</RequiredInputBonus>
<RequiredInputBonus>
<BonusType>BONUS_SULPHUR</BonusType>
<iBonusAmount>1</iBonusAmount>
</RequiredInputBonus>
<RequiredInputBonus>
<BonusType>BONUS_COAL</BonusType>
<iBonusAmount>1</iBonusAmount>
</RequiredInputBonus>
</RequiredInputBonuses>
<BuildingOutputBonuses>
<BuildingOutputBonus>
<BonusType>BONUS_GUNPOWDER</BonusType>
<iBonusAmount>1</iBonusAmount>
</BuildingOutputBonus>
</BuildingOutputBonuses>
[/PRE]

-----Version Information-----

-----v0.4BtS------

- Updated to be compatible with Beyond the Sword v3.19 patch

Spoiler :

-----v0.3w------

- Updated to be compatible with Warlords v2.0.8.0 patch.

-----v0.2------

- Fixed the issue that prevented manufactured resources from being used as
inputs for other manufactured resources

-----v0.1------

- Setup the Building Resource Converter Mod

- Added the code to define the new building input/output bonus tags

- Added the resource processing code to the CvCity class so when a new resource
is "hooked-up" to a city and an active building exists in the city that can
process the new resource the building will start using the resource

- Updated the CIV4BuildingsSchema.xml file to include the new tags defined
through the SDK to the BuildingInfos definition.


-----===Credits & Thanks===-----

- Exavier - Composite Mod - readme.txt format
 
Whoooohoo! :banana:
This will be really great for the mod I'm working on.

One question though, does the AI know how to use it? Like if it wants to build a unit which requires gunpowder it would know to build a powder mill.

Thanks a lot TheLopez, and great job! :goodjob:
 
Darn it Lopez! Yet another great addition to the game that I won't have time to try. :D
 
Is it possible to create a building that generates resources, with no input whatsoever?
 
Gunner said:
Whoooohoo! :banana:
This will be really great for the mod I'm working on.

One question though, does the AI know how to use it? Like if it wants to build a unit which requires gunpowder it would know to build a powder mill.

Thanks a lot TheLopez, and great job! :goodjob:
Actually, yes, I have seen them build it. Just like they will build the wonders that produce other bonuses.

dc_epic said:
Is it possible to create a building that generates resources, with no input whatsoever?
You were able to define buildings that could produce bonuses without inputs before my mod. All you needed to do was use the <FreeBonus> and <iNumFreeBonuses> tags.
 
In case I haven't said so before, this is a very interesting and exciting idea for a mod.
 
Would it be hard to have a on/off on a building so it wont convert for some turn?
 
Zuul said:
Would it be hard to have a on/off on a building so it wont convert for some turn?

That is one of the planned features for v0.3. Also for the next version is resource consumption.
 
Now it is possible to make coal, oil or natural gas to power (electric energy) ressource (required to build city power grid to get power), fertilizerzers . You can even sell it :)
and produce other ressources aluminium or something else. This is really awsome. I will use it in my Industrial mod and give you credit with very large font :D

One idea is for example to build powerstations outside of towns, add pollution feature and script via phyton to produce electric energy ressource from this location but it needs ranged option for improvements. can't build if other similar is 2-4 square nearby.

Why? Because then strategic bombing makse sense :D and usually powerstations are big and stay outside from town. This is like mines or farms and makses more interesting to build stuff on map. Same idea is with factories.
 
I've been waiting for you to start a thread about this mod just so I can say how very cool it is!

This mod has great potential uses in all kinds of mods, but most exciting to me is how useful it will be in the effort to make a Sid Meier's Colonization Mod. :D

Keep up the good work. :cool: :goodjob:
 
TheLopez said:
That is one of the planned features for v0.3. Also for the next version is resource consumption.
What do you mean by resource consumption? Is that where if a building is using resource(s) to generate another one then that resource will not be available for trade and production of units (like if you were to trade away the last iron you had you can't make swordsman)? Or is it where a resources has a limited set amount that is available from the improvement and as time goes on it is used up?

In either case I'd like to see both eventually (no rush ;)) with the option to turn one or the other or both on and off (as always :D).

Also, another idea/wish I have, is for that second option (where resource has limited amount) to have several "flavors" if you will.

So in one case each mine will have a set amount of resources from the start, and as you use it it eventually runs out. Depending on the number of units or buildings or whatever else using this resources the rate of consumption differes, like 1 per turn, or 0.1 per turn.

Another case has the mine continuosly supplying a set amount of resource per turn, maybe it accumulates maybe not, but regardless it puts a limit on how many units, buildings, etc., that require it can be maintained.

So in the first case you can accumulate a large army quickly if you want, but that of course means that the mines will run out fast and you might find yourself w/o that resource when it comes time to make more modern units.
In the second case the mines never run out but if you can't get your hands on many of them you won't be able to assemble a large force.

Not original ideas mind you but I wanted to put them forth. :)

I also had a third one I think but I forget right now :blush: I think it was some sort of combination of the other two. :)

Can I just say again what a tremendous work you're doing. :goodjob:

Edit: Still not sure if that was what I originally had in mind for flavor three but of course another way to go would be to have mines that have a limited set of resources but also can supply only so much resource per turn. Of course in this case the mines should have a lot of resources to last a long time (since maximum per turn is now limited). Something like - an iron mine you discovered w/ Iron Working to last till something like the middle ages maybe, especially if you can accumulate anything you don't use. :)
 
So does this simply mean you need two SOURCES of a resource to produce a new resource? In other words, the binary system already in place? Or have you quantified it so that, for example, a source of iron with a mine on it produces 10 units of iron per turn? I'm assuming its the former rather than the latter since there's no new XML for the terrain... and is the second one ever going to be an intended goal?


Edit: Also, is there an either or option? For example, if I have raw materials Cotton and Wool, can I specify that EITHER could be used to make Textiles and not necessarily BOTH?


Oh... and of course.... great work ;)
 
Rabbit said:
What do you mean by resource consumption? Is that where if a building is using resource(s) to generate another one then that resource will not be available for trade and production of units (like if you were to trade away the last iron you had you can't make swordsman)? Or is it where a resources has a limited set amount that is available from the improvement and as time goes on it is used up?
For the time being the resource consumption would be limited to manufacturing buildings. So for instance if you built a powder mill in your city that uses 1 saltpeter, coal and sulphur and you had 2 saltpeter, 1 coal and 1 sulphur available in your civ then after you built the powder mill you would only have 1 saltpeter left.

I would also include the ability to turn off buildings as well to return the resources back into the pool. The only problem with implementing a system where resources are consumed is as always teaching the AI how to use it. (suggestions welcome)

Rabbit said:
In either case I'd like to see both eventually (no rush ;)) with the option to turn one or the other or both on and off (as always :D).
Of course.

Rabbit said:
Also, another idea/wish I have, is for that second option (where resource has limited amount) to have several "flavors" if you will.

So in one case each mine will have a set amount of resources from the start, and as you use it it eventually runs out. Depending on the number of units or buildings or whatever else using this resources the rate of consumption differes, like 1 per turn, or 0.1 per turn.

Another case has the mine continuosly supplying a set amount of resource per turn, maybe it accumulates maybe not, but regardless it puts a limit on how many units, buildings, etc., that require it can be maintained.
This feature of depleting resources is going to be part of the Dynamic Resources Mod...
 
Dom Pedro II said:
So does this simply mean you need two SOURCES of a resource to produce a new resource? In other words, the binary system already in place? Or have you quantified it so that, for example, a source of iron with a mine on it produces 10 units of iron per turn? I'm assuming its the former rather than the latter since there's no new XML for the terrain... and is the second one ever going to be an intended goal?
See my answer to WR for this one.


Dom Pedro II said:
Edit: Also, is there an either or option? For example, if I have raw materials Cotton and Wool, can I specify that EITHER could be used to make Textiles and not necessarily BOTH?
No not yet, but that is also in the works for the next version.
 
I used GreenMod Phyton code to make ressources to end after certain time. Improvements can develop, so i added random chance that after every 50 turns you have 20% chance to lose a ressource. Killed improvement and ressource. Its the cruel reality isn't :D

else restored improvement..
 
Top Bottom