sound-repeat
Hi,
In my project, I have a sound-playing-rule, that says, that the Sound A should be played in random spaces between 3 and 10 seconds.
Mostly it works good. But sometimes when I start the project, after 3 seconds, the sound was played and then it will repeat again and again when it was finished to play - same as looped. But only sometimes !?
What is there wrong?
In my project, I have a sound-playing-rule, that says, that the Sound A should be played in random spaces between 3 and 10 seconds.
Mostly it works good. But sometimes when I start the project, after 3 seconds, the sound was played and then it will repeat again and again when it was finished to play - same as looped. But only sometimes !?
What is there wrong?
Comments
I put a simple behavior inside my "Level-Logic" actor in the scene, which says:
----------
Timer (Random)3,10 sec
Play sound XYZ (run in completion; no loop)
----------
That's it.
with this format I also have two more "Random-Sounds" in this "Level-Logic"-Actor, and they didn't repeat all second, as the one above! But all sounds are about of 1 sec.
Hi Marco
The Timer Behaviour doesn't have "a memory"; what I mean is, whatever the first random time is, it'll continue with that same time. Then there's the problem of triggering the sound after a different random time.
I guess there is more than one solution to these problems; this is one way to go about it (the following is off the top of my head but should work out):
Make an integer attribute called RandT; make a boolean called Switch
Rule: When Switch is false
Change attribute RandT to random(3,10)
Play Sound XYX ---- run to completion unchecked
Timer: After RandT seconds ---- run to completion checked
Change attribute Loop to true
Rule: When Switch is true
Change attribute Switch to false
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
sorry for the late reply. It worked good.
But one question regarding this: With one sound, everything is clear. If I use now 4 different sounds, must I then make 4 times each of the attributes and name them different or is there an easier way?
Hi Marco, yes....and no... ;-) Joking apart, it depends on what you're after; you could make just one more integer attribute (let's call it SoundRand) and have 1 out of the 4 sounds randomly picked to play every random time...
Rule: When Switch is false
Change attribute RandT to random(3,10)
Change attribute SoundRand to random(1,4)
When SoundRand =1
Play Sound 1 ---- run to completion unchecked
When SoundRand =2
Play Sound 2 ---- run to completion unchecked
When SoundRand =3
Play Sound 3 ---- run to completion unchecked
When SoundRand =4
Play Sound 4 ---- run to completion unchecked
Timer: After RandT seconds ---- run to completion checked
Change attribute Loop to true
----
Rule: When Switch is true
Change attribute Switch to false
-----------
Or, have the sounds play in order (but still with random amounts of time):
Rule: When Switch is false
Change attribute RandT to random(3,10)
Rule: When SoundRand = 4
Change attribute SoundRand to 0
Change attribute SoundRand to SoundRand+1
When SoundRand =1
Play Sound 1 ---- run to completion unchecked
When SoundRand =2
Play Sound 2 ---- run to completion unchecked
When SoundRand =3
Play Sound 3 ---- run to completion unchecked
When SoundRand =4
Play Sound 4 ---- run to completion unchecked
Timer: After RandT seconds ---- run to completion checked
Change attribute Loop to true
-----
Rule: When Switch is true
Change attribute Switch to false
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
I choose the first try and it worked perfect.
But the last "change attribute", is it right to change attribute "Loop" to true? I think it must be "Switch", or am I wrong? Also I didn't find any attribute called Loop. And with "Switch" it worked good I think
Whoops! Well spotted, Marco; yes, "Loop" is called "Switch" in my example... sorry 'bout the slip up but you caught it! :-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
I thank you!