ffc script MultiTorch{
int torch_cap(ffc this){
int count=0;
for(int i=1; i<=32; i++){
ffc f=Screen->LoadFFC(i);
if(f->Script==this->Script){
count++;
}
}
return count;
}
bool AllLit(ffc this){
for(int i=0; i<=torch_cap(this); i++){
if(Screen->D[i]==0){
return false;
}
}
return true;
}
void run(int torch_number){
if(Screen->D[torch_number]==1){
Screen->ComboD[ComboAt(this->X+8, this->Y+8)]++;
}
else while(true){
if(AllLit(this)&&Screen->State[ST_SECRET]==false){
Screen->TriggerSecrets();
Screen->State[ST_SECRET]=true;
Game->PlaySound(SFX_SECRET);
}
for(int i=1; i<=Screen->NumLWeapons(); i++){
lweapon l=Screen->LoadLWeapon(i);
if(l->ID==LW_FIRE&&Distance(l->X, l->Y, this->X, this->Y)<16&&Screen->D[torch_number]==0){
Screen->ComboD[ComboAt(this->X+8, this->Y+8)]++;
Screen->D[torch_number]=1;
}
}
Waitframe();
}
}
}
I have no idea how I missed the error that caused all this or why it worked in my test file, but this one should work.