Culture Bomb Requirements/Arguments?

StandardGaussian

Chieftain
Joined
Mar 8, 2017
Messages
15
Right now, it looks like the only way to culture bomb is to set a culture bomb trigger with MODIFIER_PLAYER_ADD_CULTURE_BOMB_TRIGGER, and the modifier you make can take arguments of various types, like BuildingType,ImprovementType, DistrictType, etc:.

Since there's no reference for this, we have to use what we can pull from the base game or the DLCs. The DLC culture bomb civs do a bomb on Encampments, Forts, and Pastures, none of which need any RequirementSets.

However, I'd like to make a culture bomb that works on improvements over Strategic Resources. That means that, somewhere, I need to define a RequirementSet that gets referenced before a bomb actually happens. I tried using arguments of "SubjectRequirementSetId" and "OwnerRequirementSetId" on the list of arguments for a culture bomb trigger modifier, but neither seem to do anything. Does anyone have any info on this?

I can think of a workaround to still use MODIFIER_PLAYER_ADD_CULTURE_BOMB_TRIGGER, but it'd be pretty insane and would touch many tables. I wouldn't mind gaining plot ownership some other way, but there honestly doesn't seem to be a good way to get plots since you can't reference them in a CollectionType.
 
After some testing, it appears that this kind of requirement is impossible using XML. The reason it is impossible has to do with how the MODIFIER_PLAYER_ADD_CULTURE_BOMB_TRIGGER is set up in the XML architecture:

Code:
<Row>
            <ModifierType>MODIFIER_PLAYER_ADD_CULTURE_BOMB_TRIGGER</ModifierType>
            <CollectionType>COLLECTION_OWNER</CollectionType>
            <EffectType>EFFECT_ADD_CULTURE_BOMB_TRIGGER</EffectType>
</Row>

The Modifier is applied to COLLECTION_OWNER, which means, AFAIK, that any Requirement would be applied to the Owner (i.e. Civilization) of a given improvement, not to the improvement itself. For the same reason, OwnerRequirementSetId would seem to have no function at all in this case (i.e. there is no "Owner" to an "Owner"). SubjectRequirementSetId would apply the Requirement to the Civilization in question.

I put together the code that gets you halfway to where you want to be, but there seems to be no way to get the full effect. The code below ensures that if the first mine placed is not over a bonus resource, the culture bomb trigger lies dormant. However, as soon as a mine is placed over a bonus resource, the trigger is activated for all mines, regardless of presence of any resource. So, the code works only until you place a bonus resource mine -- until that point, the culture bomb trigger will not activate. However, as soon as a bonus resource mine is created, the culture bomb trigger activates every time a mine is placed.

Unfortunately, I see no way around this, other than via creating a new modifier and attaching it to a different Collection with the same Effect. However, I see no Collection that's appropriate in this case.

Code:
INSERT INTO Modifiers (ModifierID, ModifierType, RunOnce, Permanent, OwnerRequirementSetId, SubjectRequirementSetId) VALUES
('MINE_BOMB', 'MODIFIER_PLAYER_ADD_CULTURE_BOMB_TRIGGER', 0, 0, NULL, 'BONUS_REQUIREMENTS');

INSERT INTO ModifierArguments (ModifierID, Name, Type, Value, Extra, SecondExtra) VALUES
('MINE_BOMB', 'ImprovementType', 'ARGTYPE_IDENTITY', 'IMPROVEMENT_MINE', NULL, NULL);

INSERT INTO ImprovementModifiers (ImprovementType, ModifierID) VALUES
('IMPROVEMENT_MINE', 'MINE_BOMB');

INSERT INTO RequirementSets (RequirementSetId, RequirementSetType) VALUES
('BONUS_REQUIREMENTS', 'REQUIREMENTSET_TEST_ALL');

INSERT INTO RequirementSetRequirements (RequirementSetId, RequirementId) VALUES
('BONUS_REQUIREMENTS', 'REQUIRES_PLOT_BONUS');

INSERT INTO Requirements (RequirementId, RequirementType, Likeliness, Inverse, Triggered) VALUES
('REQUIRES_PLOT_BONUS', 'REQUIREMENT_PLOT_RESOURCE_CLASS_TYPE_MATCHES', 0, 0, 0);

INSERT INTO RequirementArguments (RequirementId, Name, Type, Value, Extra, SecondExtra) VALUES
('REQUIRES_PLOT_BONUS', 'ResourceClassType', 'ARGTYPE_IDENTITY', 'RESOURCECLASS_BONUS', NULL, NULL);
 
FOR CLARITY: I played around with adding requirements that exclude non-bonus resources and require that a resource be present in the plot (all together with requiring the presence of a bonus resource), but the effect was the same each time.
 
Yeah, I've tried a bunch of workarounds, but with no success. If we could remove modifiers, something could work, but the mechanic is exposed in a really rigid way. Culture bomb is the only mechanic that's "registered" someplace untouchable with an opaque effect in-advance, it can't be applied as an effect on the fly and it can't be shut off to my knowledge. That kind of makes it the only modifier effect you can't hang requirements on at all. I'm not sure why no directly plot-manipulating effect exists. Im guessing the core code for culture bombing was pushed out in a rush to get the Poland DLC out, so they cut every corner they could.

The only "permanent" solution I could find would be to rework the entire Improvement-related database, replacing "IMPROVEMENT_MINE" with the identical looking "IMPROVEMENT_MINE_STRATEGIC" or something, repeat that for pastures, and change the valid build resources for those improvements as well as the valid unit build table. That way, the actual improvement on Iron is different from the improvement on Copper or a bare hill, so the culture bomb trigger would work as intended.

