Limit Quests to Specific Faction

Started by SickBoyWi, March 10, 2020, 11:24:46 AM

Previous topic - Next topic

SickBoyWi

Hi! I'm working on a series of mods. Each adds their own factions, and they're intended to all be played together.

With the 1.1 update, I haven't yet seen a simple way to limit a quest to a specific player faction. Some of the quests for each of the mods I'm working on only make sense in the context of that faction.

What I'd like to do is have a check before a quest fires, and make sure the player is using one of the appropriate factions. In 1.0, since world events were incidents, I was able to easily control this via the CanFireNowSub function in the incident class. That isn't an option now for quests.

Does any one have any thoughts on how to accomplish this?

K

I'm not sure I entirely understand your question. Does the player select a faction?

Anyway, you can still use incidents to give quests. Just make your quests have a rootSelectionWeight of 0 then make an incident to fire them instead. This does circumvent the game's own quest giving functionality though, which might make your quests more uncommon than you'd like (or too common, depending on your incident weights).

The only other alternative would be that I know of would be to circumvent the entire quest giving and incident system and write some C# manager (a storyteller comp or world component possibly) to give quests at whatever conditions you specify. It's not hard to do this, but it does introduce some complexity that you might not want. If you took this approach your quest giving system would be independent of the default one, which sometimes could mean you'd get weird timing for when quests appear.


SickBoyWi

I figured it out with some help from the RW Discord folks. Ended up adding a prefix for the QuestUtility_GenerateQuestAndMakeAvailable method.

K

Just a thought. If you prefix the GenerateQuest method to stop the quest from going through when the conditions aren't met, you'll effectively lower the amount of quests the player receives, since that method is called after the game has decided to generate a quest, and which quest to generate. You might want to be careful because depending on the luck of the random number generator and the exact implementation of your patch, the player may not receive any quests for a very long time.

Instead of patching that method, you could patch the NaturalRandomQuestChooser.ChooseNaturalRandomQuest method to ensure that no invalid quest is chosen to be given. Then, you could ensure that some quest is given when the game is giving a quest, just not the ones you don't want triggered.