Actor Field variable not updating in active conversation

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
street
Posts: 3
Joined: Tue Jun 21, 2022 5:23 am

Actor Field variable not updating in active conversation

Post by street »

Hi Tony,
moving discussion from Discord. I have updated the DS to 2.2.28, Unity LTS 2021.3.1f1, the issue is still present.

Summary:
Variables in Conversant Actor Field are not updating in active conversation
  • Custom C# OnConversationStart() script calculates new Health value and set it back via

    Code: Select all

    DialogueLua.SetActorField(conversantName, "Health", newHealth);
    //debug
    DialogueLua.SetActorField("Actor", "Health", 2);
  • in Watches i can see that the Actor["Actor"].Health has correct newHealth value
Issue:
  • Conversant Actor Field Health is not updating in active conversation (still has the old value, which I need to update for other conditions in that conversation)

Thank you!
User avatar
Tony Li
Posts: 22148
Joined: Thu Jul 18, 2013 1:27 pm

Re: Actor Field variable not updating in active conversation

Post by Tony Li »

Hi,

I'm afraid I still don't follow. You say that Actor["Actor"].Health has the correct value in Watches. Where does it not have the correct value? Are you looking at the Actors section of the Dialogue Editor? If so, then that's expected. Only the Watches section shows runtime values. The other sections show initial database values.
User avatar
street
Posts: 3
Joined: Tue Jun 21, 2022 5:23 am

Re: Actor Field variable not updating in active conversation

Post by street »

Then it is correct, I was looking at the Dialog Editor. While writing this and checking it, I have found that OnConversationStart method sets the variables "slower", after the condition is checked in the conversation (I am checking it right after START node), if I put node with Delay after START node, it works fine. Is there any way how to avoid using node with Delay?

Thank you
User avatar
Tony Li
Posts: 22148
Joined: Thu Jul 18, 2013 1:27 pm

Re: Actor Field variable not updating in active conversation

Post by Tony Li »

User avatar
street
Posts: 3
Joined: Tue Jun 21, 2022 5:23 am

Re: Actor Field variable not updating in active conversation

Post by street »

ah yes, I didnt know that the custom script will behave the same way in this situation, but when I think about it, it makes sense. Thank you a lot for help!
User avatar
Tony Li
Posts: 22148
Joined: Thu Jul 18, 2013 1:27 pm

Re: Actor Field variable not updating in active conversation

Post by Tony Li »

Glad to help!
Post Reply