Easy Main Menu Inventory Integration

Announcements, support questions, and discussion for the Dialogue System.
William618
Posts: 7
Joined: Thu Sep 12, 2019 3:11 am

Easy Main Menu Inventory Integration

Post by William618 »

Hello,
I would like to know if you can tell me how I can use the dialog system save system with the inventory integration for Invector of the easy main menu. Then I could save as well which equipment is currently equipped. I have tried to remove the dialog system inventory script for invector and add the easy main menu inventory script on my player but it doesn't work properly if I use the saving system of the dialog system. When I do this then it will do a duplication of my inventory. It would be great if it is possible. :) I hope that you can help me and thanks for all these great integrations.
User avatar
Tony Li
Posts: 20543
Joined: Thu Jul 18, 2013 1:27 pm

Re: Easy Main Menu Inventory Integration

Post by Tony Li »

Hi,

Thanks for posting on the forum.

As a first test, I recommend setting up a scene to test saving and loading using the only the Dialogue System, without EMM. Use these steps to set up the Invector Inventory Saver component. Remember to add the USE_INVECTOR_INVENTORY Scripting Define Symbol as described here. Once you've confirmed that saving & loading works properly, you can add in EMM.

When using Easy Main Menu with the Dialogue System's save system, EMM handles the save & load UI, but it tells the Dialogue System to do the data processing such as recording the player's inventory when saving and reapplying that inventory when loading. So I don't think you need to use the Item Save Load Manager and Retrieve Current Items components.
William618
Posts: 7
Joined: Thu Sep 12, 2019 3:11 am

Re: Easy Main Menu Inventory Integration

Post by William618 »

Hello,

Maybe I was too tired yesterday night or just idiot :D thanks for your fast reply. It works perfectly and I haven't change anything today to make it work. Btw another question : To switch from a scene to the next scene should I use the Dialogue System Trigger (for exemple: Door to DemoScene2) or should I use Ende Scene Trigger from EMM that I can't make work for now? I watched twice the tutorial but can't find the answer into it.
User avatar
Tony Li
Posts: 20543
Joined: Thu Jul 18, 2013 1:27 pm

Re: Easy Main Menu Inventory Integration

Post by Tony Li »

You can either use EMM's scene changer (which will use EMM's loading UI) or a Scene Portal from the Dialogue System. The Dialogue System Trigger technique will work, too. If you use the Dialogue System Trigger or Scene Portal, you'll want to set up the Dialogue System's Scene Transition Manager to look similar to EMM's loading UI. (Save System Tutorial)
William618
Posts: 7
Joined: Thu Sep 12, 2019 3:11 am

Re: Easy Main Menu Inventory Integration

Post by William618 »

Ok thanks for your reply. I will try to use the EMM one.. then I can use the EMM loading UI. Just doesn't work for now. It loads the loading UI but not the next scene. Just gives me a black screen. I receive the Debug Log Scene 2 loaded and receive 2 warnings :

Save System: No SavedGameDataStorer found on Save System. Adding PlayerPrefsSavedGameDataStorer.
UnityEngine.Debug:Log(Object, Object)
PixelCrushers.SaveSystem:get_storer() (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:139)
PixelCrushers.SaveSystem:HasSavedGameInSlot(Int32) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:423)
PixelCrushers.SaveSystem:LoadFromSlot(Int32) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:468)
LoadingScreen:load() (at Assets/EasyMainMenu/Scripts/Loading Screen Scripts/LoadingScreen.cs:346)

Save System: LoadFromSlot(0) but there is no saved game in this slot.
UnityEngine.Debug:LogWarning(Object)
PixelCrushers.SaveSystem:LoadFromSlot(Int32) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:470)
LoadingScreen:load() (at Assets/EasyMainMenu/Scripts/Loading Screen Scripts/LoadingScreen.cs:346)


It uses the EndScreen.cs from EMM it is like there is a conflict with the save system. I am not sure. Anyway I am near my objective :D
William618
Posts: 7
Joined: Thu Sep 12, 2019 3:11 am

Re: Easy Main Menu Inventory Integration

Post by William618 »

Do you think that there is maybe an issue with the player prefs? the function ist built like this :
(If the scene name is wrong I would just get a null exception and no problem to load the Level2 directly from the main menu)

public void gotoNextScene() {

//delete slot id
PlayerPrefs.DeleteKey("slotLoaded_");

//delete player
GameObject player = GameObject.FindGameObjectWithTag("Player");
Destroy(player);

//restore time scale (important)
Time.timeScale = 1f;

//load main menu
PlayerPrefs.SetString("sceneToLoad", nextScene);

//hide all menus
Canvas[] allUI = FindObjectsOfType<Canvas>();
//disable all UI
for (int i = 0; i < allUI.Length; i++)
{
if (allUI.name != "Fader")
allUI.gameObject.SetActive(false);
}

//load level via fader
FindObjectOfType<Fader>().FadeIntoLevel("LoadingScreen");
}

}
User avatar
Tony Li
Posts: 20543
Joined: Thu Jul 18, 2013 1:27 pm

Re: Easy Main Menu Inventory Integration

Post by Tony Li »

It shouldn't be trying to load from a slot if you're just changing scenes. I can check it out again by Saturday. I recall that there may have required some changes to EMM scripts. I don't remember if the EMM dev's tutorial covered that.
William618
Posts: 7
Joined: Thu Sep 12, 2019 3:11 am

Re: Easy Main Menu Inventory Integration

Post by William618 »

Ok thanks. There is no EMM Tutrorial I think from EMM about the dialog system integration. The line 346 in this case from the EMM script send back to a if...else... used with dialog system. It detects that is a valid scene that must be loaded but yes it tries to access a slot. I will try to comment one or 2 lines tonight from EMM script and let you know if I can find the issues before Saturday. Anyway thanks for your support. You are amazing and dialog system as well :)
User avatar
Tony Li
Posts: 20543
Joined: Thu Jul 18, 2013 1:27 pm

Re: Easy Main Menu Inventory Integration

Post by Tony Li »

Hi,

Thanks! I'll put together an example and post it here by tomorrow morning. (I'll try to get it done today, but I want to set expectations properly. I'm working through a lot of support requests right now, and I'm getting them done as quickly as I can.) You should be able to use the example to get your setup working. I'll include documentation with it.
William618
Posts: 7
Joined: Thu Sep 12, 2019 3:11 am

Re: Easy Main Menu Inventory Integration

Post by William618 »

Thank you so much! Ok I will wait for your update. Yep i know it shouldn't be easy with all these requests. I am impressed by your reactivity anyway :) can't wait to go deeper into the dialog system!
Post Reply