Jump to content

Photo

Multi-Ambient and Secret-Ambient


  • Please log in to reply
2 replies to this topic

#1 TheLegend_njf

TheLegend_njf

    Deified

  • Members
  • Real Name:Grant

Posted 10 April 2017 - 08:35 PM

I make ambient heavy quests, so this will be very useful for me. 

 

I want a script where multiple sfx can play continuously using d0-d7 arguments.

 

I'd also like a 2nd version of this script to only work after secrets have been solved in the room to add one or two ambient SFXs to play at once. 



#2 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 11 April 2017 - 06:34 AM

This is possible in 2.50.x, however, it will require manually setting the times of each sound, in frames, manually.


ffc script soundamb {
    void run (int sfx1, int sfx2, int time1, int time2){
        time1 = 0; time2 = 0;
        while (!Screen->State[ST_SECRET]) Waitframe();
        while (true){
            if ( sfx1 ) {
                if ( !time1 ) {
                    time1 = this->InitD[2]+1;
                    Game->PlaySound(sfx1);
                }
                if ( time1 > 0 ) time1--;
            }
            if ( sfx2 ) {
                if ( !time2 ){
                    time2 = this->InitD[3]+1;
                    Game->PlaySound(sfx2); 
                }
                if ( time2 > 0 ) time2--;
            }
            Waitframe();
        }
    }
}  
Try that.

Remove the first while loop to bypass needing screen secrets. If you need more sounds, copy and paste the codeblocks, changing the args as needed.

Edited by ZoriaRPG, 11 April 2017 - 06:45 AM.

  • ShadowTiger likes this

#3 TheLegend_njf

TheLegend_njf

    Deified

  • Members
  • Real Name:Grant

Posted 27 April 2017 - 07:56 PM

Sorry for the late reply. Thanks, this worked. 




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users