Last Singular Flag-> Secret SFX
#1
Posted 06 August 2011 - 01:18 AM
#2
Posted 06 August 2011 - 12:59 PM
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?
#4
Posted 08 August 2011 - 09:36 AM
#5
Posted 08 August 2011 - 12:04 PM
#6
Posted 08 August 2011 - 12:18 PM
#7
Posted 08 August 2011 - 12:27 PM
#8
Posted 08 August 2011 - 12:48 PM
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
Posted 08 August 2011 - 01:32 PM
#10
Posted 08 August 2011 - 02:04 PM
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
Posted 08 August 2011 - 08:21 PM
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.
#14
Posted 09 August 2011 - 08:41 AM
No problem 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
Posted 09 August 2011 - 04:49 PM
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?
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users