Spawn / Save system?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
CheeseY
Posts: 15
Joined: Thu Aug 05, 2021 8:07 am

Spawn / Save system?

Post by CheeseY »

Hi,

So i've only got the dialogue system.. But it's pretty amazing tbh -- really pleased with it, well worth the money.


I'll explain briefly what im going for and what i've done... very briefly cus i dont want to bore you or confuse the issue, and hopefully you can advise me what i should do... If you have a suggestion that is.

So, i've put a field on my Actors... ( 'InParty' ) and i have a script that checks that... that determines whether a character is (you guess it) in the party. This means they follow you, when you tell them.
That's awesome, ive got a little convo that toggles leave/join party dialogue... It all works well.





The desire is... Lets say i have 4 characters... The player and 3 companions... i have 2 levels... a HQ and a world.
All the companions are placed in the HQ level.

You should be able to leave the hq level with any combination of companion and player... and the others keep their 'spawn position at the HQ' but the companions in your party... should obviously... not be respawned when you go back to the HQ... and they should follow you into other levels.

Included in the dialogue system, is a save/load thing and scene transitions...
Now, i tried a scene portal and the spawn object system.. and a position saver... I mean, i saw some promising stuff... I could get these to follow me into the other level...


I don't expect you to solve it for me, but i figured you would know best... which of your components i should be using, which i shouldn't be using... If you've got anything that handles this? or... a similar use-case that could be adapted...

So you know, I'm not terrible with C# --- I can get by and force shit to work... But i am not a professional by any means. I'm not sure how much you will have to dumb down your answer :D


thanks!
User avatar
Tony Li
Posts: 21986
Joined: Thu Jul 18, 2013 1:27 pm

Re: Spawn / Save system?

Post by Tony Li »

Hi,

Thanks for using the Dialogue System!

On your Dialogue Manager GameObject, make sure Persistent Data Settings > Include Actor Data is ticked. This will save your InParty field in saved games when you set up the Save System.

includeActorData.png
includeActorData.png (54.39 KiB) Viewed 556 times

I recommend putting instances of your characters in both scenes (HQ and world). In the world scene, add a Persistent Active Data component to each character. Assign the character to the Target field, configure a Lua Condition to check if the character's InParty field is true, and tick Check On Start:

persistentActiveData.png
persistentActiveData.png (32.07 KiB) Viewed 556 times

If the character is in the party, the GameObject will stay active. Otherwise Persistent Active Data will deactivate it.

You can do something similar in the HQ scene, but shouldn't all characters be present in the HQ scene when the player returns there?
CheeseY
Posts: 15
Joined: Thu Aug 05, 2021 8:07 am

Re: Spawn / Save system?

Post by CheeseY »

Thanks for the quick reply: i'm glad to hear i'm not mis-using the actor variables..

I appreciate you taking the time to try and run me through this solution, and I understand what you've suggested...
I'm not sure if this works though? perhaps i over simplified my example..


Eventually I am going to have more than 'HQ and world': There will be HQ and many other levels... Placing every available party member in every other level seems a bit.. like a place where i might end up creating more problems for myself?


I think i'm going to just query your level load system and ask it if the current loaded level is the 'Hq' level..
and if not... iterate through all the available party members and spawn the prefabs of the ones 'InParty' near the player's position...

Not sure how 'good' an idea that is lol, but it'll save my creating duplicates :D


Another quick question -- is it possible to view at runtime, the custom actor field values? I opened a 'variable viewer' window but the runtime column just showed me ??? Not sure if i had to have something selected...




cheers,
Tony C
User avatar
Tony Li
Posts: 21986
Joined: Thu Jul 18, 2013 1:27 pm

Re: Spawn / Save system?

Post by Tony Li »

Hi,

That sounds like a good solution for spawning characters / party members.

The Variable Viewer window only shows the runtime values of variables. Use the Dialogue Editor's Watches tab to view runtime values of fields that aren't variables.
Post Reply