1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

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

Discussion in 'CivBE - Modding Help & Mod Creation' started by Galgus, Mar 19, 2016.

  1. Galgus

    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.
     
  2. GenEngineer

    GenEngineer Prince

    Joined:
    Aug 24, 2014
    Messages:
    456
    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.
     
  3. Ryika

    Ryika Lazy Wannabe Artista

    Joined:
    Aug 30, 2013
    Messages:
    9,395
    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.
     
  4. Galgus

    Galgus Emperor

    Joined:
    Aug 22, 2012
    Messages:
    1,705
    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.
     
  5. Ryika

    Ryika Lazy Wannabe Artista

    Joined:
    Aug 30, 2013
    Messages:
    9,395
    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'.
     
  6. GenEngineer

    GenEngineer Prince

    Joined:
    Aug 24, 2014
    Messages:
    456
    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.
     
  7. Galgus

    Galgus Emperor

    Joined:
    Aug 22, 2012
    Messages:
    1,705
    @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.
     
  8. Ryika

    Ryika Lazy Wannabe Artista

    Joined:
    Aug 30, 2013
    Messages:
    9,395
    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).
     
  9. Galgus

    Galgus Emperor

    Joined:
    Aug 22, 2012
    Messages:
    1,705
    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.
     

Share This Page