playMaker

Author Topic: Play Random Sound Plays Same Order Every Time  (Read 679 times)

Xander Davis

  • Playmaker Newbie
  • *
  • Posts: 24
    • View Profile
Play Random Sound Plays Same Order Every Time
« on: July 04, 2017, 12:32:46 PM »
Hi, I'm using Play Random Sound.  It works-- except it doesn't.

It chooses a random sound from the list (164, all with Weight set to 1), but on every single play through, it plays them in the exact same order...  (they're voice over barks)

Advice?

Xander Davis

  • Playmaker Newbie
  • *
  • Posts: 24
    • View Profile
Re: Play Random Sound Plays Same Order Every Time
« Reply #1 on: July 04, 2017, 10:18:52 PM »
PS: Incidentally, Weight is the only thing completely absent from the Play Random Sound documentation.

???

Is this a bug?  Should be super simple...

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4369
    • View Profile
    • jinxtergames
Re: Play Random Sound Plays Same Order Every Time
« Reply #2 on: July 05, 2017, 07:24:05 AM »
Hi,
I cant test right now, but can you try 'Play Random Audio' instead (test with 4 sounds or so)
You can find the action on the Ecosystem
FOR HIRE:Playmaker/C#

Playmaker Samples <-------------> Easy Exporter <---------------------> TPA Actions

Ofonna

  • Full Member
  • ***
  • Posts: 230
    • View Profile
Re: Play Random Sound Plays Same Order Every Time
« Reply #3 on: July 05, 2017, 12:58:30 PM »
hi, create an object array, insert all the sounds you need in the array, use the array get random action and in the next state play audio and then loop back and forh between the states, that's the best way to do this

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4369
    • View Profile
    • jinxtergames
Re: Play Random Sound Plays Same Order Every Time
« Reply #4 on: July 05, 2017, 04:54:39 PM »
Hi,
@Carmichael Actually i have to disagree with you.

"Play Random Audio" is using 'List' which works faster than 'Array'

Quote
List<T> should generally be preferred over Array

faster for value types as it avoids boxing.
strongly typed elements

But then again you will only start to notice this when you have like 100.000 Lists/Arrays

So it both ways would be fine :)
FOR HIRE:Playmaker/C#

Playmaker Samples <-------------> Easy Exporter <---------------------> TPA Actions