Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
3 registered members (TedMar, AndrewAMD, fairtrader), 578 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
in game music help..... #130110
05/15/07 23:37
05/15/07 23:37
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
Blink Offline OP

Expert
Blink  Offline 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: Blink] #130111
05/15/07 23:40
05/15/07 23:40
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
I think "music" is a reserved name. Try something else...


xXxGuitar511
- Programmer
Re: in game music help..... [Re: xXxGuitar511] #130112
05/15/07 23:51
05/15/07 23:51
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
Quote:

ent_playloop(my,music,50); //plays the music only once



this is loop so it's playing all the time
about mono... convert this wav to mono in some wav editor


Never say never.
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 Offline
Expert
xXxGuitar511  Offline
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
M
MrCode Offline
User
MrCode  Offline
User
M

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.

Code:
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 Offline OP

Expert
Blink  Offline 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 Offline
User
tompo  Offline
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 Offline OP

Expert
Blink  Offline 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 Offline
Expert
xXxGuitar511  Offline
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 Offline
Expert
frazzle  Offline
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
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1