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 / Stop sound when you hit a switch

Author
Message
Butt monkey
17
Years of Service
User Offline
Joined: 7th Dec 2006
Location: Scotland
Posted: 23rd Aug 2009 14:13 Edited at: 23rd Aug 2009 14:15
Hi there.

I have a scenario in which a sound starts to loop when the player enters a soundzone using this script:



I want this sound to stop looping when the player presses a particular switch. The problem is that I also want the switch to play a sound in the "sound1" property when it is pressed. I tried to edit the switch script by adding a "stopsound" command before "sound1" is played but it didn't work. My scripting knowledge is still pretty poor. Can anyone help me out?

Here is the script I was talking about, I'm guessing it doesn't work simply because the "stopsound" command refers only to sound being played by the entity the script is assigned to.

Butt monkey
17
Years of Service
User Offline
Joined: 7th Dec 2006
Location: Scotland
Posted: 24th Aug 2009 15:05
Anyone help me?
Butt monkey
17
Years of Service
User Offline
Joined: 7th Dec 2006
Location: Scotland
Posted: 26th Aug 2009 22:10
C'mon guys - I still need help with this.
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 27th Aug 2009 05:34
Quote: "I'm guessing it doesn't work simply because the "stopsound" command refers only to sound being played by the entity the script is assigned to."

Then use the trigger to detect the scancodekeypressed for the stopsound.
You could have the switch increment/decrement a global variable to flag the switch as on or off.
Then the trigger can determine that variable's value and the keypress as conditions for the stopsound.
There may be an easier way than using the boolean variable for a flag since I have never tried a switch and keypress for a stopsound, but the variable should work.

Also, I never use the $0 thingy.
I always call the path as in loopsound=audiobank/user/yoursound.ogg

Butt monkey
17
Years of Service
User Offline
Joined: 7th Dec 2006
Location: Scotland
Posted: 27th Aug 2009 21:30
Thanks for the reply. I will see what I can do even though I don't fully understand the explanation.

I will look into scancodekeypressed and the likes. I've heard of them but have never used and don't know how to use them.

Thanks.
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 31st Aug 2009 23:54 Edited at: 31st Aug 2009 23:57
My bad, I thought you were using a key other than Enter. (forgot it was a switch and was thinking of a key press (brainfart))

I can see now that your script is using the plrusingaction=x condition, so that is what I meant to say.

Login to post a reply

Server time is: 2024-11-25 06:56:35
Your offset time is: 2024-11-25 06:56:35