ffc script Locked_Treasure_Chest{
void run(int item_ID,int Key_Counter){
if(Screen->State[ST_CHEST]){
this->Data = 0;
Quit();
}
while(!Activated(this,Key_Counter))
Waitframe();
this->Data = GH_INVISIBLE_COMBO;
CreateItemAt(item_ID,Link->X,Link->Y);
Game->Counter[Key_Counter]--;
Link->Action = LA_HOLD2LAND;
Link->HeldItem = item_ID;
Screen->State[ST_CHEST]=true;
` KeepAUnpressed();
this->Data = 0;
}
}
bool Activated(ffc this, int Key_Counter){
if(Game->Counter[Key_Counter]==0)return false;
if(Link->Dir!=DIR_UP)return false;
if(Link->X<this->-8)return false;
if(Link->X>this->X+8)return false;
if(Link->Y<this->Y+8)return false;
if(Link->Y>this->Y+16)return false;
if(!Link->PressA)return false;
return true;
}
void KeepAUnpressed(){
while(Link->InputA){
Link->InputA = false;
Link->PressA = false;
Waitframe();
}
}