Run script in node only once

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
cptscrimshaw
Posts: 113
Joined: Sun Sep 20, 2020 8:21 pm

Run script in node only once

Post by cptscrimshaw »

Hi Tony,

I have a script that moves NPCs to different locations during a dialogue node (e.g., a few feet to the right). But if you repeat the dialogue, it obviously runs that script and moves them to the right again. :) Is there any way to only execute a script within a node only once? Maybe something with the SIM status? Looked around a bit and couldn't find an easy solution.

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

Re: Run script in node only once

Post by Tony Li »

No; you'll need to use two separate nodes.
cptscrimshaw
Posts: 113
Joined: Sun Sep 20, 2020 8:21 pm

Re: Run script in node only once

Post by cptscrimshaw »

Hmm... that could end up being hundreds and hundreds of nodes (and variables for conditions). Is there some more automated way I could go about coding it? Happy to put in the work, just want to make sure I approach it from the right perspective.

And thanks for the quick response - hope you had a nice holiday so far!
User avatar
Tony Li
Posts: 22140
Joined: Thu Jul 18, 2013 1:27 pm

Re: Run script in node only once

Post by Tony Li »

In the Script field, you could call your own C# method (see here) and in that method check if you should do the action or not.
Post Reply