Playing a sound near the player

Post » Tue Jun 28, 2011 1:05 pm

I'm trying to make a sound play near the player, with different intensity depending on parameters. My idea was to use an activator with a looping sound. The sound has a max static attenuation distance of 4500, so when placing the activator at that distance from the player through a script the intensity would be minimum; and a minimum ídem of 300. So for stepping the intensity in 100 degrees, the distance to the player is stepped in increments of (4500 - 300)/100 = 42 units
So I place the persistant activator in a dummy cell, and I move it hovering over the player's head like:
float hoveringshort intensity...;calculating intensity...set hovering to (Player.GetPos z) + 4500 - 42*intensityIf activ.GetPos x != Player.getPos x || activ.GetPos y != Player.getPos y || activ.GetPos z != hovering || activ.GetInSameCell Player == 0activ.MoveTo Player 0 0 hoverEndIf

I use the magiceffects/null.nif for its model so that it remains invisible, and I track its location with the console. But after moving to a place the sound becomes stuck there, and the activator doesn't seem to keep moving at all.
I have read about 'marker rats' but I don't know if they would suit this task, as the sound emitter needs to remain airborne at a certain distance so that I get the effect I want, and an actor would glow when using detect life.
So is there some way to pull this off, with activators, marker rats or whatever?
User avatar
Chrissie Pillinger
 
Posts: 3464
Joined: Fri Jun 16, 2006 3:26 am

Return to IV - Oblivion