Building generating random resource query

Rob (R8XFT)

Ancient Briton
Retired Moderator
Joined
Aug 11, 2002
Messages
10,871
Location
Leeds (UK)
In Anno Domini, there will be an apothecary - one of the effects of this building is that it generates a quantity of nutmeg (which is the only source of it in the game - Indonesia are not in the mod). To make it even better, it would be great if each apothecary built could generate a randomly chosen resource from nutmeg, pepper and cloves - each of these resources only being able to be accessed via apothecaries.

Is there any way to do this?
 
I guess you could place a resource on map directly... but if you place the resource on map, it will displace one already there if one was there. This happens with Indonesia. Also, a dummy building can be destroyed on conquest while lua would be required to remove a resource. The lua is relatively easy and I could do it for you... in my mod, I am constantly adding and deleting dummy buildings via lua for a variety of effects. (my code is likely clunky, but works... others could do it with more polish, I'm sure).

The building resource will be part of the buildings xml.

I don't think that you change the xml after the game has started. So randomly generating a resource that would be attached to the xml of the apothecary itself, I don't think is possible.

AFAIK. a resource can only added via lua or a dummy building (or the Indonesian trait), and for the reasons stated I believe the latter to be better way.

I suppose you could look at how city states do it... I am guessing, though, that they way they work likewise displaces a resource if one happens to be in the hex where the city state is generated. Maybe.
 
I'm currently adding a resource via an actual building in the game - I wanted an additional effect to the apothecary and just did a spot of XML to get it in there (similar to the recycling centre giving 2 aluminium in the "epic" game). At the moment, each apothecary you build will give you a copy of the nutmeg resource, so it can be traded. I thought it would be even cooler if it was randomised, hence the query.
 
I've worked out what I can do - a method which will not be random but will mix things up a bit.

01. Create three apothecaries, one for each resource.
02. Give each one different restrictions of where they cannot be built - so one will not be buildable in anywhere but hills and grassland, for example, and the others will have different requirements.
03. Hide two of them from the civilopedia.

At least this way, the apothecary will produce a luxury resource relating to the terrain its city is built in and will at least mix things up a bit.
 
It's a compromise, Craig. I found that you could only have one prohibited terrain, so this is what I've done:

Apothecary (nutmeg): needs to be built on or next to desert and cannot be built on plains
Apothecary (cloves): needs to be built on or next to grassland and cannot be built on desert
Apothecary (pepper): needs to be built on or next to plains and cannot be built on grassland

All three buildings have been put in their own "mutually exclusive" group so that only one apothecary can exist in each city. I used the same apothecary icon for each, but gave it a different coloured starburst and (on the 256 sized icons) overlaid the 64 sized icon of the resource in the lower left part of the icon. All three appear in the civilopedia - I felt there was no point in hiding them, given that this was the solution.
 
Top Bottom