Gleb Bazov
Warlord
- Joined
- Feb 13, 2017
- Messages
- 176
UPDATE #4: Darn! I forgot a snippet of LeeS' code in the Strategic Resource Improvement Culture Bomb, and, for that reason, the function ResourceIsRevealedToPlayer was not working at all. NOW FIXED. Ok, that's it for now! 
IMPORTANT, UPDATE #3: There were errors in the code in the previous update. They have (hopefully) been all corrected. The functionality is as described below. The Culture Bomb should now work exactly as the Culture Bomb in the base game, except with the far greater flexibility:
(1) 1-tile radius;
(2) Does not capture tiles beyond 5-tile radius around the origin (owner of source plot) city;
(3) Does not capture other civilizations' districts or wonders.
Please make sure to use the latest versions (included below) instead of any of the prior versions. Included:
- District Culture Bomb (adds an adjacency to feature requirement)
- Improvement Culture Bomb (adds the requirement of improvement over strategic resources)
- Australia Trait Replacement Culture Bomb (exactly as base game, except in Lua)
----------------------------------------------------------------------------------------------------------------------------------------
UPDATE #2: All three mods updated with the range from the city within which the Culture Bomb will be effective. This range is equivalent to PLOT_INFLUENCE_MAX_ACQUIRE_DISTANCE in Global Parameters, which is set to 5 in the base game.
UPDATE: I have updated the two mods to EXCLUDE tiles with Districts owned by other civs from the culture bomb mechanic. The updated files have been uploaded instead of the original ones.
-----------------------------------------------------------------------------------------------------------------------------------------
I am also adding the Australia Trait Replacement mod for Anansethespider here, in case anyone else finds it useful. It can be adapted to any other, as required.
NOTE: This is W.I.P., very little testing done to see all possible conflicts, just the basic functionality so I would really appreciate anyone testing this further (e.g., I have no idea what happens when a different civ's district falls within the culture bomb area, and have not precluded this possibility, but can, if needed).
Here are two results of my recent attempts to learn Lua for Civ VI and test a variety of available mechanics. They were inspired by two requests for help with implementing Culture Bomb functionality for districts (of a specified Civ Type and with a required adjacency) and improvements (place on strategic resources. As the Culture Bomb functionality in XML is severely restricted, Lua seemed like a good place to go.
Neither would have been possible without excellent examples of Lua coding provided from LeeS, from which I liberally borrowed, and a very timely and essential tip from Gedemon.
District Adjacency Culture Bomb - Tied to a Civilization
To customize, edit the Lua file (in the LUA subdirectory) and amend the following values:
local rPlotRadius = 3
This will change the radius of the Culture Bomb. Set by default to 3 to showcase the possibilities in Lua.
local iRequiredDistrict = "DISTRICT_ENCAMPMENT"
This will change the district to which the Culture Bomb applies.
local rRequiredCiv = "CIVILIZATION_EGYPT"
This will change the civilization able to use this Culture Bomb trait.
local rRequiredFeature = "FEATURE_JUNGLE"
This will change the adjacent feature required. Further in the code, the adjacency radius can also be changed (from 1 to 1+x, and the code will check for the presence of the required feature in all the rings).
Strategic Improvement Culture Bomb
To customize, edit the Lua file (in the LUA subdirectory) and amend the following values:
local rPlotRadius = 3
This will change the radius of the Culture Bomb. Set by default to 3 to showcase the possibilities in Lua.
local rResourceClassType = "RESOURCECLASS_STRATEGIC"
This will change the required class of resource (i.e. Luxury, Bonus, Strategic).
By default, the game does not let you place an invalid improvement on a specific type of resource, so there was no need to check further whether an improvement fits the resource in question. As long as the resource is visible to the player, and is of a specified class, and is contained on the improvement's plot, the Culture Bomb will trigger.
Much thanks to LeeS and Gedemon!
gBazov

IMPORTANT, UPDATE #3: There were errors in the code in the previous update. They have (hopefully) been all corrected. The functionality is as described below. The Culture Bomb should now work exactly as the Culture Bomb in the base game, except with the far greater flexibility:
(1) 1-tile radius;
(2) Does not capture tiles beyond 5-tile radius around the origin (owner of source plot) city;
(3) Does not capture other civilizations' districts or wonders.
Please make sure to use the latest versions (included below) instead of any of the prior versions. Included:
- District Culture Bomb (adds an adjacency to feature requirement)
- Improvement Culture Bomb (adds the requirement of improvement over strategic resources)
- Australia Trait Replacement Culture Bomb (exactly as base game, except in Lua)
----------------------------------------------------------------------------------------------------------------------------------------
UPDATE #2: All three mods updated with the range from the city within which the Culture Bomb will be effective. This range is equivalent to PLOT_INFLUENCE_MAX_ACQUIRE_DISTANCE in Global Parameters, which is set to 5 in the base game.
UPDATE: I have updated the two mods to EXCLUDE tiles with Districts owned by other civs from the culture bomb mechanic. The updated files have been uploaded instead of the original ones.
-----------------------------------------------------------------------------------------------------------------------------------------
I am also adding the Australia Trait Replacement mod for Anansethespider here, in case anyone else finds it useful. It can be adapted to any other, as required.
NOTE: This is W.I.P., very little testing done to see all possible conflicts, just the basic functionality so I would really appreciate anyone testing this further (e.g., I have no idea what happens when a different civ's district falls within the culture bomb area, and have not precluded this possibility, but can, if needed).
Here are two results of my recent attempts to learn Lua for Civ VI and test a variety of available mechanics. They were inspired by two requests for help with implementing Culture Bomb functionality for districts (of a specified Civ Type and with a required adjacency) and improvements (place on strategic resources. As the Culture Bomb functionality in XML is severely restricted, Lua seemed like a good place to go.
Neither would have been possible without excellent examples of Lua coding provided from LeeS, from which I liberally borrowed, and a very timely and essential tip from Gedemon.
District Adjacency Culture Bomb - Tied to a Civilization
To customize, edit the Lua file (in the LUA subdirectory) and amend the following values:
local rPlotRadius = 3
This will change the radius of the Culture Bomb. Set by default to 3 to showcase the possibilities in Lua.
local iRequiredDistrict = "DISTRICT_ENCAMPMENT"
This will change the district to which the Culture Bomb applies.
local rRequiredCiv = "CIVILIZATION_EGYPT"
This will change the civilization able to use this Culture Bomb trait.
local rRequiredFeature = "FEATURE_JUNGLE"
This will change the adjacent feature required. Further in the code, the adjacency radius can also be changed (from 1 to 1+x, and the code will check for the presence of the required feature in all the rings).
Strategic Improvement Culture Bomb
To customize, edit the Lua file (in the LUA subdirectory) and amend the following values:
local rPlotRadius = 3
This will change the radius of the Culture Bomb. Set by default to 3 to showcase the possibilities in Lua.
local rResourceClassType = "RESOURCECLASS_STRATEGIC"
This will change the required class of resource (i.e. Luxury, Bonus, Strategic).
By default, the game does not let you place an invalid improvement on a specific type of resource, so there was no need to check further whether an improvement fits the resource in question. As long as the resource is visible to the player, and is of a specified class, and is contained on the improvement's plot, the Culture Bomb will trigger.
Much thanks to LeeS and Gedemon!
gBazov
Attachments
Last edited: