Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Oz on Thu 25/11/2004 23:31:59

Title: Play sound on a specific view/frame (SOLVED)
Post by: Oz on Thu 25/11/2004 23:31:59
I need to play back a sound on a specific view/frame. I know I can assign a sound to a certain frame in the view editor, but I want a different sound in each room, so I want to be able to set this through the script. Here is what I tried:

if ((character[JOSH].view == 40) && (character[JOSH].frame == 6)) {
Ã,  PlaySound(4);
}

I put this in 'repeatdly execute', but no sound!
Title: Re: Play sound on a specific view/frame
Post by: Ashen on Thu 25/11/2004 23:54:11
How about running SetFrameSound (view, loop, frame, sound) in 'Player enters screen'?
Title: Re: Play sound on a specific view/frame
Post by: Oz on Fri 26/11/2004 00:10:37
Doh!

Thank you Ashen... :)
Title: Re: Play sound on a specific view/frame
Post by: strazer on Fri 26/11/2004 00:26:05
Or put it in the on_event function:


// main global script

function on_event (int event, int data) {
  if (event == ENTER_ROOM) {
    int newsound=0; // 0 = disable sound if no sound set for new room
    if (data == 2) newsound = 7;
    else if (data = 5) newsound = 9;
    else if (data = 11) newsound = 2;
    //...
    SetFrameSound(40, 0, 6, newsound);
  }
}