Jump to content

Photo

Last Singular Flag-> Secret SFX


  • Please log in to reply
14 replies to this topic

#1 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 06 August 2011 - 01:18 AM

I need a script so that when you trigger the last Singular flag on the screen (Whether is Trigger->Self or Trigger->Self (16 - 31) ) it plays the secret SFX. Can anyone do this? Reason why i need it is that it can get annoying hearing the secret sfx for every singular flag you trigger.

#2 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 06 August 2011 - 12:59 PM

QUOTE(Christian @ Aug 6 2011, 12:18 AM) View Post

I need a script so that when you trigger the last Singular flag on the screen (Whether is Trigger->Self or Trigger->Self (16 - 31) ) it plays the secret SFX. Can anyone do this? Reason why i need it is that it can get annoying hearing the secret sfx for every singular flag you trigger.


Doesn't sound to hard. How soon do you need it. I might be able to squeeze it in next week among other things? icon_smile.gif

#3 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 06 August 2011 - 01:34 PM

QUOTE(blackbishop89 @ Aug 6 2011, 01:59 PM) View Post

Doesn't sound to hard. How soon do you need it. I might be able to squeeze it in next week among other things? icon_smile.gif


Really soon icon_biggrin.gif It's like the last thing i need to complete my dungeon. Thanks BlackBishop89! =)

#4 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 08 August 2011 - 09:36 AM

Would it be a option to make it so no secret sound is played on select screens via screen data, and have a ffc that plays the sound only once when the last trigger self combo flag is cleared? That will require you to have a either to use a scripted screen flag in which as it'll be a global script or a ffc in which case it'll be a ffc script. Which do you prefer?

#5 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 08 August 2011 - 12:04 PM

Whichever is easier for you. And yes the secret sound add is disabled for the screen.

#6 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 08 August 2011 - 12:18 PM

One last question. Are these secrets temporary or permanent?

#7 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 08 August 2011 - 12:27 PM

They are permanent icon_biggrin.gif

#8 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 08 August 2011 - 12:48 PM

Okay, either way this script should work. Just set the constants and you should ready to go.
CODE
import "std.zh"

const int TRIGGER_SCRIPT_SLOT = 1; //Values 1 to 5.
const int TRIGGER_SCRIPT_REGISTER = 0; //Values 0 to 7.
const int TRIGGER_SCRIPT_NUM = 1; //Values 1 to 511.

bool Secrets_Triggered; //Boolean used to determine if secrets have been triggered on the current screen.
int Old_Map = 0; //Used to determine if link has changed maps.
int Old_Screen = 128; //Used to determine if link has changed screens.

global script Slot2{
    void run(){
        while(true){
            if(Link->HP == 0) Secrets_Triggered = false;
            if(Link->Action == LA_SCROLLING) Secrets_Triggered = false;
            if(Game->GetCurMap() != Old_Map && Game->GetCurScreen() != Old_Screen) Secrets_Triggered = false;
            if(Game->GetCurMap() != Old_Map && Game->GetCurScreen() == Old_Screen) Secrets_Triggered = false;
            if(Game->GetCurMap() == Old_Map && Game->GetCurScreen() != Old_Screen) Secrets_Triggered = false;
            if(Screen->D[TRIGGER_SCRIPT_REGISTER] != 0); //Do nothing.
            else if((Screen->Flags[SF_MISC] & 1<<(1+TRIGGER_SCRIPT_SLOT)) != 0 && FindFFCRunning(TRIGGER_SCRIPT_NUM) == 0){
                if(!Secrets_Triggered && CheckForTriggers()){                                
                    Secrets_Triggered = true;
                    Game->PlaySound(SFX_SECRET);
                    Old_Map = Game->GetCurMap();
                    Old_Screen = Game->GetCurScreen();      
                }
            }
            if(Screen->State[ST_SECRET]) Screen->D[TRIGGER_SCRIPT_REGISTER] = 1;
            Waitframe();
        }
    }
    bool CheckForTriggers(){
        bool check = true;
        for(int i; i < 175 && check; i++){
            if(Screen->ComboF[i] == CF_SINGLE) check = false;
            else if(Screen->ComboF[i] == CF_SINGLE16) check = false;
            else if(Screen->ComboI[i] == CF_SINGLE) check = false;
            else if(Screen->ComboI[i] == CF_SINGLE16) check = false;
        }
        return(check);
    }
}

//Only need this if you continue on screens with triggers.
global script Slot3{
    void run(){
        Secrets_Triggered = false;
    }
}

int FindFFCRunning(int scriptNum){
    ffc f;
    for(int i=1; i<=32; i++){
        f=Screen->LoadFFC(i);
        if(f->Script==scriptNum) return i;
    }
    return 0;
}

ffc script NoSecretSXF{
    void run(){
        while(true) Waitframe();
    }
}

Edited by blackbishop89, 08 August 2011 - 02:05 PM.


#9 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 08 August 2011 - 01:32 PM

Thank you so much BB89 icon_wink.gif also, if I don't want it to play the secret sfx when triggering all self trigger flags, can you make an Ffc script that disables the global script in the screen?

#10 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 08 August 2011 - 02:04 PM

Dude that ffc script is so simple it's not even funny. Will updated the script in a bit.

EDIT: Script updated, note that it uses a function that READS from ffc->script it doesn't write to it. So it should work. Even if it's from ffcscript.zh

Edited by blackbishop89, 08 August 2011 - 02:06 PM.


#11 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 08 August 2011 - 08:21 PM

It seemed to freeze ZC.

EDIT: never mind i put in the script right. But, when i lit all the flames using singular flags, the secret sfx didn't play. How do i set it up?

Edited by Christian, 08 August 2011 - 08:35 PM.


#12 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 08 August 2011 - 08:54 PM

QUOTE(Christian @ Aug 8 2011, 07:21 PM) View Post

It seemed to freeze ZC.

EDIT: never mind i put in the script right. But, when i lit all the flames using singular flags, the secret sfx didn't play. How do i set it up?


Hmm... I'm not sure... I'll do some more testing then.

#13 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 08 August 2011 - 11:05 PM

QUOTE(blackbishop89 @ Aug 8 2011, 09:54 PM) View Post

Hmm... I'm not sure... I'll do some more testing then.


No problem icon_smile.gif Thanks for all your help Blackbishop89.

#14 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 09 August 2011 - 08:41 AM

QUOTE(Christian @ Aug 8 2011, 10:05 PM) View Post

No problem icon_smile.gif Thanks for all your help Blackbishop89.


Did you check the scripted flag number you set the constant to? I mean the general purpose flag on Screen Flags 2 tab on screen data.

Edited by blackbishop89, 09 August 2011 - 08:42 AM.


#15 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 09 August 2011 - 04:49 PM

QUOTE(blackbishop89 @ Aug 9 2011, 09:41 AM) View Post

Did you check the scripted flag number you set the constant to? I mean the general purpose flag on Screen Flags 2 tab on screen data.


Yes i did. Don't understand why it's not playing. It also disables by 2x2 enemy death tile animations. Want me to send you my quest file. Would you think an FFC script would make it better?


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users