Page 1 of 1

Run script in node only once

Posted: Mon Dec 26, 2022 9:39 pm
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!

Re: Run script in node only once

Posted: Mon Dec 26, 2022 10:16 pm
by Tony Li
No; you'll need to use two separate nodes.

Re: Run script in node only once

Posted: Mon Dec 26, 2022 10:20 pm
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!

Re: Run script in node only once

Posted: Tue Dec 27, 2022 8:29 am
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.