[Lua] What would be the simplest way to replace a required building for a quest?

Galgus

Emperor
Joined
Aug 22, 2012
Messages
1,705
And is any of the quest tech automatically generated?

I'm wanting to improve a recent mod that makes all affinity buildings exclusive to one another and adds new ones by making sure that no affinity quests assign a building in that exclusive list.
 
All the quests are either in...
Steam\steamapps\common\Sid Meier's Civilization Beyond Earth\assets\DLC\Expansion1\Gameplay\Lua\Quests

Or, if they weren't updated in Rising Tide, then in...
\Steam\steamapps\common\Sid Meier's Civilization Beyond Earth\assets\Gameplay\Lua\Quests

All Quest Objectives can be found and edited in those scripts.

To make the game load custom Quests, you have to import them into the VFS, and Load them via the Content Tab as Type: Quest and Name: <Name of the File without the .lua Ending>.
 
Looking at the Codex mod for reference, do you basically just copy the quest code with into a Lua file of the same name and Quest content type with import into VFS on, and it overrides the existing quest?

It seems straightforward, but if there a way to bug test it quickly?

Thanks for all the help.
 
Yeah, either you copy-paste the code, or you just drag the file itself into the mod. As long as it is loaded properly and has the same name, it will replace the original quest.

FireTuner has a panel that allows you to start quests manually for testing.
 
Thanks, that makes this much less daunting than I'd expected.
 
Yeah, either you copy-paste the code, or you just drag the file itself into the mod. As long as it is loaded properly and has the same name, it will replace the original quest.

FireTuner has a panel that allows you to start quests manually for testing.

How do you use the panel that allows for starting quests manually?

And how do you change the prerequisites for a quest?

I'm a bit confused by this Acclimation quest as an example.

Apparently it requires a Borehole and Gene Gardens, but I'm not sure exactly where.

Code:
        ----------------------------------------------------
        -- Build Borehole
        ----------------------------------------------------
        ActionNode{function(quest, objective)
            if (quest.PersistentData.HasBuiltBorehole == true) then
                return BehaviorStatus.SUCCEEDED;
            end
         
            if(objective ~= nil and objective:GetType() == GameInfo.QuestObjectives["QUEST_OBJECTIVE_BUILD_BUILDING"].ID) then

                -- Set epilogue
                local buildingName = GameInfo.Buildings[MINE_TYPE].Description;
                local cityData = quest.PersistentData.City;
                local plot = Map.GetPlot(cityData.X, cityData.Y);
                local city = plot:GetPlotCity();

                objective:SetEpilogue(Locale.ConvertTextKey("TXT_KEY_QUEST_ACCLIMATION_OBJECTIVE_BUILD_BOREHOLE_EPILOGUE", city:GetName(), buildingName));

                quest.PersistentData.HasBuiltBorehole = true;
                return BehaviorStatus.SUCCEEDED;
            end

            -- find city
            local city = QuestScript.CityNearCanyon(quest:GetOwner());

            quest.PersistentData.City = {};
            quest.PersistentData.City.X = city:GetX();
            quest.PersistentData.City.Y = city:GetY();

            -- Set the prologue
            quest:SetPrologue(Locale.ConvertTextKey("TXT_KEY_QUEST_ACCLIMATION_PROLOGUE", city:GetName()));

            -- objective
            local buildingName = GameInfo.Buildings[MINE_TYPE].Description;

            local newObjective = AddObjective(quest, "QUEST_OBJECTIVE_BUILD_BUILDING", MINE_TYPE, MINE_NUMBER_TO_BUILD, city:GetID());

            return BehaviorStatus.IN_PROGRESS;
        end},

The Pure Advantage quest also seems to call for Organ Printers while I don't see that anywhere in the code.

Is that just an error, or where is the organ printer code?

Code:
----------------------------------------------------
-- Constants
----------------------------------------------------

local BIONICS_LAB_TYPE = GameInfo.Buildings["BUILDING_BIONICS_LAB"].ID;

local ENERGY_REWARD = 50;
local CULTURE_REWARD = 50;

local AFFINITY_REWARD = 50;

