Modding Tutorials: Quest Packs & New Guilds

Discuss modding questions and implementation details.
User avatar
harbinger451
Posts: 183
Joined: Mon Apr 13, 2020 4:08 pm
Contact:

Re: Modding Tutorials: Quest Packs & New Guilds

Post by harbinger451 »

This looked super simple, but I am assuming it's so simple that I am overthinking it? Some mods, like Archeologist and Roleplay&Realism have new quests packed into the dfmod file, so I know it's possible but I can't find any script in those mods that refer to loading those quests/questlist.
Hey Ralzar, did you ever solve this problem of packaging a quest pack as a dfmod ... I 'm trying to do it now but can't figure out the script. I looked at Hazelnut's Archaeologists mod script and tried whittling it down from that, but with little success.

I really need help with this ... someone ... anyone?

This is what I got so far ... but I don't even know if I'm on the right track.

Code: Select all

using System;
using UnityEngine;
using DaggerfallWorkshop.Game;
using DaggerfallWorkshop.Game.Questing;
using DaggerfallWorkshop.Game.Utility.ModSupport;

namespace ProstitutesAndLovers
{
	public class ProstitutesAndLoversMod : MonoBehaviour
	{
		static Mod mod;

		[Invoke(StateManager.StateTypes.Start, 0)]
		public static void Init(InitParams initParams)
		{
			mod = initParams.Mod;
			var go = new GameObject(mod.Title);
			go.AddComponent<ProstitutesAndLoversMod>();
		}

		void Awake()
		{
			InitMod();
			mod.IsReady = true;
		}

		public static void InitMod()
		{
			Debug.Log("Begin mod init: Prostitutes And Lovers");

			{
				if (!QuestListsManager.RegisterQuestList("ProstitutesAndLovers"))
					throw new Exception("Quest list name is already in use, unable to register Prostitutes And Lovers quest list.");
			}

			Debug.Log("Finished mod init: Prostitutes And Lovers");
		}

	}
}
EDIT: I was on the right track ... just tested it and the script totally works.
Image

User avatar
harbinger451
Posts: 183
Joined: Mon Apr 13, 2020 4:08 pm
Contact:

Re: Modding Tutorials: Quest Packs & New Guilds

Post by harbinger451 »

So I am building a couple of new guilds, but I'm having problems with the FactionFile.GuildGroup values. The Archaeologist Guild uses GGroup0 and the prostitutes guild in the Love and Lust mod uses GGroup1, so I thought I'd use GGroup2 for my first effort (placing a guild of bawdy houses into the game that act as a front for espionage and blackmail), but I get the following error in the console when trying to compile the scripts into a dfmod...
Assets\Game\Mods\RedLanternMod.cs(40,67): error CS0117: 'FactionFile.GuildGroups' does not contain a definition for 'GGroup2'
Same goes for GGroup3 (I was hoping to also do a Bards guild). When I use GGroup1 it goes fine with no error message. I really don't want to step on any toes by using either GGroup0 or GGroup1. Am I missing something here?

The relevant section of code goes...
public static void InitMod()
{
Debug.Log("Begin mod init: RedLantern");

if (RegisterFactionIds())
{
if (!GuildManager.RegisterCustomGuild(FactionFile.GuildGroups.GGroup2, typeof(RedLanternGuild)))
throw new Exception("GuildGroup GGroup2 is already in use, unable to register Red Lantern Guild.");

Services.RegisterGuildService(1020, GuildServices.Quests);
Services.RegisterGuildService(1021, GuildServices.Training);
Services.RegisterGuildService(1022, GuildServices.BuyPotions);
Services.RegisterGuildService(1023, GuildServices.MakePotions);
Services.RegisterGuildService(1024, GuildServices.Spymaster);
}
else
throw new Exception("Faction id's are already in use, unable to register factions for Red Lantern Guild.");

Debug.Log("Finished mod init: RedLantern");
}
Image

User avatar
harbinger451
Posts: 183
Joined: Mon Apr 13, 2020 4:08 pm
Contact:

Re: Modding Tutorials: Quest Packs & New Guilds

Post by harbinger451 »

I did a bit of searching and it appears that the usable GGroup numbers are GGroup0 (taken), GGroup1 (taken), GGroup8, GGroup12, GGroup13, GGroup16, GGroup18, GGroup19, GGroup20 and GGroup21.

I tried GGroup8 and GGroup12 and, although I got no error messages compiling the dfmods (which was nice), in game when you try to join the guild a "Joining guild GGroup1 is not implemented" message comes up. No idea why. Not using GGroup1 anywhere in the code. All guild NPCs were assigned to the right factions for GGroup8 or GGroup12. This is giving me a major headache.

EDIT: I got it sorted. GGroup8 is working. Turns out I was being dim and missed a spot in the RegisterFactionIds code where the GGroup number had to be stated and I hadn't changed it to match the one I was trying to use. Oh well, you live and learn.
Image

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Modding Tutorials: Quest Packs & New Guilds

