Page 22 of 27
Re: ORK integration
Posted: Wed Oct 16, 2024 8:15 am
by Tony Li
What versions of Unity, ORK, Quest Machine, and (if you're using it) Dialogue System are you using? I want to make sure I'm looking at the same thing here.
Re: ORK integration
Posted: Wed Oct 16, 2024 8:32 am
by dlevel
ORK 2 latest, Quest Machine 1.2.48 (havent updated to the last update since I already had the counter issue fixed with your custom update), Unity 2022.3.37
Re: ORK integration
Posted: Wed Oct 16, 2024 8:46 pm
by Tony Li
Thank you! I'm setting up a project with the same versions, except using QM 1.2.48 instead of 1.2.47 with the patch.
BTW, if you ever want to send a reproduction project, you can send it to tony (at) pixelcrushers.com
Just making sure I have it right -- you're using ORK 2, not ORK 3, correct?
Re: ORK integration
Posted: Thu Oct 17, 2024 12:36 am
by dlevel
Yes it's ORK2!
Just an update. I changed completely how I give quests to player, removed every quest from player's Journal with waiting for start and have a gameobject as a quest giver, and run a script to give quests to the player this way. Also making sure that the handwritten quests are not trying to re-give to the player. Seems this way to work better, rolled out an update to see how it works for players.
That might not help with auto-generated quests trying to give to the player again, but I think the issue lies somewhere there, Quest Machine works great but you have to be careful to not try to give a quest to player that already done or cut quests suddenly between a step with play alt+f4 for example. Still early but I believe this is where the issues come from, and having safeguards for these behaviors would help
Re: ORK integration
Posted: Thu Oct 17, 2024 9:09 pm
by Tony Li
Hi,
I'm glad you may have found a solution for your setup. I've been experimenting with the ORK 2 demo project as set up by Quest Machine's integration (i.e., scenes 0 Main Menu QM, 1 Town QM, etc.). It's set up to save when you interact with the sphere near the tree in town. I've tried saving and loading in various ways, and the quest journal has been stable. Saving is very quick in this small project, though, so I haven't been able to interrupt ORK while it's writing saved game data to disk if that's the issue.
Re: ORK integration
Posted: Sun Oct 27, 2024 2:41 am
by dlevel
So it seems that the issues kinda disappeared with the new changes. Some requests/suggestions:
1) The issue now is that old accounts have some bugged quests (the ones that doesn't give the steps, just the headline of the quest), there is no way to remove these quests, so ppl don't get new generated same quests. Need a way to be able to clean those, these are bugged on both generative and handwritten quests
2) The issue that the quests bugs when you try to give them again manually would be great if avoided, I can manually do it but as a failsafe inside quest machine would be great to check if the quests is already given to the player and not try to give it again and bug out (I know in generative quests you have something like that, so thats for handwritten ones)
Especially issue no1 would be great to have a solution so players don't have bugged quests
Re: ORK integration
Posted: Sun Oct 27, 2024 9:23 am
by Tony Li
Hi,
Let me know if the approach below would work for you. If so, I can provide more details.
When you prepare the next update for your game, increase the Save System component's Version value. This value gets included in saved games.
Connect a C# method to the
SaveSystem.saveDataApplied C# event. In the method, check SaveSystem.currentSavedGameData.version. If it's an old version, go through the QuestJournal's quest list. Remove the affected quests, and optionally add them again in code so the player gets a fresh, working version.
Re: ORK integration
Posted: Mon Oct 28, 2024 9:37 am
by dlevel
Hmm that might work, if you have more details please share
Re: ORK integration
Posted: Mon Oct 28, 2024 10:01 pm
by Tony Li
Hi,
We may be able to simplify the process. Are you using MakinomQuestMachineSaveData? Or relying on QuestJournalForORK to save the player's journal?
Re: ORK integration
Posted: Tue Oct 29, 2024 2:48 am
by dlevel
That'd be great.
So I m not sure but I have these:
ORKQuestMachineSaveData class as a component on QuestMachine GO:
Code: Select all
// Copyright © Pixel Crushers. All rights reserved.
using UnityEngine;
using ORKFramework;
namespace PixelCrushers.QuestMachine.ORKSupport
{
/// <summary>
/// Add to Quest Machine Save System GameObject to save all Quest Machine data.
/// Typically not required because QuestJournalForORK and QuestGiverForORK also
/// save into ORK's save system.
/// </summary>
public class ORKQuestMachineSaveData : MonoBehaviour, ISaveData
{
public bool debug = false;
// register to the ORK save game handler
protected virtual void Start()
{
ORK.SaveGame.RegisterCustomData("quest_machine", this, false);
DontDestroyOnLoad(this.gameObject);
}
// called when a game is saved
public DataObject SaveGame()
{
DataObject data = new DataObject();
var serializedData = SaveSystem.Serialize(SaveSystem.RecordSavedGameData());
if (debug) Debug.Log(GetType().Name + ".SaveGame: " + serializedData);
data.Set("savedgamedata", serializedData);
return data;
}
// called when a game is loaded
// depending on the 'beforeSceneLoad' parameter of the registration,
// the function will be called either before or after loading the scene.
public void LoadGame(DataObject data)
{
if (data != null)
{
string s = null;
data.Get("savedgamedata", ref s);
if (string.IsNullOrEmpty(s))
{
if (debug) Debug.Log(GetType().Name + ".LoadGame: No data to restore.");
}
else
{
if (debug) Debug.Log(GetType().Name + ".LoadGame: " + s);
var savedGameData = SaveSystem.Deserialize<SavedGameData>(s);
if (savedGameData != null)
{
SaveSystem.ApplySavedGameData(savedGameData);
}
}
}
}
}
}
SaveSystem with version 0 on Quest Machine GO and Quest Journal for ORK on player with Include in Saved Games true. This is my setup but I trully don't know what might not be needed here. Would be awesome if we figure this out and fix it