Home   Help Search Login Register  

Author Topic: car radio script  (Read 1546 times)

0 Members and 1 Guest are viewing this topic.

blackjack

  • Guest
car radio script
« on: 31 Dec 2004, 23:42:39 »
hello everyone. after fixing the main bugs on my addon (rf8 sled) i'm trying to add some functions to it. one of them is the car radio.
what i would like to have is a car radio like name says. when u get inside the rf8 u can have music playing. first i tryed to have a radio on/off action when in, but didnt suceed. then i tryed to add the getin and the get out eventhandlers to execute my music.sqs . then i tryed to add the radio.sqs to the engine eventhandler. all the times i get music when inside vehicle or engine on, but when i came outside and then get in , it just doesnt play anymore. even that i get in a 2nd rf8 i cant listen music. it trigered once and only... i'm to new on scriptin  to see the problem here...
i'll copy/paste the eventhandlers that i got on my pbo and then the radio.sqs file i tryed from the only car audio thread here on ofpec... but this sqs was made to play a short sample. not a music.
so plz try to write the correct eventhandler and a new music.sqs
i have mission editors that tell me that i need to be sure of the eventhandler settings otherwise i'm shooting in the dark. made over 20diferent atempts but no luck yet

the eventhandlers on the cfg: (numern.sqs generates the random side nº , propeler.sqs rotates the propeler)

Quote
class EventHandlers
 {
  init="[_this select 0,_this select 1] exec ""\rf8\nummern.sqs""";  
  engine="[_this select 0,_this select 1] exec ""\rf8\propeller.sqs"";[_this select 0,_this select 1] exec ""\rf8\music.sqs""";
  };

now the radio.sqs is like this currently
Quote
#top
@(vehicle Player != Player)
#repeat
playMusic "new";
~3
?(vehicle Player == Player):goto "stopMusic";
~3
?(vehicle Player == Player):goto "stopMusic";
~3
?(vehicle Player == Player):goto "stopMusic";
~30
?(vehicle Player == Player):goto "stopMusic";
~2.9
?(vehicle Player == Player):goto "stopMusic";
goto "repeat";

#stopMusic
_musicLevel = musicVolume;
0 fadeMusic 0;
~15
0 fadeMusic _musicLevel;
goto "top";   

Happy New Year!!

blackjack

  • Guest
Re:car radio script
« Reply #1 on: 02 Jan 2005, 13:46:20 »
i hope i'm not asking something very complicated here...  ??? comon gents, i need a help here!

Cataclyzm

  • Guest
Re:car radio script
« Reply #2 on: 08 Jan 2005, 21:17:43 »
I am not sure why you keep evaluating:

Code: [Select]
?(vehicle Player == Player):goto "stopMusic";

I am not the best at coding, but I am not sure that the pauses between the evalutions and re-evaluting the fact is the best way to accomplish this.  Would it not be better to do a

Code: [Select]
@(vehicle Player !- Player)
to continue the code to stop the music?
rather than a loop?

Cataclyzm

  • Guest
Re:car radio script
« Reply #3 on: 08 Jan 2005, 21:30:45 »
err I mean

Code: [Select]
@(vehicle Player == Player)
to continue to the fade

EX-PARA

  • Guest
Re:car radio script
« Reply #4 on: 12 Jan 2005, 12:07:31 »
Hi blackjack, On the BIS forum is a guy called Pappy Boyington who made a CD player cfg for his mod.
You could always get in contact with him to ask for his help.
Hope this helps.

EX-PARA

blackjack

  • Guest
Re:car radio script
« Reply #5 on: 13 Jan 2005, 22:45:16 »
thanks for the help para. i forgot to write here that i solved the radio problem last week. and just to let you know its nothing compared to my initial idea. i saw a hmmv on y2k3 pack that uses something very similar to what i want.  i adapted to my rf8 and now its working perfect thank god.
basicly its a radioinit.sqs , radio.sqs, radioff.sqs .
when u get in the rf8 u have a radio menu action. if u open radio menu u have pitch1;pitch2;pitch3;pitch4;pitch5 to play.
now the cool part is that i made this a way that the mission editors can choose the tracks to be playing inside vehicle.  in the mission file, just add a folder called "music", and inside it place up to 5  ogg files. name them rad1.ogg, rad2.ogg...rad5.ogg
so this way the map editor's decide what musics to be played, not the addon editor (me :) ) . in case u dont want to use any musics, just dont creat any music folder on the mission pbo and thats fine to. u still have radio option when ur in, but they play silence...and no " missing "$#&%.sqs error" .
and its dam cool behing able to listen music while driving around those winter islands

 :-*