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 / Audio Script wont play?

Author
Message
Jayskull900
13
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 30th May 2012 10:28
I'm novice at scripting to say the least...where's my error?

;Console Talk
desc = Radio talk over console

;triggers
:state=0,plrdistwithin=550:state=1
:state=1,plrcanbeseen:state=2
:state=2:timerstart,sound=audiobank/341/A09.wav
:state=2,timergreater=300:state=3
:state=3:timerstart,sound=audiobank/341/A12.wav
:state=3,timergreater=300:state=4
:state=4:timerstart,sound=audiobank/341/A35.wav
:timergreater=300:state=5
:state=5:timerstart,sound=audiobank/341/A15.wav
:state=5,timergreater=500:state=0
;end of script
maho76
13
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 30th May 2012 11:13
1) check waves for format, fpsc doesnt like all frequency ranges (22khz and 48khz working).

2) sound only plays when you change state in the next line.

Jayskull900
13
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 30th May 2012 11:16 Edited at: 30th May 2012 11:29
What do you mean when you change state in the next line? I also changed all files to 48hz, still won't work
maho76
13
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 30th May 2012 13:21 Edited at: 30th May 2012 13:24
Quote: "What do you mean when you change state in the next line?"


better to change the state-number to get the sound work, there are also some other commands out there with that behavior.

;triggers
:state=0,plrdistwithin=550:state=1
:state=1,plrcanbeseen:state=2
:state=2:timerstart,sound=audiobank/341/A09.wav,state=3
:state=3,timergreater=300:state=4
:state=4:timerstart,sound=audiobank/341/A12.wav,state=5
:state=5,timergreater=300:state=6
:state=6:timerstart,sound=audiobank/341/A35.wav,state=7
:state=7,timergreater=300:state=8
:state=8:timerstart,sound=audiobank/341/A15.wav,state=9
:state=9,timergreater=500:state=0
;end of script

also you missed the state=x in line 8. thats why it plays a sound for 300 milliseconds, then jumps to your state=5 and plays another sound for 500 ms, then starts back at state=0.

gz

Jayskull900
13
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 30th May 2012 18:57 Edited at: 30th May 2012 19:18
I really appreciate the help, but the script still doesn't work


Edit
I changed the entity to dynamic and it works now...why does that matter?
Also, it works because it plays...but it plays every sound at the same time. I changed the timer to wait 10000, still played at the same time
Marc Steene
FPSC Master
18
Years of Service
User Offline
Joined: 27th Mar 2006
Location: Bahrain
Posted: 31st May 2012 21:16
Quote: "I changed the entity to dynamic and it works now...why does that matter?"


Only dynamic entities can run scripts, static objects are just a part of the level geometry. 300ms is a very short delay between the sounds, so you might want to increase that a bit. You'll want to switch over to etimers instead of the global timer, it's a good habit to get into if you start doing a big project. Also, plrcanbeseen only works with characters, and I'm assuming the entity you're applying this to is not a character. Try using plrdistwithin=150 instead.


Official LightStorm Engine BETA Tester
/?m=forum_view&t=190541&b=21
maho76
13
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 1st Jun 2012 15:55
when you want to play the sounds one after another, you have to use different timer-values (first 3 are the same) or restart timer with every sound playing.

Troutflies
13
Years of Service
User Offline
Joined: 24th Feb 2011
Location: Stuck outside my map.
Posted: 1st Jun 2012 16:39 Edited at: 1st Jun 2012 16:43
Think like an engine.

I have found when I troubleshoot a script and I am a novice as well. I have to think like the FPSC engine. Remember a computer is only as smart as you tell it to be. Start from the first line of of the script and follow each step to spot flaws in the scripts.

When looking at the condition portion ask yourseld were the conditions met? Ok now the actions are all actions complete? Ok move on to the next. I have often found stupid little mistakes in my scripts that way. Also I have had great success with testing the script as I go others may laugh at me. But what I do sometimes is create a hud that simply says "ok" I set the hud up as normal in :state=0, then I start my script. When I get to a point i want to test what Ihave written so far I assign the last command in the script to display the hud. So I know that the engine was able to read through the script and didn't get hung up anywhere.

Not to make your script anymore complicated but just a random thought. instead of using the plrdistwithin conditions. You could set up the whole conversation to take place only when a key is pressed. just like a regular walkie talkie you have to press the send button to brodcast. Well you could do the same in this case. I can see if I can come up with something for you to try out if you'd like.
Jayskull900
13
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 1st Jun 2012 20:38
I think I got it guys
@Trout, I think you had the best solution by far. But I fixed it a few days ago by simply making it one bigger audio file, which worked a lot better
Thanks for all the suggestions guys!
Troutflies
13
Years of Service
User Offline
Joined: 24th Feb 2011
Location: Stuck outside my map.
Posted: 2nd Jun 2012 01:46 Edited at: 2nd Jun 2012 01:48
Hey Jay,

I know you said that you got it. But your post got me thinking which of course led me to trying to work out the script. Iam not sure if you can use it or not. Place it in the main of a trigger. Pressing the "r" key will play each audio file and will worked anywhere in the level after being triggered. Do with it as you wish. either wy let me know what you think. For some reason on my system the second time I run the script sequence outside the zone it "hiccups" Not sure why. Let me know if you have the same result

Login to post a reply

Server time is: 2024-11-24 00:43:26
Your offset time is: 2024-11-24 00:43:26