Jump to content

Photo

Play sound combo?


  • Please log in to reply
2 replies to this topic

#1 XMSB

XMSB

    Furry Friends Furever

  • Members
  • Real Name:Joseph Watson
  • Location:San Antonio, Texas

Posted 31 October 2010 - 09:03 AM

Would it be possible to script a combo that plays a sound effect the instant it appears? And is there any way to use sound effects other than the default sounds? You know, custom sound effects that you would load to slot 60 or higher...
Note that this is a request for a custom combo type, not a ffc script.

Edited by XMuppetSB, 31 October 2010 - 12:56 PM.


#2 Saffith

Saffith

    IPv7 user

  • Members

Posted 07 November 2010 - 11:39 AM

Fine, fine.
I assume an FFC script that simply plays a sound won't do because there'll be combo cycling or some such?

CODE
import "std.zh"

const int SOUND_COMBO = 142;
const int SOUND_COMBO_SFX = 60;

bool soundCombos[176];
int scPrevScreen = -1;
int scPrevDMap = -1;

void doSoundCombo()
{
    if(Link->Action == LA_SCROLLING)
        return;
    
    bool playSound = false;
    
    if(Game->GetCurDMap() != scPrevDMap || Game->GetCurDMapScreen() != scPrevScreen)
    {
        for(int i=0; i<176; i++)
            soundCombos[i] = false;
    }
    
    scPrevDMap = Game->GetCurDMap();
    scPrevScreen = Game->GetCurDMapScreen();
    
    for(int i=0; i<176; i++)
    {
        if(Screen->ComboT[i] == SOUND_COMBO && !soundCombos[i])
            playSound = true;
        soundCombos[i] = Screen->ComboT[i] == SOUND_COMBO;
    }
    
    if(playSound)
        Game->PlaySound(SOUND_COMBO_SFX);
}

global script soundCombo
{
    void run()
    {
        while(true)
        {
            doSoundCombo();
            Waitframe();
        }
    }
}


That uses LA_SCROLLING, so it might not work quite right in builds before 1306.

#3 XMSB

XMSB

    Furry Friends Furever

  • Members
  • Real Name:Joseph Watson
  • Location:San Antonio, Texas

Posted 07 November 2010 - 12:50 PM

Thanks a lot, Saffith. This is just what I needed for the disappearing blocks in my current WIP: LOZ-Generation5-3.qst. I changed the 60 to 81, since I uploaded the Yoku Block sound to SFX Slot 81. Anyway, with this script working properly, perhaps we could submit this to the script database.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users