local BehaviorTree : CvBehaviorNode = BehaviorTree{
    SequenceNode {
        ----------------------------------------
        -- Build Organ Printers
        ----------------------------------------
        ActionNode{function(quest, objective)
            if (quest.PersistentData.HasBuiltBuildings == true) then
                return BehaviorStatus.SUCCEEDED;
            end
            
            if(objective ~= nil and objective:GetType() == GameInfo.QuestObjectives["QUEST_OBJECTIVE_BUILD_BUILDING"].ID) then
                quest.PersistentData.HasBuiltBuildings = true;
                return BehaviorStatus.SUCCEEDED;
            end

                -- Set the prologue
                quest:SetPrologue(Locale.ConvertTextKey("TXT_KEY_QUEST_PURE_ADVANTAGE_PROLOGUE"));

                -- new objective
                local newObjective = AddObjective(quest, "QUEST_OBJECTIVE_BUILD_BUILDING", BIONICS_LAB_TYPE, 1);
                newObjective:SetEpilogue(Locale.ConvertTextKey("TXT_KEY_QUEST_PURE_ADVANTAGE_OBJECTIVE_PRIVITIZATION_VS_ENTITLEMENT_PROMPT_SUMMARY"));

            return BehaviorStatus.IN_PROGRESS;
        end},
 
Last edited:
How do you use the panel that allows for starting quests manually?
Click on Admin -> Edit Project Panels.
There should be one named "Quests".

Acclimation Quest:
It doesn't require Boreholes or Gene Gardens, it requires Microbial Mines and then Xenonurseries. I assume you got confused because of the titles ("-- Build Gene Gardens"), but you should just ignore (or correct) them, as they're often false, probably because the buildings required have changed during development but the Script Descriptions weren't updated.

The actual objectives look like this:

local newObjective = AddObjective(quest, "QUEST_OBJECTIVE_BUILD_BUILDING", MINE_TYPE, MINE_NUMBER_TO_BUILD, city:GetID());

And towards the top of the script you find the variables that are used here:

local MINE_TYPE = GameInfo.Buildings["BUILDING_MICROBIAL_MINE"].ID;
local MINE_NUMBER_TO_BUILD = 1;
 
I altered the quests in the mod and set VFS to true for them, but they don't seem to be changing the required buildings in the quests properly.

This is the part I edited in the Subset Curse as an example.
_____

Code:
----------------------------------------------------
-- Constants
----------------------------------------------------
local LABORATORY_TYPE : number = GameInfo.Buildings["BUILDING_LABORATORY"].ID;
local PHARMALAB_TYPE : number = GameInfo.Buildings["BUILDING_PHARMALAB"].ID;
local GENE_GARDEN_TYPE : number = GameInfo.Buildings["BUILDING_PHARMALAB"].ID;
local BIOFACTORY_TYPE : number = GameInfo.Buildings["BUILDING_PHARMALAB"].ID;
local SPY_AGENCY_TYPE : number = GameInfo.Buildings["BUILDING_SPY_AGENCY"].ID;
local HARMONY_PERK_TYPE : number = GameInfo.PlayerPerks["PLAYERPERK_THE_SUBSET_CURSE_HARMONY"].ID;
local PURITY_PERK_TYPE : number = GameInfo.PlayerPerks["PLAYERPERK_THE_SUBSET_CURSE_PURITY"].ID;
local SUPREMACY_PERK_TYPE : number = GameInfo.PlayerPerks["PLAYERPERK_THE_SUBSET_CURSE_SUPREMACY"].ID;
____________
____________

And this is the original quest code for comparison.
______________
__________________

Code:
----------------------------------------------------
-- Constants
----------------------------------------------------
local LABORATORY_TYPE : number = GameInfo.Buildings["BUILDING_LABORATORY"].ID;
local PHARMALAB_TYPE : number = GameInfo.Buildings["BUILDING_PHARMALAB"].ID;
local GENE_GARDEN_TYPE : number = GameInfo.Buildings["BUILDING_GENE_GARDEN"].ID;
local BIOFACTORY_TYPE : number = GameInfo.Buildings["BUILDING_BIOFACTORY"].ID;
local SPY_AGENCY_TYPE : number = GameInfo.Buildings["BUILDING_SPY_AGENCY"].ID;
local HARMONY_PERK_TYPE : number = GameInfo.PlayerPerks["PLAYERPERK_THE_SUBSET_CURSE_HARMONY"].ID;
local PURITY_PERK_TYPE : number = GameInfo.PlayerPerks["PLAYERPERK_THE_SUBSET_CURSE_PURITY"].ID;
local SUPREMACY_PERK_TYPE : number = GameInfo.PlayerPerks["PLAYERPERK_THE_SUBSET_CURSE_SUPREMACY"].ID;
____________
____________________

I also tested Steel Synapse with the change from a CEL Cradle to see if repeating buildings was the issue, but that also didn't work.

Aside for everything quest-related the mod seems to be working as intended.

Could updating Ageless Privilege, a quest I found in the files that does not appear to be in-game, be part of the problem? It was strange in having its text in the lua file.

I haven't found anything in the logs mentioning the quests. If there is information there, where would I find it?
 
Last edited:
This seems to be the issue:
To make the game load custom Quests, you have to import them into the VFS, and Load them via the Content Tab as Type: Quest and Name: <Name of the File without the .lua Ending>.
 
I fixed that issue, I was putting the full folder name before the name of the quest.

But now I'm getting these errors when I try to test the quests, and no quests load to be tested in firetuner.



Code:
stack traceback:
    Assets\DLC\Expansion1\Gameplay\Lua\QuestSystem.lua:218: in function 'HasPlayerDoneQuestType'
    assets\Gameplay\Lua\Quests\ContactVictoryQuest.lua:27: in function 'QuestScript.OnStartGame'
    [C]: in function 'func'
    [C]: in function '(anonymous)'


Code:
[495533.937] Runtime Error: Assets\DLC\Expansion1\Gameplay\Lua\QuestSystem.lua:317: function expected instead of nil
stack traceback:
    Assets\DLC\Expansion1\Gameplay\Lua\QuestSystem.lua:317: in function '(main chunk)'
    [C]: in function '(anonymous)'
stack traceback:
    Assets\DLC\Expansion1\Gameplay\Lua\QuestSystem.lua:4: in function '(main chunk)'
    [C]: in function '(anonymous)'
[495533.937] Runtime Error: Error loading Assets\DLC\Expansion1\Gameplay\Lua\QuestSystem.lua.
stack traceback:
    [C]: in function '(anonymous)'
 
That means you've either got an error in the script, or you've not put the right name into the Name-Field.

Because of the way they're loaded, Quest Scripts don't write Errors into the Logs, so you'll either have to manually go over the script and see if you can find some Errors, or also load the Script as IngameUIAddIn, which will either print a general lua Error about some Syntax that is wrong (in which case you now know the problem), or it will print an error about one of the quest-specific functions that it can't find, in which case the Script itself is fine, and you just have not loaded it properly.

Just in case an example on how to load it properly, let's say you want to Override NostalgiaTripBQuest.lua. The EntryPoint would look something like this:

Type -> Quest
Name -> NostalgiaTripBQuest
Description -> Doesn't matter
File -> QuestSystem/Quests/Nostalgia Quest Set/NostalgiaTripBQuest.lua
 
I found and corrected a single syntax error, but it is still having issues.

I assume these errors mean I loaded it wrong, but it seems to follow that format.

Do I need to remove the InGameUIAddin quest entries for it to run properly?

Code:
[507534.171] Runtime Error: C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\TheSubsetCurseQuest.lua:357: function expected instead of nil
stack traceback:
    C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\TheSubsetCurseQuest.lua:357: in function '(main chunk)'
    [C]: in function '(anonymous)'
[507534.171] Runtime Error: Error loading C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\TheSubsetCurseQuest.lua.
stack traceback:
    [C]: in function '(anonymous)'
[507534.171] TheLonelyRevolutionQuest: CUSTOM TheLonelyRevolution: Quest Loaded.
[507534.171] Runtime Error: C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\TheLonelyRevolutionQuest.lua:23: function expected instead of nil
stack traceback:
    C:\Users\Marcus Anderson\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\TheLonelyRevolutionQuest.lua:23: in function '(main chunk)'
    [C]: in function '(anonymous)'
[507534.171] Runtime Error: Error loading C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\TheLonelyRevolutionQuest.lua.
stack traceback:
    [C]: in function '(anonymous)'
[507534.171] Runtime Error: C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\SteelSynapseQuest.lua:21: function expected instead of nil
stack traceback:
    C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\SteelSynapseQuest.lua:21: in function '(main chunk)'
    [C]: in function '(anonymous)'
[507534.187] Runtime Error: Error loading C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\SteelSynapseQuest.lua.
stack traceback:
    [C]: in function '(anonymous)'
[507534.187] Runtime Error: C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\RadioSilenceQuest.lua:18: function expected instead of nil
stack traceback:
    C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\RadioSilenceQuest.lua:18: in function '(main chunk)'
    [C]: in function '(anonymous)'
[507534.187] Runtime Error: Error loading C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\RadioSilenceQuest.lua.
stack traceback:
    [C]: in function '(anonymous)'
[507534.187] Runtime Error: C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\PureAdvantageQuest.lua:22: function expected instead of nil
stack traceback:
    C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\PureAdvantageQuest.lua:22: in function '(main chunk)'
    [C]: in function '(anonymous)'
[507534.187] Runtime Error: Error loading C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\PureAdvantageQuest.lua.
stack traceback:
    [C]: in function '(anonymous)'
[507534.203] PointOfNoReturnNullQuest: CUSTOM PointOfNoReturnNullQuest: Quest Loaded.
[507534.203] Runtime Error: C:\Users\Marcus Anderson\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\PointOfNoReturnNullQuest.lua:25: function expected instead of nil
stack traceback:
    C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\PointOfNoReturnNullQuest.lua:25: in function '(main chunk)'
    [C]: in function '(anonymous)'
[507534.203] Runtime Error: Error loading C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\PointOfNoReturnNullQuest.lua.
stack traceback:
    [C]: in function '(anonymous)'
[507534.218] Runtime Error: C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\PayDayQuest.lua:20: function expected instead of nil
stack traceback:
    C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\PayDayQuest.lua:20: in function '(main chunk)'
    [C]: in function '(anonymous)'
[507534.218] Runtime Error: Error loading C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\PayDayQuest.lua.
stack traceback:
    [C]: in function '(anonymous)'
[507534.218] Runtime Error: C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\LeadFootSoldierQuest.lua:25: function expected instead of nil
stack traceback:
    C:\Users\userDocuments\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\LeadFootSoldierQuest.lua:25: in function '(main chunk)'
    [C]: in function '(anonymous)'
[507534.218] Runtime Error: Error loading C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\LeadFootSoldierQuest.lua.
stack traceback:
    [C]: in function '(anonymous)'
[507534.234] Runtime Error: C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\AsWithManQuest.lua:21: function expected instead of nil
stack traceback:
    C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\AsWithManQuest.lua:21: in function '(main chunk)'
    [C]: in function '(anonymous)'
[507534.234] Runtime Error: Error loading C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\AsWithManQuest.lua.
stack traceback:
    [C]: in function '(anonymous)'
[507534.234] Runtime Error: C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\AcclimationQuest.lua:18: attempt to index a nil value
stack traceback:
    C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\AcclimationQuest.lua:18: in function '(main chunk)'
    [C]: in function '(anonymous)'
[507534.234] Runtime Error: Error loading C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\AcclimationQuest.lua.
stack traceback:
    [C]: in function '(anonymous)'

This is the Entrypoints section of the modinfo folder.

Code:
<EntryPoints>
    <EntryPoint type="InGameUIAddin" file="Exclusivity Code/Lua/AffinityAffiliationTestScript.lua">
      <Name>AffinityAffiliationTestScript</Name>
      <Description>
      </Description>
    </EntryPoint>
    <EntryPoint type="Quest" file="Modular Building Quests Resource/BuildingChoiceTemplateQuest.lua">
      <Name>BuildingChoiceTemplateQuest</Name>
      <Description>
      </Description>
    </EntryPoint>
    <EntryPoint type="Quest" file="Quests/TheSubsetCurseQuest.lua">
      <Name>TheSubsetCurseQuest</Name>
      <Description>
      </Description>
    </EntryPoint>
    <EntryPoint type="Quest" file="Quests/TheLonelyRevolutionQuest.lua">
      <Name>TheLonelyRevolutionQuest</Name>
      <Description>
      </Description>
    </EntryPoint>
    <EntryPoint type="Quest" file="Quests/SteelSynapseQuest.lua">
      <Name>SteelSynapseQuest</Name>
      <Description>
      </Description>
    </EntryPoint>
    <EntryPoint type="Quest" file="Quests/RadioSilenceQuest.lua">
      <Name>RadioSilenceQuest</Name>
      <Description>
      </Description>
    </EntryPoint>
    <EntryPoint type="Quest" file="Quests/PureAdvantageQuest.lua">
      <Name>PureAdvantageQuest</Name>
      <Description>
      </Description>
    </EntryPoint>
    <EntryPoint type="Quest" file="Quests/PointOfNoReturnNullQuest.lua">
      <Name>PointOfNoReturnNullQuest</Name>
      <Description>
      </Description>
    </EntryPoint>
    <EntryPoint type="Quest" file="Quests/PayDayQuest.lua">
      <Name>PayDayQuest</Name>
      <Description>
      </Description>
    </EntryPoint>
    <EntryPoint type="Quest" file="Quests/LeadFootSoldierQuest.lua">
      <Name>LeadFootSoldierQuest</Name>
      <Description>
      </Description>
    </EntryPoint>
    <EntryPoint type="Quest" file="Quests/AsWithManQuest.lua">
      <Name>AsWithManQuest</Name>
      <Description>
      </Description>
    </EntryPoint>
    <EntryPoint type="Quest" file="Quests/AgelessPrivilegeQuest.lua">
      <Name>AgelessPrivilegeQuest</Name>
      <Description>
      </Description>
    </EntryPoint>
    <EntryPoint type="Quest" file="Quests/AcclimationQuest.lua">
      <Name>AcclimationQuest</Name>
      <Description>
      </Description>
    </EntryPoint>
  </EntryPoints>

And these are the quest lua files.

Code:
Modular Building Quests Resource/BuildingChoiceTemplateQuest.lua</File>
    <File md5="456CA3F098A6E5FACC45B594997402B3" import="0">Modular Building Quests Resource/BuildingQuestTable.sql</File>
    <File md5="76E14A9B91A33B9898A52B313B576916" import="1">Quests/AcclimationQuest.lua</File>
    <File md5="ED66DBE7B95D1A2D314A8EC299EEDF45" import="1">Quests/AgelessPrivilegeQuest.lua</File>
    <File md5="1B4BF2FB32DF2F50FBA4C2C46EBAD558" import="1">Quests/AsWithManQuest.lua</File>
    <File md5="A35F75AB450FDBA9DB0397F650F5BCC0" import="1">Quests/LeadFootSoldierQuest.lua</File>
    <File md5="B121100E2593BC45FB936DAC19625755" import="1">Quests/PayDayQuest.lua</File>
    <File md5="6B07720AE1EA8C29988F396CC6A14C8A" import="1">Quests/PointOfNoReturnNullQuest.lua</File>
    <File md5="6CB237FCE89C90219A61157CDCF1EAD1" import="1">Quests/PureAdvantageQuest.lua</File>
    <File md5="D54699EAD09481DE787DC426EC7960FC" import="1">Quests/RadioSilenceQuest.lua</File>
    <File md5="7AECDD7F11E00B523149993DC8995FAB" import="1">Quests/SteelSynapseQuest.lua</File>
    <File md5="129B636A1B644FDD7FC2D7BD7F2E94A1" import="1">Quests/TheLonelyRevolutionQuest.lua</File>
    <File md5="03418A2A79A2E2EF4F6293B1CFAE1C06" import="1">Quests/TheSubsetCurseQuest.lua</File>
 
Yes, you need to remove the IngameUIAddIn-Entries after testing, otherwise those errors will cause the "terrain is displayed about everthing else"-bug.

Those errors here are what you get when the quest has no syntax errors:
[507534.218] Runtime Error: C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\LeadFootSoldierQuest.lua:25: function expected instead of nil

That basically means the quest is fine, as the function that it can't find is part of the Quest System. If you don't want to make changes to the quest anymore, you can make a note that you've tested the quest and that it works properly and then remove the IngameUIAddIn entry. (Yeah, that's pretty annoying - maybe there's a better way of doing it, I don't know)

This one here however is an actual error:
[507534.234] Runtime Error: C:\Users\user\Documents\My Games\Sid Meier's Civilization Beyond Earth\MODS\Distinction - Affinity Buildings Overhaul (v 1)\Quests\AcclimationQuest.lua:18: attempt to index a nil value
stack traceback:

Sounds like you've entered an incorrect building name or something like that.
 
I haven't been able to find any error in the code.

At first I thought it might be the Mass Digester having a different name for its buildingclass, but changing that didn't seem to help.

This is all I changed, in bold.

Code:
-- Globals
----------------------------------------------------
local QuestScript = hmake CvQuestScript{};

----------------------------------------------------
-- Constants
----------------------------------------------------
local MINE_NUMBER_TO_BUILD = 1;
local GENE_GARDEN_NUMBER_TO_BUILD = 2;

local MINE_TYPE = GameInfo.Buildings["BUILDING_VIVARIUM"].ID;
local XENONURSERY_TYPE = GameInfo.Buildings["BUILDING_CYTONURSERY"].ID;

local RESPIRATION_PERK_TYPE = GameInfo.PlayerPerks["PLAYERPERK_ACCLIMATION_TRADE_ROUTE_YIELDS"].ID;
local DIGESTION_PERK_TYPE = GameInfo.PlayerPerks["PLAYERPERK_ACCLIMATION_GROWTH_CARRYOVER"].ID;

local HARMONY_DESCRIPTION = GameInfo.Affinity_Types[AffinityQuestManager.HARMONY_TYPE].Description;
local AFFINITY_REWARD = 10;

local BehaviorTree : CvBehaviorNode = BehaviorTree{

    SequenceNode{

And this is the default.

Code:
----------------------------------------------------
-- Globals
----------------------------------------------------
local QuestScript = hmake CvQuestScript{};

----------------------------------------------------
-- Constants
----------------------------------------------------
local MINE_NUMBER_TO_BUILD = 1;
local GENE_GARDEN_NUMBER_TO_BUILD = 2;

local MINE_TYPE = GameInfo.Buildings["BUILDING_MICROBIAL_MINE"].ID;
local XENONURSERY_TYPE = GameInfo.Buildings["BUILDING_XENONURSERY"].ID;

local RESPIRATION_PERK_TYPE = GameInfo.PlayerPerks["PLAYERPERK_ACCLIMATION_TRADE_ROUTE_YIELDS"].ID;
local DIGESTION_PERK_TYPE = GameInfo.PlayerPerks["PLAYERPERK_ACCLIMATION_GROWTH_CARRYOVER"].ID;

local HARMONY_DESCRIPTION = GameInfo.Affinity_Types[AffinityQuestManager.HARMONY_TYPE].Description;
local AFFINITY_REWARD = 10;

local BehaviorTree : CvBehaviorNode = BehaviorTree{

    SequenceNode{

Is there any chance the error isn't in the quest code?

The 18 for the error seems to say it'd be in that cod at the start though.
 
Last edited:
:18 means line 18.

If it's this line:
local HARMONY_DESCRIPTION = GameInfo.Affinity_Types[AffinityQuestManager.HARMONY_TYPE].Description;

...then that's not an actual error after all.
 
Can quests load for testing while the ingameui entries are still there?

I can't test till later tonight, but hopefully there'd is no real issue.
 
Yeah, as long as the Quest system itself does not show any errors, they should work fine.
 
It's all working as intended now: thanks for taking the time to help.
 
Top Bottom