Quick LUA and Defines question

Gazebo

Lord of the Community Patch
Supporter
Joined
Sep 26, 2010
Messages
18,399
Location
Little Rock
Hey all,

LUA is utterly foreign to me. Seems logical enough, but I haven't the time to invest dozens of hours trial-and-erroring my way through it. Anyways, here's the question:

Is it possible to use a LUA script to modify a value from the <defines> part of the database? What I want to do is pretty simple: at a technology in which one of my later diplo units for CSD is unlocked (say, Civil Service), I would like to have the game bump the influence value of a trade (diplomatic) mission by a set amount (say 5, for example's sake). So, in other words, the LUA would roughly look like this (abstractly-speaking):

if playerx has tech x (writing),
then MINOR_FRIENDSHIP_FROM_TRADE_MISSION should equal 35

if playerx has both tech x (writing) and tech y (civil service),
then MINOR_FRIENDSHIP_FROM_TRADE_MISSION should equal 40

And so on for each necessary tech in the tree.

So, is this possible with our current set of tools? If so, I'm willing to learn how to make it happen, however I might need a bit of help from anyone who is willing. CSD will be the better for it if I can finally implement a scaling influence system.

Thanks in advance,
Gazebo

Moderator Action: Moved to main C&C forum.
 
Your question is not really a Lua question. It's a database question.

Question: Can I modify a database entry during the game?

Answer: No. (Well actually yes, but the game engine won't see it.)

However, we can now affect civ relationships in Lua (in G&K, not vanilla), which is what you really want to do. See post #14 in this thread.
 
Also, the Defines are the same for all players, they can't be different for different players.
 
Also, the Defines are the same for all players, they can't be different for different players.

That was my assumption. Unfortunate, but understandable.

Pazyryk said:
However, we can now affect civ relationships in Lua (in G&K, not vanilla), which is what you really want to do. See post #14 in this thread.

Does this work for minor civs? Your post makes it seem like a major civ-only affair.
 
They are separate functions. So yes, the method in that post would be for major only. I'm not familiar with modding minor relationships. I think those functions have always been there in the API, but I don't know them off the top of my head.
 
I think those functions have always been there in the API, but I don't know them off the top of my head.

Yes, they have. Major-Minor relationships (i.e., Influence) have always been easily adjustable. It's only the Major-Major relationships that we hadn't been able to adjust until now.
 
Yes, they have. Major-Minor relationships (i.e., Influence) have always been easily adjustable. It's only the Major-Major relationships that we hadn't been able to adjust until now.

Excellent. So, with regards to my first post, what part of the database could I link the LUA event to in order to have scaling influence during a game? Techs? Units? Eras? As I said, I am utterly in the dark here.

Thanks for your help, everyone. Always appreciated.
G
 
I'm not sure that we can do what you want, I like your mod, and have already thinking a bit about that, the problem is the following:

- we can change civilization influence with city-states directly, using player:ChangeMinorCivFriendshipWithMajor(value)
- but we must link it to the use of diplomat units, and I'm not sure we can capture that event.
 
Your question is not really a Lua question. It's a database question.

Question: Can I modify a database entry during the game?

Answer: No. (Well actually yes, but the game engine won't see it.)

However, we can now affect civ relationships in Lua (in G&K, not vanilla), which is what you really want to do. See post #14 in this thread.

...so much win here it's not even funny. This is perfect (now I can make starting alliances in scenarios/customize when they break. :) )
 
I'm not sure that we can do what you want, I like your mod, and have already thinking a bit about that, the problem is the following:

- we can change civilization influence with city-states directly, using player:ChangeMinorCivFriendshipWithMajor(value)
- but we must link it to the use of diplomat units, and I'm not sure we can capture that event.

That's what I was afraid of. The only great person event I can think of that might trigger a capture-able event would be a golden age (for artists), but that can also occur without a great person, so it is probably a false strand of hope.

In any case, I've resigned myself (for now) to sticking with the scaling costs and movement speed system for CSD.
 
Top Bottom