Jump to content

Sound Description question, need condition formula


KnightRangersGuild

Recommended Posts

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 by KnightRangersGuild
Link to comment
Share on other sites

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
EndEvent

It 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 by FrankFamily
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...