Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Sound loops in my script...help?

Author
Message
Killj0y17
12
Years of Service
User Offline
Joined: 15th Sep 2012
Location: In a pineapple, under the sea
Posted: 22nd Oct 2012 16:40
I recently got into scripting and still learning it. My first script that I created is "when the player is near to the entity, it plays a sound" Although there is one problem, the sound loops, and I have no idea why, that's why I'm asking for your help on how to fix it
here's my script:

thanks in advance.

maho76
13
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 22nd Oct 2012 17:33 Edited at: 22nd Oct 2012 17:34
well, look at your script, it says START sound when player is in range, so that you dont change states the sound starts playing over and over again. by the way there are commata missing, space-character etc.



this means "when player near 90, start sound=$1 last for 3 seconds, then check condition again". look how long your sound plays and edit the etimergreater-number to fit. if you want to play the sound only once, exchange last line "state=0" with "state=3".

should work. there is an alternative using "loopsound=x" and "stopsound" wich does basically the same as above and would run smoother because engine has not to check etimer, but the above should be ok.



BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 22nd Oct 2012 17:49
Maho76's scripts will work. Or another is this:



One thing to note. If the sound is attached to the entity, the entity must be dynamic.


There's no problem that can't be solved without applying a little scripting.
maho76
13
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 22nd Oct 2012 17:59
@blackfox: i thought "stopsound" only works with loopsound-command (i know syntax list says it stops all sounds)? have to check in editor, would be cool if this works with sound/plrsound, too.

BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 22nd Oct 2012 18:13
Quote: "@blackfox: i thought "stopsound" only works with loopsound-command (i know syntax list says it stops all sounds)? have to check in editor, would be cool if this works with sound/plrsound, too."


I never post a script that does not work. With that said, "stopsound" works for me if I use "sound", "loopsound", or "plrsound".




There's no problem that can't be solved without applying a little scripting.
Killj0y17
12
Years of Service
User Offline
Joined: 15th Sep 2012
Location: In a pineapple, under the sea
Posted: 23rd Oct 2012 01:26
thanks for the help guys

Login to post a reply

Server time is: 2024-11-23 20:00:01
Your offset time is: 2024-11-23 20:00:01