That approach would have so many game-breaking side effects and weird edge cases, though, it's surely not worth it. Since there's no ImprovementReplaces table, a civ conquering your city with a hack improvement on it would keep that particular improvement probably, so you'd need to make sure the improvement works properly for all the other civs too. A bunch of boosts would break for sure, you'd have to use a LUA UI mod to hide the mess of multiple improvement types that shouldn't exist (not to mention get your hack improvement to replace the real one and appear on the build panel, which I'm struggling with at the moment), and the mod would probably be incompatible with any mods or official updates that manipulate improvements. The whole game structure expects that a Pasture is a Pasture is a Pasture, it'd be a hassle breaking and patching that up. I'm trying, but I suspect it'll just end as a learning exercise and won't make it into the mod. Bends too many things to expect it to work reliably.

I wouldn't fret so much if there were some other way to grant tiles, but the tools for manipulating city culture borders are really weak. The INCREASED_TILES modifier used for Mother Russia only applies to newly built cities, and GRANT_PLOT is only used for units to grant the plot under their feet. I can't figure out how to reconfigure the effect/collections to target and apply the effect to the plots surrounding some modifier owner, I don't think it's gonna fly (I've tried and tried for both).

We do have PLOT_YIELDS collections, which seems so close to what I'm looking for, but I'm not entirely sure what's in the collection that the collection types return. If it's a reference to each plot object in the appropriate domain specifically, then we'd be onto something, but I haven't been able to make any PLOT_YIELDS collections function with any effect other than EFFECT_ADJUST_PLOT_YIELD. I kind of want to investigate some more on what exactly the PLOT_YIELDS collections are referencing, but if they were so narrowly designed that nothing but EFFECT_ADJUST_PLOT_YIELD would work with them, it's pointless even if it technically gives you a list of actual plots in your city.

At any rate, thanks for looking into it! I tried the same thing and got the same result; once you turn the bomb on, there's no way to turn it off. Right now, it all seems pretty hopeless unless we get more direct Firaxis support/documentation and they say something about setting culture bomb triggers that we don't already know, or if future DLCs implement flexible new effects for getting plots.

I'll just make improvements over strat resources give cultural border expansion bonus to the city its in I guess. Same spirit more or less.

It's weird that something which seems simple enough is actually such a pain. I have trouble believing Firaxis designers never intended for culture bombs to be complex enough to need requirements.
 
Last edited:
I've been trying to do something similar. I want to add a rainforest adjacency requirement to culture bombs for Brazilian districts...but since the effect is at the player level I can't check a requirement at the plot level. If I could make the effect at the district/plot level it would work, but there's no way to mess with the culture bomb.

I've just been hoping they'll properly implement it later so we can mess with it.
 
@StandardGaussian

Good news! I now have functional code in LUA that implements CultureBomb functionality for an improvement placed on a strategic resource (I haven't coded yet the little detail of ensuring that the improvement added to the plot improves the strategic resource, but it is not strictly necessary, as the code requires that the strategic resource in question be visible to the player, and the game wouldn't usualy allow an unrelated improvement to be placed on top of a visible strategic resource, so I'll get to this detail at my leisure).

The cool part about the LUA implementation is that I can set the radius of the CultureBomb to anything I want - from 1 plot to (I would imagine) 20 plots. LUA is not hampered by the XML straitjacket constraints. I don't know yet what would happen if the area of the CultureBomb encompasses a non-player district or another civ's city center district, and this requires some testing. But any potential problems can be avoided by excluding such plots from the effect of the function. Similarly, I suspect I can make a LUA CultureBomb affect only ''wild'' plots that don't belong to another player (or even parse it down to a difference between plots that belong to a City State vs. a Major Civ). There is really no obvious limit to customization here. For seafaring civilization, a CultureBomb can be tailored to favour water tiles, while land-lubbers can be given an effect that avoids water plots.

I'll post the code once I'm satisfied I've cleaned up and tested it enough.

@Atlas627

This LUA approach can be tailored to your specific objective as well, with a bit of tinkering. It probably only needs one or two extra lines that check whether any of the plots adjacent to the center of the CultureBomb matches the desired feature, and then be tied to the addition to the map of a district. Function:

function OnDistrictAddedToMap( playerID: number, districtID : number, cityID :number, districtX : number, districtY : number, districtType:number, percentComplete:number )​

has all the required elements: coordinated, player reference, district reference, and, importantly the percentComplete:number, which would trigger the CultureBomb when percentComplete=100. I'll see what I can do. Let me know if you have other specific requirements for the function you need.
 
ADDITION: Actually, thinking even further, the LUA method might even allow us to resurrect the Civ IV mechanic of culture borders stealing territory from competing civs if the culture generation of a city is high enough. There is really no end to creativity :)
 
Thanks so much! The thing I want most is for someone to explain to me the basics of Lua so I can start messing with things like this myself, because as you point out xml only gets us so far. The particular function I'm looking for here is to do a full culture bomb when Brazil places a district adjacent to rainforest, but a culture bomb that can only grab neutral tiles or rainforest tiles would be cool to mess with and open up options in the future.
 
Hey there, @Atlas627 and @StandardGaussian!

I have posted the following small mods that do what you want them to do. See here: LINK. Uploading them here also.

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

  • District Culture Bomb.zip
    3.2 KB · Views: 61
  • Strategic Culture Bomb.zip
    3 KB · Views: 82
Hey! Glad to be of help! However, I've updated the code somewhat. I'll post the revised version later today. Keep a lookout. :)
 
Top Bottom