Play sound on a specific view/frame (SOLVED)

Started by Oz, Thu 25/11/2004 23:31:59

Previous topic - Next topic

Oz

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!
Diversity is divine!

Ashen

How about running SetFrameSound (view, loop, frame, sound) in 'Player enters screen'?
I know what you're thinking ... Don't think that.

Oz

Diversity is divine!

strazer

Or put it in the on_event function:

Code: ags

// 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);
  }
}

SMF spam blocked by CleanTalk