Random NPC comment

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
DanTalis
Posts: 4
Joined: Mon Oct 22, 2018 2:17 am

Random NPC comment

Post 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.
User avatar
Tony Li
Posts: 22119
Joined: Thu Jul 18, 2013 1:27 pm

Re: Random NPC comment

Post 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.
DanTalis
Posts: 4
Joined: Mon Oct 22, 2018 2:17 am

Re: Random NPC comment

Post 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? :|
User avatar
Alatriste
Posts: 181
Joined: Wed Nov 11, 2015 5:07 pm
Contact:

Re: Random NPC comment

Post by Alatriste »

Looking forward to seeing the new improvements you added!! 8-)
User avatar
Tony Li
Posts: 22119
Joined: Thu Jul 18, 2013 1:27 pm

Re: Random NPC comment

Post 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
DanTalis
Posts: 4
Joined: Mon Oct 22, 2018 2:17 am

Re: Random NPC comment

Post by DanTalis »

Great, I'm hoping the 'Trial' will have this feature so I can try to get things working before I buy.
User avatar
Tony Li
Posts: 22119
Joined: Thu Jul 18, 2013 1:27 pm

Re: Random NPC comment

Post 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.
indevergames
Posts: 5
Joined: Mon Feb 21, 2022 3:28 am

Re: Random NPC comment

Post 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 1168 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
User avatar
Tony Li
Posts: 22119
Joined: Thu Jul 18, 2013 1:27 pm

Re: Random NPC comment

Post 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?
Post Reply