Page 1 of 1

Random NPC comment

Posted: Mon Oct 22, 2018 2:23 am
by DanTalis
Hi, is it possible to have an NPC make a random comment (from a list) or ask a random question (from a list)? Thanks.

Re: Random NPC comment

Posted: Mon Oct 22, 2018 11:45 am
by Tony Li
Hi!

In the current version, there are a few ways. They're described in this post.

The quickest way to do a random comment is the RandomElement() Lua function, such as:
  • Dialogue Text: [lua( RandomElement("Nice weather.|How about them sports?|Howdy.|Move it, buddy.") )]
The upcoming version 2.0.5 (being released tomorrow) has a new sequencer command, RandomizeNextEntry(). It tells the Dialogue System to choose the next dialogue entry node randomly from the list of valid nodes instead of using the first one in the list.

Re: Random NPC comment

Posted: Mon Oct 22, 2018 11:22 pm
by DanTalis
DanTalis wrote: Mon Oct 22, 2018 2:23 am The upcoming version 2.0.5 (being released tomorrow) has a new sequencer command, RandomizeNextEntry(). It tells the Dialogue System to choose the next dialogue entry node randomly from the list of valid nodes instead of using the first one in the list.
That's cool. Will it be easy to implement though? Being new to this asset I'm wondering what having a new sequencer command means. Can I just click on a checkbox to make it work or is it node based? :|

Re: Random NPC comment

Posted: Tue Oct 23, 2018 9:00 am
by Alatriste
Looking forward to seeing the new improvements you added!! 8-)

Re: Random NPC comment

Posted: Tue Oct 23, 2018 10:50 am
by Tony Li
DanTalis wrote: Mon Oct 22, 2018 11:22 pm
DanTalis wrote: Mon Oct 22, 2018 2:23 am The upcoming version 2.0.5 (being released tomorrow) has a new sequencer command, RandomizeNextEntry(). It tells the Dialogue System to choose the next dialogue entry node randomly from the list of valid nodes instead of using the first one in the list.
That's cool. Will it be easy to implement though? Being new to this asset I'm wondering what having a new sequencer command means. Can I just click on a checkbox to make it work or is it node based? :|
You'll just need to click the "+" next to the Sequence field, and select Randomize Next Entry from the menu.

Image

Re: Random NPC comment

Posted: Tue Oct 23, 2018 3:13 pm
by DanTalis
Great, I'm hoping the 'Trial' will have this feature so I can try to get things working before I buy.

Re: Random NPC comment

Posted: Tue Oct 23, 2018 3:51 pm
by Tony Li
Absolutely. The evaluation version has all the features of the paid version. The only differences are that it doesn't come with source code, and there's a little watermark during play.

Re: Random NPC comment

Posted: Thu Jun 02, 2022 8:20 pm
by indevergames
Tony Li wrote: Tue Oct 23, 2018 10:50 am
DanTalis wrote: Mon Oct 22, 2018 11:22 pm
DanTalis wrote: Mon Oct 22, 2018 2:23 am The upcoming version 2.0.5 (being released tomorrow) has a new sequencer command, RandomizeNextEntry(). It tells the Dialogue System to choose the next dialogue entry node randomly from the list of valid nodes instead of using the first one in the list.
That's cool. Will it be easy to implement though? Being new to this asset I'm wondering what having a new sequencer command means. Can I just click on a checkbox to make it work or is it node based? :|
You'll just need to click the "+" next to the Sequence field, and select Randomize Next Entry from the menu.

Image

Hi Tony,
I've been trying to use RandomizeNextEntry() but I'm having behavior that is not ideal. I would assume that this should pick the random entry from the linked entries, but instead it is picking an entry from ANYWHERE in the conversation.

Screenshot (895).png
Screenshot (895).png (79.99 KiB) Viewed 970 times

In my example, I have used RandomizeNextEntry() on the <START> entry. There are only two entries that are linked from the start entry, and I want one of those linked entries to be randomly selected. However, ANY of the entries in the entire conversation are chosen, so it might go immediately from <START> to one of the END entries which aren't even linked to that start entry.

Is there any way to limit the randomized selection to only select from the entries with a link from the original entry that has RandomizeNextEntry() applied?

Thanks in advance!
Ben

Re: Random NPC comment

Posted: Thu Jun 02, 2022 8:53 pm
by Tony Li
Hi Ben,

That shouldn't be happening. When you use RandomizeNextEntry(), it make a list of the valid links from the current entry. Then it randomly chooses one of those.

Would it be possible for you to send a reproduction project to tony (at) pixelcrushers.com?