_____________________________________________________________________________
For the better part of the last 24 hours, I've been pounding away trying to make this simple little script work consistently.
The concept is simple, equip a particular torch, and music plays. Unequip it and it stops. What could be so hard about that, eh?
But,when the torch is first equipped it usually (not always) begins to stutter as if the sound is being started and restarted every frame. the music will play fine after equipping the torch when the game is paused, as in when the inventory is open.
Sometimes going into a hand to hand combat stance or equipping a shield will stop the stutter, and the music will play.
However, under no circumstances whatsoever will the music cease to play or stutter, one the two.
When the torch is unequipped, and placed wither in inventory or dropped into the world, all local variables show a value of 0, as does the global that shows the torch equipped. The global that shows the torch unequipped has a value of 1, but the music plays on...
I have no idea what is going on. Is there some command besides StopSound that stops sound from playing?
This script is just a small part of a larger script that does other things, and the script when complete works fine, except the sound part posted here. The men from the funny farm are going to be coming for me if I have to listen to that music much longer...
Here's the script:
Begin 1NDTestScriptshort doOnceshort OnPCEquipshort NDTorch;' Globals 1NDEquipped, 1NDNotEquippedIf ( menuMode == 1 ) ReturnendIfIf ( OnPCEquip == 1 ) ;' Check that flute is equipped, set one instance to play. set 1NDEquipped to 1 ;' Set globals to show values for debugging set 1NDNotEquipped to 0 If ( doOnce == 0 ) set NDTorch to 1 endIfElse set doOnce to 0 set NDTorch to 0 ;' show torch unequipped set 1NDEquipped to 0 ;' Set globals to show values for debugging set 1NDNotEquipped to 1 StopSound "RatDance" ;' Stop the music... Oh, Please...endIfIf ( NDTorch == 1 ) ;' Check that flute is equipped, play music if so. PlayLoopSound3D "RatDance" play the music set doOnce to 1endIfEnd 1NDTestScript
I found the solution to making it stop in another thread. I wouldn't have thought the player fix would work since the script is attached to a torch. I'll add my thanks to the other person's whose thread it is. ...and...Thanks for being here...
That still leaves me with the stutter, and no clue about getting rid of that. Any thoughts?
Okay, I forgot to check with "GetSoundPlaying" and that fixed it, so no more problems...