Invector shooter saving
Invector shooter saving
Hi
I using the invector tpc and need some help with the save system. I got everything working except when the player dies he respawns with nothing saved no inventory or quest. When I change scenes everything is good and when I load game everything is good. Any help would be appreciated.
I using the invector tpc and need some help with the save system. I got everything working except when the player dies he respawns with nothing saved no inventory or quest. When I change scenes everything is good and when I load game everything is good. Any help would be appreciated.
Re: Invector shooter saving
Hi,
You will need to modify two files: InvectorStatsSaver.cs and vGameController.cs.
In InvectorStatsSaver.cs, add this variable:
At the beginning of the ApplyData() method, add this code:
This tells InvectorStatSaver to not apply the saved stats when respawning, since the saved stats will be the dead player's stats (i.e., zero health).
Then edit vGameController.cs. In the ResetScene() method (around line 157), change this:
to:
This tells vGameController to use the Pixel Crushers Save System to reload the scene. This saves the player's info first, then loads the scene, then applies the info (quests, inventory).
You will need to modify two files: InvectorStatsSaver.cs and vGameController.cs.
In InvectorStatsSaver.cs, add this variable:
Code: Select all
public static bool isResettingScene = false;
Code: Select all
public override void ApplyData(string s)
{
if (isResettingScene) { isResettingScene = false; return; } //<--ADD THIS.
Then edit vGameController.cs. In the ResetScene() method (around line 157), change this:
Code: Select all
SceneManager.LoadScene(scene.name);
Code: Select all
PixelCrushers.DialogueSystem.InvectorSupport.InvectorStatsSaver.isResettingScene = true;
PixelCrushers.SaveSystem.LoadScene(scene.name);
Re: Invector shooter saving
Hi thanks for reply
In the vGameController I'm getting a compiling error under the InvectorStatsSaver.
Says the name does not exist in current context.
Sorry but I am not very code savvy.
In the vGameController I'm getting a compiling error under the InvectorStatsSaver.
Says the name does not exist in current context.
Sorry but I am not very code savvy.
Re: Invector shooter saving
Sorry, use this:
I fixed it above, too.
Code: Select all
PixelCrushers.DialogueSystem.InvectorSupport.InvectorStatsSaver.isResettingScene = true;
PixelCrushers.SaveSystem.LoadScene(scene.name);
Re: Invector shooter saving
Thanks again for such fast reply the compiling error is gone but I'm still not getting any saved data on respawns after death
Re: Invector shooter saving
On the Invector player, try unticking Use Instance.
Re: Invector shooter saving
Okay, I'll try to post an example scene by tomorrow.
Re: Invector shooter saving
K I really appreciate the help thank you
Re: Invector shooter saving
Okay, one more line to add. In vGameController.cs's OnCharacterDead() method, add this line:
With that, I don't think you'll need an example scene. If you do, let me know.
Code: Select all
PixelCrushers.SaveSystem.RecordSavedGameData(); //<--ADD THIS LINE.
Invoke("ResetScene", respawnTimer);