Is there an "update" equivalent for lua files?

shandelman

Chieftain
Joined
Nov 2, 2014
Messages
13
So, following up on this thread:
http://forums.civfanatics.com/showthread.php?t=536843

I would like to try changing these values so that building quests are generated more quickly (which also lowers the variance, making the game less random.)
Impatient fellow that I am, I was thinking:
local TRIGGER_CHANCE = 25;

There are plenty of good examples/tutorials for updating the xml files, but that constant is defined in the lua file itself.

So the closest example I can find is this mod:
http://steamcommunity.com/sharedfiles/filedetails/?id=336089354

BUT, the way he does it, he overwrites the existing new outpost quest and then changes the xml to point to that new quest instead.

So I could... make a copy of the entire lua file for building quests, rejigger the correpsonding xml to point to my new quests instead of to the old ones, and change the value of the global define?

But that seems highly inelegant when all I want to do is change a single number.

--Thanks
 
So I could... make a copy of the entire lua file for building quests, rejigger the correpsonding xml to point to my new quests instead of to the old ones, and change the value of the global define?

But that seems highly inelegant when all I want to do is change a single number.

--Thanks

The only other option I see is replacing the entire Lua file. It might be an inelegant solution (ish), but it's better than overwriting things. Adding a new Lua file and then updating XML to point to it avoids conflicts with other mods that might try to change, or for whatever reason reference, the original Lua file.
 
No, there's no way to just update a local variable outside of that variable's scope.

However, see the bottom of the block that actually uses the TRIGGER_CHANCE variable:
Code:
GameEvents.BuildingProcessed.Add(QuestScript.OnBuildingProcessed);

You can similarly hook your own function to that event.
 
Back
Top Bottom