I'm tryning to code a random voice selection for win pose.Something like 50% of chance of each of the to voice to occur.I tried for several minutes, but even with the docs, I cannot completed it effectively.sounds are :181,0181,1I know the structure is bad...What I started.Code: ;;;;random number between 0 and 999, inclusive.[State 181, Voice]type = PlaySndTriggerall = ifelse(random, <=499, <499)trigger1 = !Timevalue = 181,0channel = 0Any help is welcome.
XGargoyle said, August 10, 2020, 03:23:30 pm[State 181, Voice]type = PlaySndtrigger1 = !Timevalue = 181,random%2channel = 0Thanks a lot, friend !So I can get rid of ifelse.Since this code is simplier and better.
So, I feel like adding some more information for future reference.First, I don't quite understand what you did there. The right thing would be:[State 181, Voice]type = PlaySndtrigger1 = !Timevalue = 181,ifelse(random < 500, 0, 1); if random is less than 500, sound will be 0, if not, will be 1channel = 0XG's method also works the same, "random%x", in resume, will generate a number starting from 0, up to the number you replace x with, in this case is %2, so between 0 and 1.Second, random generates a number between 0 and 999 every tick, yes, but EACH and EVERY random are different numbers, even in the same block of code.Let's suppose you want a 33% chance of something happening, you will NOT use this:trigger1 = random >=333 && random < 666the 2 randoms here will not be the same number. They act individually. For a 33% chance, I'd do this:trigger1 = random < 333or, if I need to choose between 3 different numbers:trigger1 = ifelse(random < 333, 0, ifelse(random < 500, 1, 2))I hope it makes sense to you.
This is many many information.But I think I got the idea.thanks friend, for taking the time to explain how it can be done !