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 / How do you loop a sound properly?

Author
Message
Butt monkey
17
Years of Service
User Offline
Joined: 7th Dec 2006
Location: Scotland
Posted: 16th Feb 2009 23:59
Hi there.

I've recently created my own HUD system based off Avid's Halo HUD script. I've made several images which appear and disappear depending on how much damage the player has taken.

I want to go a step further and loop a sound when a players health drops below 25. The sound is an echoey heartbeat with ear buzzing and heavy breathing. I have managed to get the sound to play but it loops several times a second. How can I get this script to loop the sound only when it finishes?



Also, why are sounds so quiet when played in FPSC? Is it to do with the file type?
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 17th Feb 2009 00:43 Edited at: 17th Feb 2009 00:46
Quote: "How can I get this script to loop the sound only when it finishes?"

Move to another state.
You are calling the loopsound over and over unless you get out of state 1
That is why its doing that because it starts is again before it finishes
You need more states anyway if you want to display those huds

That can't be the whole script because it lacks a desc and the creation of the huds

Butt monkey
17
Years of Service
User Offline
Joined: 7th Dec 2006
Location: Scotland
Posted: 17th Feb 2009 13:00 Edited at: 17th Feb 2009 13:01
Entire script:

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 18th Feb 2009 00:55 Edited at: 18th Feb 2009 00:56
[double post glitch]

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 18th Feb 2009 00:55 Edited at: 18th Feb 2009 00:57
That is the setuplevel.fpi isn't it?
Why are you editing that script for this effect?

You could do this in a separate script that is run by any dynamic entity in the map.
You could even use a blood splat if the always active is set to YES.
I would not put this in the setup level script if I were you, but to each his own.

Butt monkey
17
Years of Service
User Offline
Joined: 7th Dec 2006
Location: Scotland
Posted: 18th Feb 2009 12:10
Well CE, I am not much of a scripter. I have a very basic knowledge of how things work. I will mabye try adding the script to a dynamic entity.
Butt monkey
17
Years of Service
User Offline
Joined: 7th Dec 2006
Location: Scotland
Posted: 18th Feb 2009 20:50
I'm still not really too sure how to loop the sound properly. Could you please write the line(s) of code I'd require?
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 18th Feb 2009 21:23 Edited at: 18th Feb 2009 21:24
Ok, I have not tested this, so let me know how this
 works.

Again, place an invulnerable and immobile object like a Blood_Splat in your map.
Then, set the Static Mode to NO, and set the Always Active to YES.
Then, give it this script for its AI Main.

Login to post a reply

Server time is: 2024-11-24 20:04:44
Your offset time is: 2024-11-24 20:04:44