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:
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
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!
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: