Here is sample of script proposal. I am not a modder, coder or scripter of any way shape or form but this is what open chat suggested.
Great! Here's an outline of how you could write a script to modify the way Traders give quests in 7 Days to Die:
Create a new folder in the "Mods" folder and name it something like "UniqueQuests".
Create a new C# script file in this folder and name it something like "UniqueQuests.cs".
Open the script file in your text editor or IDE.
At the top of your script file, add a using directive to import the Unity engine's Random class:
cppCopy code
using UnityEngine;
Define a static array of QuestTypes and QuestLocations that represents all the possible types of quests and locations that the Traders can offer:
scssCopy code
static QuestType[] questTypes = { QuestType.Clear, QuestType.Retrieve, QuestType.Fetch }; static QuestLocation[] questLocations = { QuestLocation.City, QuestLocation.Town, QuestLocation.Wasteland };
Create a static field to keep track of the last offered quest type and location:
javaCopy code
static QuestType lastQuestType = QuestType.Clear; static QuestLocation lastQuestLocation = QuestLocation.City;
Define a function that generates a random unique quest type and location:
csharpCopy code
static Quest GenerateUniqueQuest() { QuestType questType; QuestLocation questLocation; // Generate a new quest type that is different from the last offered quest type do { questType = questTypes[Random.Range(0, questTypes.Length)]; } while (questType == lastQuestType); // Generate a new quest location that is different from the last offered quest location do { questLocation = questLocations[Random.Range(0, questLocations.Length)]; } while (questLocation == lastQuestLocation); // Save the generated quest type and location as the last offered quest lastQuestType = questType; lastQuestLocation = questLocation; // Return the generated quest return new Quest(questType, questLocation); }
In the Start() method of your script, find all the Traders in the game world and modify the way they give quests by calling the GenerateUniqueQuest() function:
scssCopy code
void Start() { // Find all the Traders in the game world Trader[] traders = FindObjectsOfType<Trader>(); // Modify the way the Traders give quests foreach (Trader trader in traders) { trader.questData.GenerateNewQuest = () => { return GenerateUniqueQuest(); }; } }
Save your script file and launch the game.
Enable the "UniqueQuests" mod in the game's Mod Manager.
Start a new game or load an existing one and visit a Trader to see if the script is working.
This script modifies the way the Traders generate quests by ensuring that the same quest type and location are not offered more than once in a row. If you want to further refine the script, you could add more logic to ensure that the same quest type or location is not offered too frequently over a longer period of time.