Hi guys, I'm trying to put in an action where there's like 2% chance a certain sound file is played in the middle of a trigger, and I basically have no idea as to how I should make this "chance" condition. I'd appreciate any help on the matter.
Thanks in advance!
@DeepCover187: Go You have to add an If, and in the conditions you do a simple math to compare a fixed number with a random Int. You can define the fixed number and interval of variation of your random Int to achieve the % you want. Making the interval be 0 ~ 100 makes it very easy to select % for any random action you want.
Initialization
Events
Game - Map initialization
Local Variables
Interger = 0 <Integer>
Conditions
Actions
Variable - Set Interger = (Random integer between 0 and 100)
General - If (Conditions) then do (Actions) else do (Actions)
If
Interger == 1
Then
Sound - Play Sound Link for (All players) (at 100.0% volume, skip the first 0.0 seconds)
Else
Initialization
Events
Game - Map initialization
Local Variables
Interger = 0 <Integer>
Conditions
Actions
Variable - Set Interger = (Random integer between 0 and 100)
General - If (Conditions) then do (Actions) else do (Actions)
If
Interger == 1
Then
Sound - Play Sound Link for (All players) (at 100.0% volume, skip the first 0.0 seconds)
Else
For a 2% chance, you could do the condition "If Integer <= 1"
Hi guys, I'm trying to put in an action where there's like 2% chance a certain sound file is played in the middle of a trigger, and I basically have no idea as to how I should make this "chance" condition. I'd appreciate any help on the matter. Thanks in advance!
@DeepCover187: Go You have to add an If, and in the conditions you do a simple math to compare a fixed number with a random Int. You can define the fixed number and interval of variation of your random Int to achieve the % you want. Making the interval be 0 ~ 100 makes it very easy to select % for any random action you want.
@DeepCover187:
Here's how I would do something like this.
Initialization
Events
Game - Map initialization
Local Variables
Interger = 0 <Integer>
Conditions
Actions
Variable - Set Interger = (Random integer between 0 and 100)
General - If (Conditions) then do (Actions) else do (Actions)
If
Interger == 1
Then
Sound - Play Sound Link for (All players) (at 100.0% volume, skip the first 0.0 seconds)
Else
For a 2% chance, you could do the condition "If Integer <= 1"
Or instead of that, you could make the variable be from 0 to 50, that and make it only work if the variable is 1, it would still be a 2% chance.
Thanks a ton guys, got it to work now! :)
@DeepCover187:
Awesome, glad to help. :)