|
|
in game music help.....
#130110
05/15/07 23:37
05/15/07 23:37
|
Joined: Jan 2006
Posts: 2,157 Connecticut, USA
Blink
OP

Expert
|
OP

Expert
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
|
i want to play a music loop on each level. i have the wav files, but the script i am using keeps giving me an "empty pointer" error. what am i missing? Code:
entity* plBiped01_entity; sound music = <cellbreak.wav>; // replace this with you sound
action play_music { ent_playloop(my,music,50); // plays the music only once while(1) // plays the loop forever { my.passable = on; // Otherwise the player would get stuck. my.invisible = on; my.y = camera.y; my.x = camera.x; // the entity gets the players position. my.z = camera.z; my.pan = plBiped_entity.pan; // This few lines are needed for mono sound, my.tilt = plBiped_entity.tilt; // (don't ask why it has to be this way, my.roll = plBiped_entity.roll; // it just has to) 'cause stereo was no good. wait(1); // waits one frame } }
My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
|
|
|
Re: in game music help.....
[Re: tompo]
#130113
05/15/07 23:53
05/15/07 23:53
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
Also, are you sure your problem isn't with the plBiped01_entity pointer?
Music code looks fine, but the defined pointer's probably null...
xXxGuitar511 - Programmer
|
|
|
Re: in game music help.....
[Re: xXxGuitar511]
#130114
05/16/07 01:40
05/16/07 01:40
|
Joined: Mar 2007
Posts: 677 0x00000USA
MrCode
User
|
User
Joined: Mar 2007
Posts: 677
0x00000USA
|
Why not just use snd_loop? ent_playloop will make it so that the music has a limited range. For instance, if your player activated something (if it's an adventure game), and you wanted to move the camera to the place where the "thing" is, then if it's any real distance from the player, your music will either be quieter, or it will be totally silent.
EDIT: "music" is old syntax, btw. Has been replaced w/ media_play/loop.
Last edited by MrCode; 05/16/07 01:42.
void main()
{
cout << "I am MrCode,";
cout << "hear me roar!";
system("PAUSE");
}
|
|
|
Re: in game music help.....
[Re: MrCode]
#130115
05/16/07 04:47
05/16/07 04:47
|
Joined: Jan 2006
Posts: 2,157 Connecticut, USA
Blink
OP

Expert
|
OP

Expert
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
|
i am beginning to get frustrated, i just want to play a loop while the level is bieng played, i dont know what to do!!! its late, i better go to bed. thanks for looking and replying.
My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
|
|
|
Re: in game music help.....
[Re: Blink]
#130116
05/16/07 09:40
05/16/07 09:40
|
Joined: Mar 2007
Posts: 776 Poor village - Poland ;)
tompo
User
|
User
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
|
use simple snd_loop function
sound My_Sound = <cellbreak.wav>;
starter play_wav { snd_loop(My_Sound,100,0); }
Last edited by tompo; 05/16/07 09:41.
Never say never.
|
|
|
Re: in game music help.....
[Re: tompo]
#130117
05/16/07 13:30
05/16/07 13:30
|
Joined: Jan 2006
Posts: 2,157 Connecticut, USA
Blink
OP

Expert
|
OP

Expert
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
|
thanks tompo, i will try this when i get home from work today.
My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
|
|
|
Re: in game music help.....
[Re: Blink]
#130118
05/16/07 16:13
05/16/07 16:13
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
For BG music I recommend using media_loop() Code:
string sndBG = <BGMUSIC.wav>;
Function BG_startup() { media_loop(sndBG, 100, 0); }
xXxGuitar511 - Programmer
|
|
|
Re: in game music help.....
[Re: xXxGuitar511]
#130119
05/16/07 17:35
05/16/07 17:35
|
Joined: Mar 2006
Posts: 2,758 Antwerp,Belgium
frazzle
Expert
|
Expert
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
|
Use this code, this should work: Code:
sound test = <yoursoundhere.wav>;
var tempvolume;
var_nsave music_handle;
function sound_on() { tempvolume = 100; if(snd_playing(music_handle)==0) { music_handle = snd_loop(test,tempvolume,0); wait(1); } }
Just call sound_on(); in your main function and the music file should begin to play when your level is loaded  Cheers Frazzle
Antec® Case Intel® X58 Chipset Intel® i7 975 Quad Core 8 GB RAM DDR3 SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB NVIDIA® GeForce GTX 295 Memory 1795GB
|
|
|
|