How does one change the buildings required for a quest? Where is that in the code?

Galgus

Emperor
Joined
Aug 22, 2012
Messages
1,705
I need to change some of the buildings required for some quests for an affinity building mod that makes some of them mutually exclusive.

Changing the text seems simple enough, but I'm not sure where to look for ways to actually change the building required.
 
If you go into the LUA for the affinity quest in question, buildings involved in the quest are typically referenced in the top of the code with via calling their ID; changing which building it calls and then reupdating the quest in the mod should fix it.
 
Worth noting that if you edit quests you need to import them as 'Quest', not 'IngameUIAddin' or else the lua that handles quests will not find it.
 
For Solid State Citizen, would this be the part where it calls the ID for the Gene Garden?

Code:
local newObjective = AddObjective(quest, "QUEST_OBJECTIVE_BUILD_BUILDING", "BUILDING_GENE_GARDEN", 1);
	newObjective:SetEpilogue(Locale.ConvertTextKey("TXT_KEY_QUEST_SOLID_STATE_CITIZEN_END_PURITY"));

	return BehaviorStatus.IN_PROGRESS;

I don't have much experience dealing with Lua, do you know of any reference code on how to change the building called and reupdate a quest?
_________________

Also, if you remember any of these buildings being tied to non building decision quests, it would help me finish this.

Terra Vault, Skycrane, Mantle, Gene Garden, Gaian Well, Growlab, Xenofuel Plant, Borehole, Microbial Mine, Bionics Lab, Bioglass Furnace, Organ Printer, Molecular Forge, Biofactory, Feedsite Hub, Optical Surgery, CEL Cradle, Augmentery, Neurolab, Hypercore, LEV Plant.

Off the top of my head I'm pretty sure the Gene Garden and Neurolab both have quest tie-ins, but I will need to check all of them.
 
Yes, that creates a quest objective that requires you to build 1 gene garden.

To update it you simply change the BUILDING_GENE_GARDEN to BUILDING_WHATEVER_YOU_WANT, set the Lua to 'Import into VSF = true' and load it as Type 'Quest'.
 
I've been looking into what calls what myself - Harmony Quests call Microbial Mine, Xenonursey, Mass Digesters, Xeno Santuaries, and Organ Printers (for some reason...) in single quests, while chains call Ultrasonic Fence (multiple times), Xeno Nursery, Laboratory and Vivarium, Supremacy calls Neurolab and CEL cradles in single quests, and Launch Complexes, Alloy Factories, Laboratories, and more Neurolabs in quest chains (while caching, but not using Holosuites, Gene Gardens, and Boreholes, likely as a result of development changes), and Purity uses Old Earth Relics, Bionics Labs, and Pharmalabs (in multi chain), and Laboratories.
 
@Ryika

Do you know of of any general reference code on changing such things in lua?

I'm fimiliar with Where type = / Set X = in XML, but I don't know how to modify lua code properly.
_______________

@GenEngineer

Thanks for that.
 
Lua doesn't work like XML, you can't update variables within lua files without replacing the whole file (edit: At least if the building is hardcoded as they are in the Quests). The way you'd go about updating a quest is to drag a copy into of the original file into your mod (prefering the Rising Tide one if there's one in the AddOn- and the Original Folder), set it to VFS = true and adding it as Type Quest in the Content-Tab (while using the file name without the .lua extension as Name)*.

*(Side Note: Adding the file in the content tab is only required because of how the quest system recognizes quest scripts, usually setting VFS = true is enough to replace an original lua file)

Then you can make the changes you want in that file (in this case simply replacing the Building-Tag with whatever building you want to use) and the game will load the new file with your changes instead of the original one. That does of course mean that your mod will not be compatible with other mods that also want to add custom versions of that lua file, because they will just be overwritten and only the one that is loaded last will actually be active, but that cannot be avoided. When you run into a situation where you want to make changes that are different from the area that your mod generally is designed for (for example changing quests in a mod that deals with buildings) you should make a judgement call on whether it is more beneficial to make these changes and risk compatibility issues with other mods (in this case bigger quest overhauls would become somewhat incompatible) or whether it is better to keep the files as they are to ensure maximum compatibility.

In general if you want to get into more depth about lua I'd suggest reading/watching some basic lua guides to start off with, once you have a basic understanding it becomes relatively easy to just use examples from the game files and other mods to do whatever it is you want to do (Of course for the task at hand that's not required).
 
I see, thanks for all the help.

In this case I think the compatibility costs are worth it, otherwise players would have to choose between following a quest and keeping their current affinity/ building strategy.
 
Top Bottom