Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Sound wont stop playing
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#4
RE: Sound wont stop playing

PHP Code: (Select All)
PlaySoundAtEntity("amb_piano""amb_mansion_gallery_piano_2D.snt""ScriptArea_6"0false); 
PHP Code: (Select All)
StopSound("amb_piano"0.5); 

That should fix it. Have a look at the two codes on the Engine Scripts Page.

PHP Code: (Select All)
void PlaySoundAtEntity(stringasSoundNamestringasSoundFilestringasEntityfloat afFadeTimebool abSaveSound); 
PHP Code: (Select All)
void StopSound(stringasSoundNamefloat afFadeTime); 

Both of the codes have a value called asSoundName, which you should think of as a name that you give the sound. The name is handled internally - so you define a name for the sound and then wish to mess around with it later, you reference the SoundName in StopSound();. In the case of the above, since you did not define a name of a sound to stop, it continues to play. I simply made the SoundName into amb_piano.

This does not just apply to sounds - other codes also use internal names when being modified in script. Some examples are SetLightVisible();, AddQuest();, CompleteQuest();, GiveItem(); and RemoveItem();.

Think of the internal name as the name of something in the Level Editor or a newly created object when created in Script (Start/StopSound). The internal name of your ScriptArea to start playing the sound is ScriptArea_5, thus, whenever you're referring to that ScriptArea, you simply type its name in the appropriate code string.

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 05-05-2016, 03:29 PM by Romulator.)
05-05-2016, 03:28 PM
Find


Messages In This Thread
Sound wont stop playing - by serbusfish - 05-05-2016, 12:24 PM
RE: Sound wont stop playing - by Mudbill - 05-05-2016, 01:36 PM
RE: Sound wont stop playing - by serbusfish - 05-05-2016, 01:46 PM
RE: Sound wont stop playing - by Romulator - 05-05-2016, 03:28 PM
RE: Sound wont stop playing - by serbusfish - 05-05-2016, 04:44 PM



Users browsing this thread: 1 Guest(s)