Quest chains system - Vanilla-Expanded/VanillaExpandedFramework GitHub Wiki

<- Back

The quest chain system in the VE Framework allows modders to create complex chains of quests that activate one after the other.

The first thing needed is a Def, QuestChainDef:

public string iconPath;
public Texture2D icon;
public string questChainName;
public Type workerClass;
private QuestChainWorker cachedWorker;
public List<PawnKindDef> uniqueCharacters;

Then each quest will need a QuestChainExtension:

 public QuestChainDef questChainDef;
 public List<QuestScriptDef> conditionSucceedQuests;
 public List<QuestScriptDef> conditionFailQuests;
 public IntRange ticksSinceSucceed;
 public IntRange ticksSinceFail;

 public QuestScriptDef conditionEither;
 public float conditionMinDaysSinceStart;
 public bool isRepeatable;
 public float mtbDaysRepeat;

 public bool grantAgainOnFailure;
 public FloatRange daysUntilGrantAgainOnFailure;
 public bool grantAgainOnExpiry;
 public FloatRange daysUntilGrantAgainOnExpiry;
 public IntRange? delayTicksAfterTriggering;

 public List<ConditionSucceedQuestsCount> conditionSucceedQuestsCount;

How do I use this code?

Here are the examples for VQE - The Generator. First of all, the custom Def:

<VEF.Storyteller.QuestChainDef>
        <defName>VQE_TheGeneratorQuestChain</defName>
	<iconPath>UI/QuestChainIcon</iconPath>
        <label>The Generator</label>
        <description>This quest chain will have you explore the various sites in which {InventorFullName} tried to construct a prototype of the ultimate power source. If you connect the dots, you may be able to pick up this endeavour and construct your own ARC generator.</description>
	<workerClass>VanillaQuestsExpandedTheGenerator.TheGenerator_QuestChainWorker</workerClass>
</VEF.Storyteller.QuestChainDef>

(The worker class in this case mainly handles InventorFullName)

Here is then the QuestChainExtension for the first quest in the mod, VQE_PrototypeARC:

<modExtensions>
            <li Class="VEF.Storyteller.QuestChainExtension">
                <questChainDef>VQE_TheGeneratorQuestChain</questChainDef>
                <conditionMinDaysSinceStart>20</conditionMinDaysSinceStart>
                <isRepeatable>false</isRepeatable>
                <grantAgainOnFailure>true</grantAgainOnFailure>
                <daysUntilGrantAgainOnFailure>7</daysUntilGrantAgainOnFailure>
            </li>
</modExtensions>

And here is the extension for the second one, notice how it has VQE_PrototypeARC as a prerequisite:

<modExtensions>
            <li Class="VEF.Storyteller.QuestChainExtension">
                <questChainDef>VQE_TheGeneratorQuestChain</questChainDef>
                <conditionSucceedQuests>
                    <li>VQE_PrototypeARC</li>
                </conditionSucceedQuests>
                <ticksSinceSucceed>600</ticksSinceSucceed>
                <isRepeatable>false</isRepeatable>
                <grantAgainOnFailure>true</grantAgainOnFailure>
                <daysUntilGrantAgainOnFailure>7</daysUntilGrantAgainOnFailure>
            </li>
</modExtensions>
⚠️ **GitHub.com Fallback** ⚠️