Code:
import "std.zh"
const int SecretBlocker = 511;
int SecretBlocker = 511;
ffc script TransformingBoss {
void run(int Spawners, int phase2ID, int phase3ID, int phase4ID, int phase5ID, int phase6ID, int phase7ID) {
//States the number of spawn points the boss will use, as well as the enemy ID of each phase.
//Use FFC arguments to define these values.
//You will need to create an invisible enemy in slot 511 that ignores all damage. This is the secret
//blocker; it prevents the doors and secrets from triggering when one phase of the boss is defeated.
//Set the enemy's image to a blank tile, its type to 'Other', and its animation style to 'None'.
//Make sure to give it some HP, and make it ignore all weapon types!
//You may notice that the script does not request the phase 1 ID. The first phase should be whatever
//enemies you place on the screen to begin with, so the first phase's ID is unnecessary.
//Be sure to place the FFC where you want the enemy to spawn (and make sure it's invisible!)
//Also, don't lie about the number of spawn points you're going to use; going short could cause the boss
//to behave erratically or die instantly after a certain phase, and going over could make the boss have
//very long intervals of time between phases. You should avoid using more than three spawners.
//Also, make sure you use the same spawner number in each instance of the FFC.
//If you want to skip a phase, set the phaseID to 0. If you want the enemy to spawn in multiple spots,
//use a separate FFC to define the position for each phase, and skip the appropriate phases as necessary.
//This script does not currently support the permanent defeat of transforming bosses.
int TotalNPCs;
int Curphase = 1;
int Setup = 0;
Spawners = Clamp(Spawners, 1, 3);
phase2ID = Clamp(phase2ID, 0, 510); //Making sure the enemy ID referenced is not an overflow value.
phase3ID = Clamp(phase3ID, 0, 510);
phase4ID = Clamp(phase4ID, 0, 510);
phase5ID = Clamp(phase5ID, 0, 510);
phase6ID = Clamp(phase6ID, 0, 510);
phase7ID = Clamp(phase7ID, 0, 510);
while(true){
if(Setup==0){
CreateNPCAt(SecretBlocker, 0, 0);
Setup=1;
}
Waitframes(10);
TotalNPCs = Screen->NumNPCs();
if(Curphase < 8){
if(TotalNPCs==Spawners){
if(Curphase==1){
if(phase2ID==0){
Waitframes(Spawners);
//This script determines the spawn location by FFC based on a base 'spawner' number system. That is, it checks
//the first FFC on the screen with this script, then the next, and so on before 'skipping' a phase.
//The more spawners you use, the longer the wait between boss spawns; try to avoid using more than three.
Curphase +=1;
}
else{
CreateNPCAt(phase2ID, this->X, this->Y);
//Spawns the phase 2 boss
Curphase+=1;
}
}
else if(Curphase==2){
if(phase3ID==0){
Waitframes(Spawners^2);
Curphase +=1;
}
else{
CreateNPCAt(phase3ID, this->X, this->Y);
//Spawns the phase 3 boss
Curphase +=1;
}
}
else if(Curphase==3){
if(phase4ID==0){
Waitframes(Spawners^3);
Curphase +=1;
}
else{
CreateNPCAt(phase4ID, this->X, this->Y);
//Spawns the phase 4 boss
Curphase +=1;
}
}
else if(Curphase==4){
if(phase5ID==0){
Waitframes(Spawners^4);
Curphase +=1;
}
else{
CreateNPCAt(phase5ID, this->X, this->Y);
//Spawns the phase 5 boss
Curphase +=1;
}
}
else if(Curphase==5){
if(phase6ID==0){
Waitframes(Spawners^5);
Curphase +=1;
}
else{
CreateNPCAt(phase6ID, this->X, this->Y);
//Spawns the phase 6 boss
Curphase +=1;
}
}
else if(Curphase==6){
if(phase6ID==0){
Waitframes(Spawners^6);
Curphase +=1;
}
else{
CreateNPCAt(phase7ID, this->X, this->Y);
//Spawns the phase 6 boss
Curphase +=1;
}
}
else if(Curphase==7){
Waitframes(Spawners^7);
Curphase +=1;
}
}
}
else if(TotalNPCs>0){
npc KillSweep = Screen->LoadNPC(1);
KillSweep->HP = 0;
}
Waitframe();
}
}
}
ffc script BossFire {
//Make all projectiles unblockable
void run(){
while(true){
for(int i = Screen->NumEWeapons(); i>0; i--){
eweapon ew = Screen->LoadEWeapon(i);
if(ew->Dir != -1){
ew->Dir = -1;
}
}
Waitframe();
}
}
}