Modify Mine Improvement's Appeal for Australia

Codenaugh

Chieftain
Joined
Nov 30, 2016
Messages
20
Australia is tough to play since you need mines and mines give you -1 appeal to adjacent tiles. I want to create a modification where their mines give 0 instead of -1 appeal to adjacent tiles. However, I'm struggline to make it happen.

I've tried adding a player_cities_adjust_appeal modifier with a adjacent to mines SubjectRequirementSet, but it doesn't work. I think this is due to the SRS being related to plots while the modifier is related to cities. There is no single plot appeal adjustment modifier type.

I also thought about creating a unique improvement that is a mine clone, and attaching it only to Australia but this means they will have 2 mine icons and would have to pay close attention to which one they use, which seems messy.

Anyone have any good ideas?
 
This is a very quick answer, primarily citing a similar discussion I found, as I'm not in a position to go through code at the moment.

The same conundrum was asked here: https://forums.civfanatics.com/thre...nts-without-replacing-the-improvement.629005/

There seem to be some meaningful answers. Maybe it'll help? That being said, perhaps not as Appeal isn't a yield.

Codenaugh said:
I also thought about creating a unique improvement that is a mine clone, and attaching it only to Australia but this means they will have 2 mine icons and would have to pay close attention to which one they use, which seems messy.

Along the lines of this, you may want to create a duplicate of the Mine and bind it to Australia as a Unique Improvement. That way you can control the Appeal very easily. On the flip-side, you may then want to add a TraitType to the standard IMPROVEMENT_MINE and bind that to all other civs. This solves the duplicate-mine problem and, in terms of volume of code, is pretty minimal. It'll 'feel' like a long-way-round, but it'd work. You just need two Traits - one for Australia, one for everyone else, and one new improvement, configured to your liking.
 
Thanks. So I decided to try the custom improvement and it does work, but the problem now is that adding a trait to mines has caused 4 era points whenever someone constructs their first mine because the game now believes it is a unique improvement. Any way to suppress that?
 
I suppose what I need to figure out is how unique city-state improvements don't trigger unique improvement moments. They seem to be added in the same way I added my custom mine, but the icon is not present unless the player is suzerain.
 
Codenaugh said:
Thanks. So I decided to try the custom improvement and it does work, but the problem now is that adding a trait to mines has caused 4 era points whenever someone constructs their first mine because the game now believes it is a unique improvement. Any way to suppress that?

Not without suppressing the era points for all unique improvements, I don't think. I believe the thing that the game recognises as a 'unique' improvement is the fact that the trait is attached to a civilization. Unfortunately, I can't see that it can be recognising it any other way.

I suppose what I need to figure out is how unique city-state improvements don't trigger unique improvement moments. They seem to be added in the same way I added my custom mine, but the icon is not present unless the player is suzerain.

I think the reason this differs from a unique improvement attached directly to a civilization is that the trait is attached to the city-state. However, looking at how they grant the ability for a civilization to build an improvement, I think this may give you what you need. The way they achieve it is by not setting a prerequisite tech/civic for the improvement. They then set a modifier against the city-state which triggers when the necessary Suzerain influence is triggered. What this does is apply a modifier to the Suzerain of the type MODIFIER_PLAYER_ADJUST_VALID_IMPROVEMENT. It then specifies which improvement-type should be granted.

For it to work in your use-case, I think you need to take the same approach - strip the Trait from the custom mine improvement and also remove the PrereqTech. Then apply Australia a Trait and create a TraitModifier of the type MODIFIER_PLAYER_ADJUST_VALID_IMPROVEMENT. Setup a requirement to go with it which is of the type REQUIREMENT_PLAYER_HAS_TECHNOLOGY. This should, essentially, mimic the requirement to research Mining to unlock the custom mine, for Australia. This should make the custom mine available only to Australia.

I do not know if there is a smart and easy way to use the same/similar logic to prevent the IMPROVEMENT_MINE from being built by Australia. In theory, you could apply the same logic as above to IMPROVEMENT_MINE, but for all other civilizations except Australia...but that feels long-winded. Ideally you would use the same requirement to toggle IMPROVEMENT_MINE to become invalid for Australia upon researching the Mining technology - but I cannot think of how that could be achieved right now.
 
It's a great idea. I've been playing with doing that all day, but the trouble is that not having a PrereqTech causes it to always be unlocked for every civ from the beginning of the game, even if I have a TraitModifier specifically added to John Curtain to unlock it. I even tried setting Buildable to 0 but I don't see that property having any effect on the game. It must be doing some sort of minor vs major civ in the background to determine whether it's a unique improvement or not.
 
Ok my dood, I've got it figured out. For reference and anyone who is interested, I applied a fake trait to the custom mine improvement. This makes it so the improvement is not unlocked for anyone unless they have that trait. If you give someone that trait, it makes it a unique improvement, so I give no one that trait. Instead, I create a new TraitModifier of type MODIFIER_PLAYER_ADJUST_VALID_IMPROVEMENT which is attached to TRAIT_LEADER_MAJOR_CIV. That modifier has a subject requirement set for IS_LEADER_JOHN_CURTIN and HAS_TECH_MINING. Then I do the same for the regular mine improvement (attached a fake trait) and create a new TraitModifier which has a SRS that is IS_NOT_LEADER_JOHN_CURTIN and HAS_TECH_MINING. This applies it to everyone who isn't JC. So everyone gets the regular mine except JC and JC gets the custom mine. The only downside here is that the tech on the tech tree no longer has the icon showing that the mine improvement is unlocked there. Very minor downside IMO.
 
So after a while, I had to pull this out. Apparently creating a custom improvement that is similar to one that already exists causes issues with the base game version improvement yield modifiers. For example, Gaul culture on mines stopped working. I also took this approach to give Brazil early Lumbermills on Jungle and now Canada's Lumbermills no long give extra production. Can anyone think of a reason why this might be? I feel like the requirements have stopped returning true even though nothing has technically changed with the original improvement besides adding a false trait to the original improvement and copying its xml to my artdef file, which I will include (renamed to .xml to allow for upload). I'll also include my dep file. I've already pulled mines from the artdef file and mod, so this only has the Lumbermill added. Hoping to find a fix.
 

Attachments

  • Legacy BBG.xml
    15 KB · Views: 30
  • Improvements.xml
    7.4 KB · Views: 34
Top Bottom