Home   Help Search Login Register  

Author Topic: stop a sound  (Read 1161 times)

0 Members and 1 Guest are viewing this topic.

Offline thedog

  • Members
  • *
stop a sound
« on: 21 Feb 2009, 17:35:59 »
hey guys,

im not new but not that good at scripting and i ran into a problem. before i tell you whats wrong ill tell you what i want to achieve.

the mission is to go a radio station that plays propaganda music, you need to change the "cd" for the objective to be complete.

the propaganda music is a 16 second long audio file that i put on repeat if you wanna call it that.
so what i did is placed a trigger, when the player gets in a certain distance to the station he hears the propaganda music. so the trigger executes music1.sqs which looks like this =

Quote
#hook1
PlayMusic "prop"
~15.5
goto "hook1"

ok so now the player moves to the stereo and executes music2.sqs which pretty much just plays another sound file. now this sound file keeps getting cut out because the first one is still on that "loop". ive tried for hours to figure something out, went up and down forums, the wiki site and the editors guide, couldnt figure it out. im probably looking for the wrong thing :( also its probably stupid for me to have it in 2 seperate SQS files right? problem is, like i said im not new but im not that good at this. how do i either terminate the first one when the other one goes true? tried several things already :(

also another question, is there an IRC channel for editors??? ive heard of one


greets dog


Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: stop a sound
« Reply #1 on: 21 Feb 2009, 18:29:41 »
You could try to use the command say instead.

Have the stereo object (or use Game Logic instead) say the music, maybe that doesn't get cut off. :dunno:
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Walter_E_Kurtz

  • Guest
Re: stop a sound
« Reply #2 on: 22 Feb 2009, 01:35:15 »
Using the say command means that the sound emanates from an object instead of just being in the player's ears (or head, for that matter).

Place an object or Game Logic in the radio station booth and name it speaker.

Then your music1.sqs would look like:
Code: [Select]
#hook1
speaker say "prop"
~15.5
goto "hook1"


but you want to change what the speaker says when the player changes the CD, so create an init.sqs file (or add the following line to one you already have):
Code: [Select]
CDchanged = false
now by including the following in music2.sqs, music1.sqs will quit instead of repeating
Code: [Select]
CDchanged = true
so modify music1.sqs
Code: [Select]
#hook1
if (CDchanged == true) then goto "end"
speaker say "prop"
~15.5
goto "hook1"

#end
exit

thus music2.sqs should look like
Code: [Select]
CDchanged = true

#hook2
speaker say "RadioFreeAmerica"   <- whatever your alternative sound name is
~15.5
goto "hook2"