Cordedstraw Posted May 20, 2012 Share Posted May 20, 2012 I am trying to make a sound trigger script. I was trying to make it as when you enter a room a audio plays and then activates another audio trigger in another room but if enter the room that had the other audio it wont play until you trigger the first one. If anyone know how to make a script like that if you can please can send or post the script. Thank you :biggrin: Link to comment Share on other sites More sharing options...
Deleted2547005User Posted May 21, 2012 Share Posted May 21, 2012 Try this, this is pretty basic so PM if you any questions. This script can be attached to one activator, then you can link the activators in the order you want them to fire off in. Make sure to make them persistent references or the scripts will fail. Also, give a name to the first (master) activator reference for this to work. int iStepshort bDoOnceref rLinkedREF (SecondTriggerREF)ref rSelf (FirstTriggerREF) Begin OnTriggerEnter Player if iStep 0if bDoOnce 0set.rSelf to GetSelfset.rLinkedREF to GetLinkedREFset bDoOnce to 1else if bDoOnce 1if rSelf FirstTriggerREFPlaySound WPNSniperRifle2D (This is how it'll look, just replace it with the sound you desire)rLinkedREF.Activateset iStep to 1else;Do Nothingendifendifelseif iStep 1 (This is only valid after the first activator has been tripped by the player and the first trigger sets off the next.)PlaySound WPNSniperRifle2DendifEnd Like I said that is basic and may not work right off the bat, so PM if you need any further help. Link to comment Share on other sites More sharing options...
Cordedstraw Posted May 21, 2012 Author Share Posted May 21, 2012 Try this, this is pretty basic so PM if you any questions. This script can be attached to one activator, then you can link the activators in the order you want them to fire off in. Make sure to make them persistent references or the scripts will fail. Also, give a name to the first (master) activator reference for this to work. int iStepshort bDoOnceref rLinkedREF (SecondTriggerREF)ref rSelf (FirstTriggerREF) Begin OnTriggerEnter Player if iStep 0if bDoOnce 0set.rSelf to GetSelfset.rLinkedREF to GetLinkedREFset bDoOnce to 1else if bDoOnce 1if rSelf FirstTriggerREFPlaySound WPNSniperRifle2D (This is how it'll look, just replace it with the sound you desire)rLinkedREF.Activateset iStep to 1else;Do Nothingendifendifelseif iStep 1 (This is only valid after the first activator has been tripped by the player and the first trigger sets off the next.)PlaySound WPNSniperRifle2DendifEnd Like I said that is basic and may not work right off the bat, so PM if you need any further help.Thank you my kind Sir. Link to comment Share on other sites More sharing options...
Recommended Posts