Event OnInit()RegisterForUpdate(5)EndEventEvent OnUpdate()if self.isdisabled() == 0 if utility.randomint() < 20 NewProperty.movetonode(self, myLocationOffset) CliffracerSound.play(NewProperty) endifendifEndEvent
Theoretically the script should play a sound effect with a random chance of 20% every 5 seconds (so statistically it should play about every 25 seconds once). But in game the sound effects plays far more often than that. It often plays multiple times in succession without any delay at all. And if the object gets disabled the sound effect keeps playing for a few seconds. I tried to add a RegisterForUpdate line to the last block (in case you need to call it for each update), but that didn't help.
Either I'm doing something wrong or this function is bugged. Ideas?
