Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Dr Fred Rubacant Edison on Mon 13/04/2009 00:43:42

Title: Adding Cd player music to kids have a problem
Post by: Dr Fred Rubacant Edison on Mon 13/04/2009 00:43:42
Im adding CD player to each kid that can be turned on and off.  if its off you hear the normal background music that works. But i want it when you switch to a new kid it turns off the kids cd music and plays the normal room music if the new kid dose not have his cd player running.


i tryed StopMusic ();  But that turns all the music in the room.

Here is the code im using now to try to stop the cd and play normal room music. The Cd music stops but the room music will not play.


// script for Room: Repeatedly execute

if(GetPlayerCharacter() == DAVE && RazorCD_ON_OFF == 2 || RazorCD_ON_OFF == 1)
{
PlayMusic (6); // room music
}


Please help


Title: Re: Adding Cd player music to kids have a problem
Post by: Dr Fred Rubacant Edison on Mon 13/04/2009 00:58:31
Got it to work

if(GetPlayerCharacter() == DAVE && RazorCD_ON_OFF == 2)
{
RazorCD_ON_OFF = 1;
PlayMusic (6);
RazorCD_Back = 2;
}


if(GetPlayerCharacter() == RAZOR && RazorCD_Back == 2)
{
RazorCD_ON_OFF = 2;
PlayMusic (29);

}
Title: Re: Adding Cd player music to kids have a problem
Post by: Trent R on Mon 13/04/2009 04:19:10
You do know GetPlayerCharacter() is an obsolete command... You can instead use

if (player==cDave)


and to post code like I have, use the [code*][/code*] tags, but remove the *asterisks.

~Trent
Title: Re: Adding Cd player music to kids have a problem
Post by: Dr Fred Rubacant Edison on Mon 13/04/2009 05:59:55
Thanks