Reload and effects applying twice (isn't about Court Festival anymore)

Aurelesk

King
Joined
Oct 26, 2017
Messages
627
I no longer have a little problem. I found it!

What was the problem?
During an uninterrupted playthrough, the code I wrote works "normally." It gives +1 Culture to Luxury resources for every adjacent specialty Districts. The problem arises when I save and reload: the bonuses are doubled.
Example: a Truffles' Camp next to 2 specialty districts jumps from 2 to 4 Culture after a reload. What is causing that?
(I will put that on top of the thread, and edit it accordingly)

The code I wrote is basically:
Take the REQUIRES_PLOT_HAS_IMPROVED_LUXURY RequirementId from the base game
Create a RequirementId for every specialty districts in existence through the RequirementType REQUIREMENT_PLOT_ADJACENT_DISTRICT_TYPE_MATCHES
Combine all of them inside a RequirementSetId.
Create a Modifier that gives 1 Culture through MODIFIER_PLAYER_ADJUST_PLOT_YIELD if RequirementSetId is true, and link that to the TraitType of my leader.

The answer:
Spoiler Here why :

By taking every specialty districts in existence, wanting to make the mod potentially adapt to new districts from the future, I also took all the unique. For some reason, they don't count on a playthrough, but suddenly count on a reload, explaining why some only give +2 and other +3). I think? Well, it is solved now


Spoiler What was the thread about before the edit? :
I have a few days off and told myself: what if I learn how to use Modbuddy and code some changes!
Worst idea ever.

I am stuck. I desperately tried to make Court Festival yields Tourism depending on all Luxuries in possession, not only duplicates. Simple? No!
I quickly learnt:
- Tourism isn't a Yield
- Basically almost all Yield modifiers are %Tourism, not flat Tourism
- MODIFIER_PLAYER_GRANT_TOURISM_PER_EXCESS_LUXURIES seems to be the only DynamicModifier that could give flat Tourism, but seems hard coded to only detect duplicates with no hope to change that.
- I didn't manage to find a way to use MODIFIER_PLAYER_UNITS_ADJUST_PER_LUXURY_ATTACK_MODIFIER, since it doesn't count (?). Even if I could: Tourism isn't a yield.
- I tried to add then remove 1 extra Luxury to all already owned when the COURT_FESTIVAL is completed, but it seems to give/remove them after it is completed, so no results.
- I even tried to create a dummy unit/building that would do a Rock Band Tourism Bomb of an amount of Tourism equal to how many differents luxury I have, but seems to not work.

Perhaps, I went too far and the answer is simple. Perhaps, there is no answer. But what can I do?

Please, help me!
 
Last edited:
I've had many different ideas but they're not possible even with Lua, so I advise you to modify the skill and compensate in another way; it's less stressful. And since France is on the topic, would you like to give me your opinion on my skills as leaders Louis XIV and Cardinal Richelieu?
Spoiler Richelieu :
I designed Richelieu as a leader with a governor, Father Joseph, who changes his policy cards to wildcard spaces through his promotions, gaining effects like +15% to Unit Production in the Capital, but which also have negative effects such as Each level of Walls reduces the Loyalty of your cities by 4. His last 2 promotions also give his spies the ability to generate a lot of disloyalty to enemy cities and make other units take more gold from their treasury when they are away.

Spoiler Louis XIV :
I designed Luis around the Palace of Versailles, a District that replaces Government Square and receives bonuses based on the number of buildings constructed: first gold and faith, then science and culture, and finally a simple but powerful +25% to all your tourism. And as the cherry on top, when a Great Person is near Versailles, they will grant an extra +5% to their respective type of output across your entire empire, and triple that when they are in the palace.
 
Last edited:
I've had many different ideas but they're not possible even with Lua, so I advise you to modify the skill and compensate in another way; it's less stressful. And since France is on the topic, would you like to give me your opinion on my skills as leaders Louis XIV and Cardinal Richelieu?
Spoiler Richelieu :
I designed Richelieu as a leader with a governor, Father Joseph, who changes his policy cards to wildcard spaces through his promotions, gaining effects like +15% to Unit Production in the Capital, but which also have negative effects such as Each level of Walls reduces the Loyalty of your cities by 4. His last 2 promotions also give his spies the ability to generate a lot of disloyalty to enemy cities and make other units take more gold from their treasury when they are away.

Spoiler Louis XIV :
I designed Luis around the Palace of Versailles, a District that replaces Government Square and receives bonuses based on the number of buildings constructed: first gold and faith, then science and culture, and finally a simple but powerful +25% to all your tourism. And as the cherry on top, when a Great Person is near Versailles, they will grant an extra +5% to their respective type of output across your entire empire, and triple that when they are in the palace.
Tonight, I will try to create a Dummy Luxury with 0 Amenity, try to make it impossible to see/trade, and run a Lua script that give as much of that Dummy that we have different Luxuries.

Your ideas are nice. Palace of Versailles sounds nice, even more if you are willing a new model for it! I do not understand the +5% empire wild yield per Great Person. It is when they are within X tiles of the districts, or when expanded withing X tiles of the district ? If the later, it seems very potent, perhaps too potent. Antanaviro's bonus already give 2% Culture per Great Person and it is capped to 30% (probably for balance reason) and is considered a quite good end-game City States. Richelieu is a nice idea too. I am looking forward to try your mod when you release it.
 
Basically, it consists of gathering Great Persons around Versailles; they must be adjacent to the district. The one in the center gives 15%, simulating a court full of figures like Colbert, Lully, and Moliere.
 
Interesting. I'm curious to know if it's even possible with just SQL. I've spent so much time trying to find solutions, sometimes impossible ones, that I've had to resign myself to making compromises.

A bit like this Court Festival issue (you know, the subject of this thread) where it won't recognize the first Luxury Resources of each type. I spent so much time trying to create a Dummy Resource to compensate for this issue, to the point where I'm only half satisfied with the gameplay I could code but dismayed by the aesthetics. [LOC_DUMMY_RESSOURCE] tags scattered here and there: it doesn't look professional.

So... I'll turn it into a feature. I'll legitimize this Dummy Resource. And I think I've gone a bit too far.

Spoiler Introducing... The Delicacy Luxury Resource :
Capture d'écran 2026-01-30 022352.png

Well, that's clearly not what I had in mind. But who says that minor errors due to incompetence can't be happy accidents?
 
Just an update (and a cry for help below). I gave up on the idea of making Court Festival triggers on every currently enjoyed luxury resource. Meanwhile, I have a problem about something else.

During an uninterrupted playthrough, the code I wrote works "normally." It gives +1 Culture to Luxury resources for every adjacent specialty Districts. The problem arises when I save and reload: the bonuses are doubled.
Example: a Truffles' Camp next to 2 specialty districts jumps from 2 to 4 Culture after a reload. What is causing that?
(I will put that on top of the thread, and edit it accordingly)

The code I wrote is basically:
Take the REQUIRES_PLOT_HAS_IMPROVED_LUXURY RequirementId
Create a RequirementId for every specialty districts in existence through the RequirementType REQUIREMENT_PLOT_ADJACENT_DISTRICT_TYPE_MATCHES
Combine all of them inside a RequirementSetId.
Create a Modifier that gives 1 Culture through MODIFIER_PLAYER_ADJUST_PLOT_YIELD if RequirementSetId is true, and link that to the TraitType of my leader.
 
Last edited:
Back
Top Bottom