RandomizeNextEntry that never plays the same entry twice in a row

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
lgarczyn
Posts: 30
Joined: Fri May 05, 2023 5:28 am

RandomizeNextEntry that never plays the same entry twice in a row

Post by lgarczyn »

RandomizeNextEntry is extremely useful, and I've made quite a large usage of it, however it causes a lot of accidental repetitions.

In FMOD, the default randomization behavior is to avoid repetition.

There isn't even a great need for complexity, just avoid playing the last entry that was randomly selected. Because the problem is mostly noticeable when a conversation is played twice in a row, this would solve 90% of the issue.
User avatar
Tony Li
Posts: 20635
Joined: Thu Jul 18, 2013 1:27 pm

Re: RandomizeNextEntry that never plays the same entry twice in a row

Post by Tony Li »

Hi,

I'll look into writing a separate function/script for that. It will require each instance of RandomizeNextEntry() to remember the most recently-chosen entry so it doesn't repeat it next time.
lgarczyn
Posts: 30
Joined: Fri May 05, 2023 5:28 am

Re: RandomizeNextEntry that never plays the same entry twice in a row

Post by lgarczyn »

That would be the most extreme case, but realistically, we just want to avoid the last entry to replay.

Simply storing the previous result globally is enough

The problem is that RandomizeNextEntry is *not* a normal sequence instruction.

It's handled by the Sequencer itself, setting a static flag on the conversation controller, which is consumed when the subtitles finish.

I don't think it can be implemented as a custom sequencer instruction, but only by modifying the ConversationController itself.
User avatar
Tony Li
Posts: 20635
Joined: Thu Jul 18, 2013 1:27 pm

Re: RandomizeNextEntry that never plays the same entry twice in a row

Post by Tony Li »

You could technically do it with variables and conditions (e.g., using the built-in 'thisID' Lua variable) but it'll be cleaner for me to add a Lua function like RandomizeNextEntry() that doesn't repeat.
Post Reply