Post by Hazelnut »

Glad you got it sorted. Do let me know if I can help, though I'm not around as much I am still out here. :)
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
harbinger451
Posts: 183
Joined: Mon Apr 13, 2020 4:08 pm
Contact:

Re: Modding Tutorials: Quest Packs & New Guilds

Post by harbinger451 »

Got this for bug report for the Red Lantern Guild on Nexus:
Right now my DFU save have following factions related to Red Lantern (directly peeking at FactionData.txt):

ID Name
512 The Prostitutes
1300 The Red Lantern
1301 Red Lantern Trainers
...
1305 Red Lantern Healers

While 1301-1305 correctly registered 1300 as their parent, 1300 doesn't include all subfactions as children -- it only includes the first 3 subfactions, which means 1304 and 1305 are excluded. Would this cause failure to gain subfaction reputation after quest completion? Same thing happens between 512 and 1300 -- main Red Lantern faction enlists The Prostitutes as parent, but the child relation is absent.

I do observe the same discrepancy for other extra guild mods too (Archeologists, Bards), in that only the first 3 subfactions are included into child data. Is it a restriction from the base game code, a bug or just some oversight? Should I manually edit the saves for now, or nothing needs to be done at all?
Can you list more than three children subfactions? Does it matter, so long as the parent factions are mentioned?
Image

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Modding Tutorials: Quest Packs & New Guilds

Post by Hazelnut »

Do you know what they mean by "1300 doesn't include all subfactions as children" In what sense does it not include them? I am confused.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
harbinger451
Posts: 183
Joined: Mon Apr 13, 2020 4:08 pm
Contact:

Re: Modding Tutorials: Quest Packs & New Guilds

Post by harbinger451 »

In the section of code that registers the new factions ... the main faction 1300 is parent to 5 subfactions 1301-1305 ... but in the main factions data children = new List<int>() { 1301, 1302, 1303 } lists only three subfactions, I essentially did the same as you did in the Archaeologists code. The question is, is there a reason only three are mentioned and not all the subfactions which have the main faction as parent? Here's the section of code registering the factions:

Code: Select all

		private static bool RegisterFactionIds()
		{
			bool success = FactionFile.RegisterCustomFaction(1300, new FactionFile.FactionData()
			{
				id = 1300,
				parent = 512,
				type = 2,
				name = "The Red Lantern",
				summon = -1,
				region = -1,
				power = 40,
				ally1 = (int)FactionFile.FactionIDs.The_Thieves_Guild,
				ally2 = (int)FactionFile.FactionIDs.The_Blades,
				enemy1 = (int)FactionFile.FactionIDs.Sanguine,
				face = -1,
				race = -1,
				sgroup = 4,
				ggroup = 8,
				children = new List<int>() { 1301, 1302, 1303 }
            });
            success = FactionFile.RegisterCustomFaction(1301, new FactionFile.FactionData()
			{
				id = 1301,
				parent = 1300,
				type = 2,
				name = "Red Lantern Trainers",
				summon = -1,
				region = -1,
				power = 20,
				face = -1,
				race = -1,
				sgroup = 4,
				ggroup = 8,
				children = null
			}) && success;
			success = FactionFile.RegisterCustomFaction(1302, new FactionFile.FactionData()
			{
				id = 1302,
				parent = 1300,
				type = 2,
				name = "Red Lantern Apothecaries",
				summon = -1,
				region = -1,
				power = 20,
				face = -1,
				race = -1,
				sgroup = 4,
				ggroup = 8,
				children = null
			}) && success;
			success = FactionFile.RegisterCustomFaction(1303, new FactionFile.FactionData()
			{
				id = 1303,
				parent = 1300,
				type = 2,
				name = "Red Lantern Mixers",
				summon = -1,
				region = -1,
				power = 20,
				face = -1,
				race = -1,
				sgroup = 4,
				ggroup = 8,
				children = null
			}) && success;
			success = FactionFile.RegisterCustomFaction(1304, new FactionFile.FactionData()
			{
				id = 1304,
				parent = 1300,
				type = 2,
				name = "Red Lantern Spymasters",
				summon = -1,
				region = -1,
				power = 20,
				face = -1,
				race = -1,
				sgroup = 4,
				ggroup = 8,
				children = null
			}) && success;
			success = FactionFile.RegisterCustomFaction(1305, new FactionFile.FactionData()
			{
				id = 1305,
				parent = 1300,
				type = 2,
				name = "Red Lantern Healers",
				summon = -1,
				region = -1,
				power = 20,
				face = -1,
				race = -1,
				sgroup = 4,
				ggroup = 8,
				children = null
			}) && success;
			return success;
		}
Also, this person's faction rep is showing that rep with the main Red Lantern faction increases as it should while doing quests, but it doesn't seem to affect the rep for the subfactions at all. Is there any reason why that might be so. Their rep with the Archaeologists and it's subfactions all increase as they should when doing the archaeologists quests, but not the red lantern subfactions when doing their quests for some reason.
Image

Post Reply