Page 23 of 24

Re: ORK integration

Posted: Tue Oct 29, 2024 2:11 pm
by Tony Li
Hi,

On your QuestJournalForORK and QuestGiverForORK component(s), have you ticked Allow ORK Quest Machine Save Data To Save? If not, the game will be double-saving quest data, so you'll want to tick those checkboxes.

In any case, edit the ORKQuestMachineSaveData.cs script.

In the LoadGame method, change this:

Code: Select all

if (savedGameData != null)
{
    SaveSystem.ApplySavedGameData(savedGameData);
}
to this:

Code: Select all

if (savedGameData != null)
{
    SaveSystem.ApplySavedGameData(savedGameData);
    if (savedGameData.version < 1) FixQuests();
}

Then add a method like this to the script:

Code: Select all

void FixQuests()
{
    var journal = QuestMachine.GetQuestJournal();
    var questsToCheck = new System.Collections.Generic.List<Quest>(journal.questList);
    foreach (var quest in questsToCheck)
    {
        bool isBugged = !quest.isProcedurallyGenerated;
        if (isBugged) journal.DeleteQuest(quest);
    }
}
You may want to check this line:

Code: Select all

bool isBugged = !quest.isProcedurallyGenerated;
Currently it sets "isBugged" true if the quest isn't procedurally generated. Change it to whatever criteria works for your scenario.

The code above simply removes the quest from the player's journal. If you instead want to add a fresh copy of the quest, change the line "if (isBugged)" to:

Code: Select all

    if (isBugged)
    {
        var originalQuestAsset = quest.originalAsset;
        journal.DeleteQuest(quest);
        var questInstance = originalQuestAsset.Clone();
        var questerTextInfo = new QuestParticipantTextInfo(journal.id, journal.displayName, journal.image, null);
        questInstance.AssignQuester(questerTextInfo);
        questInstance.timesAccepted = 1;
        journal.deletedStaticQuests.Remove(StringField.GetStringValue(questInstance.id));
        journal.AddQuest(questInstance);
        questInstance.SetState(QuestState.Active);
    }

Re: ORK integration

Posted: Wed Oct 30, 2024 2:46 am
by dlevel
before trying this lets fix the double saving if it exists.

here is my QuestJournalForORK (dont see a setting like the one you mentioned) that is attached on player:

https://ibb.co/s3XfV15

here is the questgivers (again no such an option)

https://ibb.co/DG1Tc0b

LMK if I need to change anything on those.
Thank you

Re: ORK integration

Posted: Wed Oct 30, 2024 7:25 am
by Tony Li
Hi,

Please import these updated inspector files:

QM_ORK2_EditorPatch_2024-10-30.unitypackage

Then you should see the checkboxes at the bottom of each inspector.

Re: ORK integration

Posted: Wed Oct 30, 2024 8:41 am
by dlevel
seems my QuestJournalForORK bugged after update:

https://ibb.co/mcH4MDV

Other settings are empty and dissapearing the Dialogue Content and Quests dropdown menus as well, also setting isnt there

QuestGiverForORK now has the option

Re: ORK integration

Posted: Wed Oct 30, 2024 8:49 am
by Tony Li
Any errors or warnings in the Console window?

Here's the full integration package in case you have an old QuestJournalForORK that doesn't work with the updated inspector script:

QM_ORK2Support_20241030.unitypackage

Re: ORK integration

Posted: Wed Oct 30, 2024 9:07 am
by dlevel
Yes sorry, here are the errors:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.EditorGUILayout.IsChildrenIncluded (UnityEditor.SerializedProperty prop) (at <4f70cf68b8b24a78aa3a87c1d6120925>:0)
UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUILayoutOption[] options) (at <4f70cf68b8b24a78aa3a87c1d6120925>:0)
PixelCrushers.QuestMachine.QuestGiverEditor.DrawOtherSettingsInterior () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Editor/Quest Editors/Quest MonoBehaviour Editors/QuestGiverEditor.cs:62)
PixelCrushers.QuestMachine.QuestListContainerEditor.DrawOtherSettings () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Editor/Quest Editors/Quest MonoBehaviour Editors/QuestListContainerEditor.cs:135)
PixelCrushers.QuestMachine.QuestGiverEditor.OnInspectorGUI () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Editor/Quest Editors/Quest MonoBehaviour Editors/QuestGiverEditor.cs:25)
PixelCrushers.QuestMachine.ORKSupport.QuestJournalForORKEditor.OnInspectorGUI () (at Assets/Pixel Crushers/Quest Machine/Third Party Support/ORK Framework Support/Scripts/Editor/Quest List MonoBehaviours/QuestJournalForORKEditor.cs:14)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass76_0.<CreateInspectorElementUsingIMGUI>b__0 () (at <4f70cf68b8b24a78aa3a87c1d6120925>:0)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.EditorGUILayout.IsChildrenIncluded (UnityEditor.SerializedProperty prop) (at <4f70cf68b8b24a78aa3a87c1d6120925>:0)
UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUILayoutOption[] options) (at <4f70cf68b8b24a78aa3a87c1d6120925>:0)
PixelCrushers.QuestMachine.QuestGiverEditor.DrawOtherSettingsInterior () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Editor/Quest Editors/Quest MonoBehaviour Editors/QuestGiverEditor.cs:62)
PixelCrushers.QuestMachine.QuestListContainerEditor.DrawOtherSettings () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Editor/Quest Editors/Quest MonoBehaviour Editors/QuestListContainerEditor.cs:135)
PixelCrushers.QuestMachine.QuestGiverEditor.OnInspectorGUI () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Editor/Quest Editors/Quest MonoBehaviour Editors/QuestGiverEditor.cs:25)
PixelCrushers.QuestMachine.ORKSupport.QuestJournalForORKEditor.OnInspectorGUI () (at Assets/Pixel Crushers/Quest Machine/Third Party Support/ORK Framework Support/Scripts/Editor/Quest List MonoBehaviours/QuestJournalForORKEditor.cs:14)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass76_0.<CreateInspectorElementUsingIMGUI>b__0 () (at <4f70cf68b8b24a78aa3a87c1d6120925>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Re: ORK integration

Posted: Wed Oct 30, 2024 2:02 pm
by Tony Li
If you back up your project and import the integration package above, do the errors go away?

Re: ORK integration

Posted: Wed Oct 30, 2024 3:47 pm
by dlevel
Exact same errors by importing the integration package above. Unity 2022 btw if that makes any difference

Re: ORK integration

Posted: Wed Oct 30, 2024 7:44 pm
by Tony Li
The custom inspector script had a typo that an earlier version of Unity was okay with, so it didn't get caught by testing. Here's the fix:

QM_ORK2_EditorPatch_2024-10-30-1.unitypackage

Re: ORK integration

Posted: Thu Oct 31, 2024 1:34 am
by dlevel
Updated and it works, now the issue is that old saves dont load any quests, haven't done any changes to the ORKQuestMachineSaveData yet, just loaded the new scripts and enabled the option you suggested