Continue Behavior After Leave and Return?

Vaulcul

New member
I have a scene with a character that is performing a task, the player may leave the area (changing scenes) and then return later. When the player returns I would like that character to continue their task that they were originally doing from the point they were at when the player left.

How would I accomplish this?

I have looked through the documentation and forums and have not been able to find/see anything that would point me in the right direction for this.

Thanks in advance for your assistance.
 
Is there a way to set the place the tree stopped as a variable and call it to start at that spot when the scene starts again? Or something similar to this?
 
Sorry I missed this.

Out of the box Behavior Designer does not include save/load which would be perfect for this situation. I have heard of others extending the scripts in order to add support for it but I do not have the new source code. You'll need to serialize/deserialize the task variables as well as the variables within the Behavior Manager.

Another work around may be to just save everything with DontDestroyOnLoad, pause the behavior tree, move to the next scene, and when you go back you then resume the behavior tree.
 
Justin, thanks for the reply.

I think setting this up shouldn't be too hard... more time consuming than anything (lots of variables being set).

I am having a hard time pulling the Global Variables as if I try and Get/Set per the documentation the line gets flagged and I'm informed that "Cannot implicitly convert type SharedVariable to GlobalVariables"

Here's what I'm trying to do in my code:

.
.
.
public GlobalVariables Messenger;
.
.
.
Messenger = GlobalVariables.Instance.GetVariable("MessengerVariable");'
 
Okay... apparently even though these are GlobalVariables, I should be using the SharedVariable class.

In searching the forums further... I've found other people asking for this and your comments about issues w/ Serialization.

Maybe I'll hold off on this part of my project till you get version 2 out. Assuming this is still on the docket for the new version.
 
Top