Home   Help Search Login Register  

Author Topic: music only while in trigger?  (Read 1001 times)

0 Members and 1 Guest are viewing this topic.

mikieman

  • Guest
music only while in trigger?
« on: 12 Sep 2002, 19:36:29 »
how do i make it so musicplays in a loop and only plays whilst im inside the perimiter of a trigger?

btw. i already have the music in ofp


                         mikieman

seanver

  • Guest
Re:music only while in trigger?
« Reply #1 on: 12 Sep 2002, 23:05:25 »
Create the trigger and group it with the player. NOw select it as "Repeatedly".  Activation vehicle -you must have the trigger grouped with the player-, Present.

Create a init.sqs file:

musicon=false
[x,x] exec "loop.sqs". Where X put (twice) the lenght in seconds of the song.

On Activation: playmusic "musictrack"; 0 fademusic 0.5; musicon=true
On Deactivation: 0 fademusic 0; musicon=false

About the loop... I can't figure out anything. Hope anybody cleverer than me will come up with something.

Well perhaps something with a script, let's call it: loop.sqs


_time = this select 0
_timeb = this select 1
_time2 = this select 2

#loop

? (musicon) AND (_time2 == 0) : goto "again"
? !(musicon) : goto "wait"
~1
_time2 = _time - 1

goto "loop"

#again

playmusic "musictrack"

_time = _timeb

goto "loop"

#wait

_time = _timeb
? (musicon) : goto "loop"


goto "wait"


I think that might work. I hope it.  I'm not very good at scripting though
« Last Edit: 12 Sep 2002, 23:09:17 by SeAnVeR »