[GS] Code Assistance Required for Custom Civ

suvic

Chieftain
Joined
Nov 10, 2020
Messages
7
Hello!

I was wondering if anyone would be able to aid me with the code needed to achieve the following effects within a custom civilization:

1) Causing loyalty in bordering enemy cities to drop when receiving a declaration of war, for x turns
2) Receiving a certain percentage of production cost, as science, when production is completed on certain buildings (originally, this pertained to city projects, but I eventually found out they were very similar in production cost)
3) Allowing units to gain defensive combat adjacency bonuses when on, or adjacent to, a certain unique improvement

From the help I am very grateful to have been given, I figure that one or more of these would require some level of coding in LUA, which I have no knowledge of - most likely the first of the three. I'm still learning, but if code references are needed -

1) This appears to be plausible with a combination of both Eleanor and Curtin's code, for both loyalty modifiers by proximity, and time-limited bonuses (?)
2) This should be possible with an adaptation with the new Ayutthaya CS (?)
3) This appears simple, but the adjacencies might have to be different - a certain value for being adjacent to the UI, another for being inside it.

All other components of the civilization mod, save graphics, models, and music, should be completed. (Any advice on implementing music or graphics especially would be much appreciated!)

Again, thank you in advance!
 
1) Eleanor's Trait triggers a modifier that only cervs for that trait.
ModifierId: "IDENTITY_NEARBY_GREATWORKS"
ModifierType: "MODIFIER_PLAYER_ADJUST_IDENTITY_PER_TURN_FROM_NEARBY_GREAT_WORKS"
The ModifierArguments targets the modifier toward ForeignCities, but that's only to make sure that your Cities Nearby aren't affected by it.
I didn't find any Effect or Requirement for a Neighbour (or the Time effect). There are "EFFECT_ADJUST_CITY_IDENTITY_PER_TURN" and "EFFECT_ADJUST_CITY_IDENTITY_PER_CITIZEN"), and you can use Identity Pressure ("EFFECT_ADJUST_CITY_IDENTITY_PRESSURE"). But I don't know how you can make that affect your Neighbours. I'm not an expert in Lua and have just started learning it, but as far as I know you CAN change the identity in a certain city (or Cities), maybe also making a Turn-limit, but I don't think it's possible to target neighbour Cities explicitly (we have limited Lua objects that we can use, and most of them affect only UI), maybe with a lot of workaround and with advanced lua coding.

Edit: There is "EFFECT_ADJUST_GOVERNOR_IDENTITY_PRESSURE" from Amani's Emissary Promotion, which can affect both, your and other players Cities within 9 Tiles.

you can try this:

Modifiers:
Code:
ModifierId: "CANTONESE_IDENTITY_PRESSURE_TO_FOREIGN_CITIES"
ModifierType: "MODIFIER_GOVERNOR_ADJUST_GOVERNOR_IDENTITY_PRESSURE"
ModifierArguments:
Code:
ModifierId: "CANTONESE_IDENTITY_PRESSURE_TO_FOREIGN_CITIES"
Name: Amount. Value: 1 (How much identity per turn)
Name: ForeignCities. Value: 1

For requirement use "REQUIRES_MAJOR_CIV_OPPONENT" (Couldn't find a requirement for receiving a war declatation, only declaring war yourself).

But I don't know if it will work without the Governor. So just try it and you will know.

2) I suppose Aytthaya is in the Babylon DLC, that I don't have it. You can look in that DLC's folder, most likely it will be possible to change the Yields and Percentage. If not, Lua could do that.

3) I couldn't find any requirement for adjacent Improvement for Units. There is "REQUIREMENT_ATTACKER_PLOT_IMPROVEMENT_TYPE_MATCHES" a requirement for a Unit occupying a scpecific Improvement, and "REQUIREMENT_UNIT_IN_ENEMY_TERRITORY" that you could use instead. (there are lots of adjacency requirements for opponent units)

I've read in your other Thread that you're doing this for a Portfolio Project for University. Wish you every success with it!
If i could give you some advice, befor you think of adding a certain Abbility/Effect/requirement... etc. make sure that it's moddable, befor you waste too much Time on something that can't be done. Just have a look on what's already in the Game, and be creative changing it to something else/New, Just like what you mentioned in your second Question.

And good Luck with your Portfolio!
 
Last edited:
Edit: There is "EFFECT_ADJUST_GOVERNOR_IDENTITY_PRESSURE" from Amani's Emissary Promotion, which can affect both, your and other players Cities within 9 Tiles.

you can try this:

Modifiers:
Code:
ModifierId: "CANTONESE_IDENTITY_PRESSURE_TO_FOREIGN_CITIES"
ModifierType: "MODIFIER_GOVERNOR_ADJUST_GOVERNOR_IDENTITY_PRESSURE"
ModifierArguments:
Code:
ModifierId: "CANTONESE_IDENTITY_PRESSURE_TO_FOREIGN_CITIES"
Name: Amount. Value: 1 (How much identity per turn)
Name: ForeignCities. Value: 1

For requirement use "REQUIRES_MAJOR_CIV_OPPONENT" (Couldn't find a requirement for receiving a war declatation, only declaring war yourself).

But I don't know if it will work without the Governor. So just try it and you will know.

Where would I put these in XML exactly? I'm using MC's format.
 
Top Bottom