Script almost fine

Post » Tue May 17, 2011 1:48 pm

I managed to modify a script found on TESCS Wiki to work exactly as I want it to. Except as soon as I put two or more instances of the same activator in the same cell, the sound doesn't play, but the movement back and forth still goes on. The thing is, the sound I want to play is selected in a folder, meaning it's random. Does that mean that each instances select the same file in the folder and therefore cannot play the same file?

Here's the script, attached to an activator;
Spoiler

scn mdaRandomHauntSoundY

ref xObject
short xStdSpeed
short xSpeed
short xMaxDisplacement
float xPosY
float xPosMin
float xPosMax
float Timer

begin GameMode
if xObject == 0
set xObject to GetSelf
set xStdSpeed to -400
set xMaxDisplacement to 2000
set xPosY to xObject.getstartingpos y
if xStdSpeed > 0
set xPosMin to xPosY
set xPosMax to xPosY + xMaxDisplacement
else
set xPosMax to xPosY
set xPosMin to xPosY - xMaxDisplacement
set xStdSpeed to -xStdSpeed
endif
endif

If Timer < 15
Set Timer to ( Timer + GetSecondsPassed )
Elseif xPosY <= xPosMin
set xSpeed to xStdSpeed
Playsound3D mdaHaunt01 ; this is a selected folder, not a specific file, therefore playing a random file.
Set Timer to 0
else
set xSpeed to -xStdSpeed
Playsound3D mdaHaunt01 ; same as above!
Set Timer to 0
endif

if xSpeed == 0
return
endif

set xPosY to xObject.getpos Y + xSpeed * getsecondspassed

if xPosY > xPosMax
set xPosY to xPosMax
set xSpeed to 0
endif
if xPosY < xPosMin
set xPosY to xPosMin
set xSpeed to 0
endif

xObject.setpos Y xPosY
xObject.reset3Dstate
End


What I want is many different random sounds moving back and forth in the same cell.

Furthermore:
I used the markerx.nif for my activator thinking it would be invisible in game... but it's not! I can see many Xs sliding back and forth in my cell. Which was nice for testing, but I got the picture now. Why is it not invisible anymore?!? (used to be a static that I promoted to activator) :brokencomputer:

Edit: Well, apparently, spaces or tabs don't show up in spoiler tags, sorry about that.
User avatar
Adriana Lenzo
 
Posts: 3446
Joined: Tue Apr 03, 2007 1:32 am

Post » Tue May 17, 2011 3:46 pm

The XMarker is not rendered because of its form ID. When you made a new xmarker, it is 'not' made invisible by the game engine. This is true with all invisible markers in the game.

As for the sound, I could not say. You may be accurate. You could script them to have a random wait between each other to hopefully get some different sounds. I am not sure if the game engine sees the whole folder as the same sound and thus will not play it 'again'.
User avatar
LuBiE LoU
 
Posts: 3391
Joined: Sun Jun 18, 2006 4:43 pm

Post » Tue May 17, 2011 10:17 am

The XMarker is not rendered because of its form ID.

You could script them to have a random wait between each other to hopefully get some different sounds.

Thanks for the XMarker precision.

I tried to put a delay in between each instances, it does work, but it has a catastrophic result. They each tend to play a sound file but mostly end up interupting it... I'll try another approach then. make two or three variant with there own set of sound files... I wanted to avoid that, but hey, a girl's got to do what a girl's got to do.
User avatar
Misty lt
 
Posts: 3400
Joined: Mon Dec 25, 2006 10:06 am


Return to IV - Oblivion