KnightRangersGuild Posted May 20, 2016 Share Posted May 20, 2016 (edited) I need my sound file "AMB" to fire at totally random times and only if player is in proximity and fade out. I'm pretty sure I can figure the proximity and fading on my own but I'm having trouble finding the right "Condition" to make it sound random.I've tried this formula...(GetCurrentTime)------(NONE)-----(<=)-----(1.00)------(or)(GetCurrentTime)------(NONE)-----(>=)-----(1.60)------(or)(GetCurrentTime)------(NONE)-----(<=)-----(2.00)------(or) And soforth all the way to 24 hours. I was thinking this would make the sound fire every half hour but i never could get it to work and it's not what i want anyway. Anybody know about sound conditions that could help me? Edited May 20, 2016 by KnightRangersGuild Link to comment Share on other sites More sharing options...
lofgren Posted May 20, 2016 Share Posted May 20, 2016 Why not just getrandompercent < 50 (for a 50% chance)? That would produce a random result. Link to comment Share on other sites More sharing options...
KnightRangersGuild Posted May 21, 2016 Author Share Posted May 21, 2016 Oh yea, I forgot about that, I remember I used that condition for a couple swords. Sweet thanks bra. I don't see why that wouldn't work, i'm going to try it now. Link to comment Share on other sites More sharing options...
KnightRangersGuild Posted May 21, 2016 Author Share Posted May 21, 2016 Actually this GetRandomPersent formula is only calling for a 50% chance of it firing at all, not firing at random times like i need. But im definitely on the right track. Any body else? Link to comment Share on other sites More sharing options...
FrankFamily Posted May 21, 2016 Share Posted May 21, 2016 (edited) This includes proximity and randomness, not tested though. scriptname RandomSoundControl extends ObjectReference {Script on a volume trigger, within the trigger the sound will play randomly based on the properties} Sound Property MySound Auto Actor Property PlayerRef Auto Int InTrigger = 0 Event OnUpdate() If InTrigger ;player within trigger int instanceID = MySound.Play(self) ; if you want to adjust volume, stop it, whatever, use instanceID RegisterForSingleUpdateGameTime(Utility.RandomFloat(0.5, 1.0)) ;from half to one hour Endif EndEvent Event OnTriggerEnter(ObjectReference akTriggerRef) if (InTrigger == 0) && (akTriggerRef == PlayerREF) InTrigger = 1 RegisterForSingleUpdateGameTime(Utility.RandomFloat(0.0, 0.2)) ; so the first time you enter it doenst take as much endif EndEvent Event OnTriggerLeave(ObjectReference akTriggerRef) if (InTrigger == 1) && (akTriggerRef == PlayerREF) InTrigger = 0 endif EndEventIt just calls play, expecting the sound to end by itself, if it's looping then you may need to call the following between Play and RegisterForEtc: Utility.Wait(Seconds you want it to play for, maybe also random) instanceID.StopInstance() Edited May 21, 2016 by FrankFamily Link to comment Share on other sites More sharing options...
KnightRangersGuild Posted May 23, 2016 Author Share Posted May 23, 2016 I'm no scripting expert but this does look like it will work, although I'd hate to use a script when I know it can be done through conditions. I'm getting a little to frustrated so I'm going to try this. Thank you very much Link to comment Share on other sites More sharing options...
Recommended Posts