Food Economy - Tradable Bonus Resources

I use this concept in Health and Plague mod. It is easy to implement for any version of civ.

Code:
INSERT INTO Resource_QuantityTypes (ResourceType, Quantity)
SELECT    Type, 1
FROM Resources
WHERE ResourceClassType = 'RESOURCECLASS_BONUS';

UPDATE Resources
    SET ResourceClassType = 'RESOURCECLASS_RUSH',
        ResourceUsage = 1,
        AIObjective = 3,
        Player = 67
    WHERE ResourceClassType = 'RESOURCECLASS_BONUS';

UPDATE Resources
    SET TechCityTrade = 'TECH_AGRICULTURE'
    WHERE TechCityTrade IS NULL;

The default AI will offer and accept trades in these former bonus resources (i.e. no DLL mod required).

Now if you want to have those resources provide some tangible benefit (i.e. food or health or faith or whatever) you'll need some lua to make that happen.

Can you give some precisions on this ? :)

The first query is for made the bonus ressource countable or tradable? what's made set type to 1 ?
second query you totally erase the bonus resourceclass for replacing it with a new class you can trade ? (ResourceUsage=1) ? or who have trade value ?(AIObjective = 3) ?
third query ?? why did you have to unset this default null value ? I like understand what I do^^

For the bonus code part, I think I can find it alone but can you tell me in Faerun which file is the bonus part and UI and can I re-use and modify it ? ( in faerun the bonus is visible in the building tooltip with the "city connection" icon if I remember well. )

last question : with your code, how to make the trade value of the resource match the overall bonus? which increases with the number of cities.

I want to update this mod for vanilla BNW and Vox Populi. (with a little growth malus if needed) I think that can be a good training for a more complex resource mod I want to make and in which I want to integrate this function anyway.

thanks anyway ! ;)
 
Last edited:
Can you give some precisions on this ? :)

The first query is for made the bonus ressource countable or tradable? what's made set type to 1 ?
second query you totally erase the bonus resourceclass for replacing it with a new class you can trade ? (ResourceUsage=1) ? or who have trade value ?(AIObjective = 3) ?
third query ?? why did you have to unset this default null value ? I like understand what I do^^

For the bonus code part, I think I can find it alone but can you tell me in Faerun which file is the bonus part and UI and can I re-use and modify it ? ( in faerun the bonus is visible in the building tooltip with the "city connection" icon if I remember well. )

last question : with your code, how to make the trade value of the resource match the overall bonus? which increases with the number of cities.

I want to update this mod for vanilla BNW and Vox Populi. (with a little growth malus if needed) I think that can be a good training for a more complex resource mod I want to make and in which I want to integrate this function anyway.

thanks anyway ! ;)

Hi,
The first DB update on Resource_QuantityTypes is made for the placement of resources when the map is generated. I used a modded map generator and had thought I might use it to implement some new health resources. The update sets the plot pool of all former Bonus resources to 1, but that could be any number. For example, Iron is something like 4 in this table, while Aluminum is something liee 8. Note that this is a dead table that does aboslutely nothing without some additional code to reference it.

The second DB update on Resources is the most important, as it changes all bonus resources into tradeable strategic resources. The AI will now treat them as early game strategics (ResourceUsage = 1). I don't remember what, if any, effect AIObjective has. I think the Player field was modified to avoid some kind of crash....

The third DB update tells the game which tech will unlock trade in these new strategic resources. Here I set all the old bonus resources to be tradeable with the initial tech, though this could be modified for each resource type. For example you could have cattle being tradable with Animal Husbandry. Leaving this as NULL would mean that resource is not tradeable.

You can find the UI display that I used in Faerun in TopPanel.lua. Search for "Resources Tooltip".

I don't know how to change the value that the AI will place on any resource. That sounds like a DLL mod to me.

Good luck!
 
Top Bottom