Save system with VRIF under the hood questions.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
fd_maker
Posts: 5
Joined: Wed Jul 06, 2022 2:21 pm

Save system with VRIF under the hood questions.

Post by fd_maker »

Ho Tony.

Got a question for you on inventory management and the save system.

I'm using VRIF, Dialogue System (for save, scene transitions and quests, but no NPC talks) and building for quest with Unity.

So I have the save system setup and working for scene transitions with the standard VRIF player controller. But I am trying to figure out how to carry over inventory items through the game saves and scene transitions.

I have a test sword setup in two test scenes. I have a dialogue manager setup with a level manager attached and a save persistent position saver on the sword object. Yet when I pass through a scene transition, I lose the sword object.

I remember in the way back working with RFPS and the save system (where it works almost out of box) and there was a index of RPFS weapons that save system seemed to index that was attached to the player controller? But with the new VRIF implementation, I have dozens of weapons and items that can be added into VRIF inventory save points, so I'm not sure how to build that index with this in mind.

Is there a way to add a saver component on a individual object and have it save across scenes?


Should I use the spawn manager for this? (use case, weapons are just spawned in the start of the game to be used later...)



Cheers.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save system with VRIF under the hood questions.

Post by Tony Li »

Hi,

Does VRIF have an inventory system? Or are you using a separate inventory system?

In either case, you'll probably need to write a custom saver script to save the inventory. Please see:
How To: Write Custom Savers
fd_maker
Posts: 5
Joined: Wed Jul 06, 2022 2:21 pm

Re: Save system with VRIF under the hood questions.

Post by fd_maker »

VRIF doesn't have an inventory system per se....

It has a system of "snap points" in a four point snap system attached to the player controller out of box. (One at each shoulder, one at each hip)

You can snap weapons into them like a holster. (or any object that has the snap point script)

Then you can build a backpack with nine snap points and use that as your "inventory" system, but it only works in the level you are in and everything gets dumped on a scene change.


I was looking through the VRIF code last night looking for some sort of unique identifier on the snap points and am not sure I came across anything. There must be something though in the script somewhere though...

Right now, I am pawing through the old inventory system in the RFPS code and looks like there is a per-established weapon index array that is not there in VRIF, So I'm not sure how to proceed in the design. Will continue to muddle through it.. It's almost my last "bug" I have to fix before release.

Don't you have a pre-exisiting inventory system?. Now I am wondering if that is an easier solution and could be wed with the VRIF snap point system.


Cheers mate!
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save system with VRIF under the hood questions.

Post by Tony Li »

Hi,

RFPS is nice as a first-person shooter system, but I wouldn't model a new inventory system on its inventory system. The Dialogue System has good integration with More Mountains' Inventory Engine and Opsive's Ultimate Inventory System. Since you'd still need to write code to interface those inventory systems with VRIF's snap point system, it'll probably be easier to skip the inventory system entirely and write a custom saver to save what (if anything) is in each snap point.

For example, you could call the script SnapPointSaver and add an instance to each of the snap points, assigning a unique Key to each. In the RecordData() method, record a blank string if the snap point is empty, or the name of the item GameObject (or some other unique identifier) if something's snapped to it. In ApplyData(string), check if the string is non-empty. If so, load/get a reference to the item GameObject and snap it to the snap point.
fd_maker
Posts: 5
Joined: Wed Jul 06, 2022 2:21 pm

Re: Save system with VRIF under the hood questions.

Post by fd_maker »

Tony Li wrote: Wed Dec 27, 2023 3:23 pm Hi,

Does VRIF have an inventory system? Or are you using a separate inventory system?

In either case, you'll probably need to write a custom saver script to save the inventory. Please see:
How To: Write Custom Savers
Looks like the very bottom has almost the exact type of example in code. Off to give it a try....
Post Reply