ffc script NPCScript_Simple_Secret{
void run(int msg, int scriptSlot, int D0, int D1, int D2, int D3, int D4, int D5){
//Saves the width and height of the FFC for collision checks
int Width = 16;
int Height = 16;
if(this->EffectWidth!=16)
Width = this->EffectWidth;
else if(this->TileWidth>1)
Width = this->TileWidth*16;
if(this->EffectHeight!=16)
Height = this->EffectHeight;
else if(this->TileHeight>1)
Height = this->TileHeight*16;
while(true){
int dialogueBox1[] = "DialogueBranch_Simple";
int dialogueBox2[] = "DialogueBranch_Advanced";
int scrDB1 = Game->GetFFCScript(dialogueBox1);
int scrDB2 = Game->GetFFCScript(dialogueBox2);
bool noTalk;
if(CountFFCsRunning(scrDB1)>0)
noTalk = true;
if(CountFFCsRunning(scrDB2)>0)
noTalk = true;
//Facing Up
if(!noTalk&&Link->Dir==DIR_UP&&Link->Y>=this->Y&&Link->Y<=this->Y+Height-8&&Link->X>=this->X-8&&Link->X<=this->X+Width-8){
if(CMB_NPC_CANTALK>0)
Screen->FastCombo(LAYER_NPC_CANTALK, Link->X, Link->Y-16, CMB_NPC_CANTALK, CS_NPC_CANTALK, 128);
if(Link->PressA){
Link->InputA = false;
Link->PressA = false;
Screen->Message(msg);
Screen->State[ST_SECRET] = true;
Screen->TriggerSecrets();
Audio->PlaySound(Screen->SecretSFX);
this->Data = 0;
Quit();
if(scriptSlot>0){
int Args[8] = {D0, D1, D2, D3, D4, D5};
int i = RunFFCScript(scriptSlot, Args);
if(NPCSCRIPT_WAITS_UNTIL_SCRIPTS_FINISH){
ffc f = Screen->LoadFFC(i);
while(f->Script==scriptSlot){
Waitframe();
}
}
}
}
}
//Facing Down
else if(!noTalk&&Link->Dir==DIR_DOWN&&Link->Y>=this->Y-16&&Link->Y<=this->Y+Height-16&&Link->X>=this->X-8&&Link->X<=this->X+Width-8){
if(CMB_NPC_CANTALK>0)
Screen->FastCombo(LAYER_NPC_CANTALK, Link->X, Link->Y-16, CMB_NPC_CANTALK, CS_NPC_CANTALK, 128);
if(Link->PressA){
Link->InputA = false;
Link->PressA = false;
Screen->Message(msg);
Screen->State[ST_SECRET] = true;
Screen->TriggerSecrets();
Audio->PlaySound(Screen->SecretSFX);
this->Data = 0;
Quit();
if(scriptSlot>0){
int Args[8] = {D0, D1, D2, D3, D4, D5};
int i = RunFFCScript(scriptSlot, Args);
if(NPCSCRIPT_WAITS_UNTIL_SCRIPTS_FINISH){
ffc f = Screen->LoadFFC(i);
while(f->Script==scriptSlot){
Waitframe();
}
}
}
}
}
//Facing Left
else if(!noTalk&&Link->Dir==DIR_LEFT&&Link->Y>=this->Y-8&&Link->Y<=this->Y+Height-8&&Link->X>=this->X&&Link->X<=this->X+Width){
if(CMB_NPC_CANTALK>0)
Screen->FastCombo(LAYER_NPC_CANTALK, Link->X, Link->Y-16, CMB_NPC_CANTALK, CS_NPC_CANTALK, 128);
if(Link->PressA){
Link->InputA = false;
Link->PressA = false;
Screen->Message(msg);
Screen->State[ST_SECRET] = true;
Screen->TriggerSecrets();
Audio->PlaySound(Screen->SecretSFX);
this->Data = 0;
Quit();
if(scriptSlot>0){
int Args[8] = {D0, D1, D2, D3, D4, D5};
int i = RunFFCScript(scriptSlot, Args);
if(NPCSCRIPT_WAITS_UNTIL_SCRIPTS_FINISH){
ffc f = Screen->LoadFFC(i);
while(f->Script==scriptSlot){
Waitframe();
}
}
}
}
}
//Facing Right
else if(!noTalk&&Link->Dir==DIR_RIGHT&&Link->Y>=this->Y-8&&Link->Y<=this->Y+Height-8&&Link->X>=this->X-16&&Link->X<=this->X+Width-16){
if(CMB_NPC_CANTALK>0)
Screen->FastCombo(LAYER_NPC_CANTALK, Link->X, Link->Y-16, CMB_NPC_CANTALK, CS_NPC_CANTALK, 128);
if(Link->PressA){
Link->InputA = false;
Link->PressA = false;
Screen->Message(msg);
Screen->State[ST_SECRET] = true;
Screen->TriggerSecrets();
Audio->PlaySound(Screen->SecretSFX);
this->Data = 0;
Quit();
if(scriptSlot>0){
int Args[8] = {D0, D1, D2, D3, D4, D5};
int i = RunFFCScript(scriptSlot, Args);
if(NPCSCRIPT_WAITS_UNTIL_SCRIPTS_FINISH){
ffc f = Screen->LoadFFC(i);
while(f->Script==scriptSlot){
Waitframe();
}
}
}
}
}
Waitframe();
}
}
}