Questions about splitscreen logic
Posted: Wed Mar 16, 2022 4:03 pm
Hello there!
So I am currently using both Quest Machine and Dialogue System for a split-screen game. I have followed most of the logic I could find on the forums, specifically this thread: https://www.pixelcrushers.com/phpbb/vie ... f=3&t=4349
My basic setup is that each player has their own UI panel, which is where they have the necessary individual dialogue and quest related components. I am using Rewired for inputs which is all working great. That forum thread above didn't quite cover the quest machine components so I thought I would ask a few questions here. So far I have Player 1, Player 2, NPC 1 for P1, and NPC 1 for P2 as actors.
To start, I want the game to have shared bigger quests, and then smaller individual quests that they could get from various NPCs. The game starts by giving a shared quest to both players. Now I found this code to give each player the quest:
This appears to work great, but where I run into the problem is running this code in the dialogue tree:
This only seems to update the "LeavingHome" quest for the first player. I am guessing it is because there are multiple instances named "LeavingHome" and it is only updating the first one. As a test, I modified the script and assigned the same Quest Instance to both players, and this resolved the issue of only updating one of the quests. But the problem is that if the Quest Journal is opened for one of the players, and they tick the checkbox on the quest so that they can now focus on a different quest, the other player is also affected by that choice - which is undesirable. Is there some way of running that SetQuestNodeState on all of the instances of that quest?
I will likely have a few more questions as I continue integrating this!
Thanks!
So I am currently using both Quest Machine and Dialogue System for a split-screen game. I have followed most of the logic I could find on the forums, specifically this thread: https://www.pixelcrushers.com/phpbb/vie ... f=3&t=4349
My basic setup is that each player has their own UI panel, which is where they have the necessary individual dialogue and quest related components. I am using Rewired for inputs which is all working great. That forum thread above didn't quite cover the quest machine components so I thought I would ask a few questions here. So far I have Player 1, Player 2, NPC 1 for P1, and NPC 1 for P2 as actors.
To start, I want the game to have shared bigger quests, and then smaller individual quests that they could get from various NPCs. The game starts by giving a shared quest to both players. Now I found this code to give each player the quest:
Code: Select all
public Quest questAsset;
public QuestJournal questJournal;
void Start()
{
// Make a copy of the quest for the quester:
var questInstance = questAsset.Clone();
// Add the copy to the quester and activate it:
var questerTextInfo = new QuestParticipantTextInfo(questJournal.id, questJournal.displayName, questJournal.image, null);
questInstance.AssignQuester(questerTextInfo);
questInstance.timesAccepted = 1;
questJournal.deletedStaticQuests.Remove(StringField.GetStringValue(questInstance.id));
questJournal.AddQuest(questInstance);
questInstance.SetState(QuestState.Active);
QuestMachineMessages.RefreshUIs(questInstance);
}
Code: Select all
SetQuestNodeState("LeavingHome","Find Sarah","success")
I will likely have a few more questions as I continue integrating this!
Thanks!