Gleeok
11-02-2007, 03:01 AM
Do you need and endless supply of ffc's being hurled at Link from a Giant Crab-like monster? If so then look no further. Because i've got crabs, and now you can have crabs too. :p
http://i233.photobucket.com/albums/ee49/Gleeok9/zelda025.png
This is my first fully completed boss script, but not to be the last! ..Anyway most of you will have no use for this script because, well...It's designed to kill you. :eyebrow: But that's why there's variables I guess. So you can set 'em up however you like. Although I guess you could give Link more equipment too...I'm mostly posting this for simplicity and learning purposes for future scripters. But if anyone actually uses it then that's great too. :D
//================================================== =========================
// ***FFC SCRIPT CRAB BOSS***
// Link FFC's to this ffc to make it any way you like. :D
// this ffc expects to be in the upper part of the screen. It will move left and right
// and fire projectiles at downward angles.
//D0 the number of this ffc
//D1 enemy HP
//D2 enemy speed
//D3 bubble speed
//D4 the combos to be used as bubble projectiles
//D5 the cset of the bubble projectiles
//D6 0=constant movement, 1=randomly stops for a short time
//================================================== =========================
ffc script Crab_boss{
void run(int this_ffc_number, int enemyHP, int crabspeed, int bubblespeed, int bubble_combo, int cset, int constant){
ffc this_ffc = Screen->LoadFFC(this_ffc_number);
if(this_ffc_number == 0){ this_ffc_number = 1; }
if(enemyHP == 0){ enemyHP = 100; }
if(bubblespeed == 0){ bubblespeed = 1; }
int delay = 0;
int attack_state = 0; // 0=moving, 1=standing still
int movement_state = 0; // 0=right, 1=left
int switch_state = 0;
int bubble_ffc = 10;
int crab_stopped = 0;
int RandNum;
int screen_enemy_number = Screen->NumNPCs();
ffc bubble;
Waitframes(4);
npc crablife = Screen->LoadNPC(1);
crablife->HP = enemyHP;
while(true){
if((delay == 60) && (crablife->HP > enemyHP*0.8)){ delay = 0;}
if((delay == 150)&&(crablife->HP <= enemyHP*0.8)&&(crablife->HP > enemyHP*0.35)){ delay = 0;}
if((delay == 200) && (crablife->HP <= enemyHP*0.35)){ delay = 0;}
delay++;
if(bubble_ffc >= 23){ bubble_ffc = 10;}
crablife->X = this->X; crablife->Y = this->Y;
if(this_ffc->X <= 64){ movement_state = 0;}
if(this_ffc->X >= 180){ movement_state = 1;}
//===========================
//ENEMY MOVEMENT
//===========================
if(crab_stopped > 0){ crab_stopped--;}
if(crab_stopped == 0){ attack_state = 0;}
if(movement_state == 0 && attack_state == 0){this_ffc->Vx = crabspeed;}
if(movement_state == 1 && attack_state == 0){this_ffc->Vx = -crabspeed;}
if(movement_state == 0 && attack_state == 1){this_ffc->Vx = 0;}
if(movement_state == 1 && attack_state == 1){this_ffc->Vx = 0;}
if((constant == 1)&&(switch_state == 0)){RandNum = Rand(180);switch_state = 1;}
if((constant == 1)&&(switch_state == 1)){
RandNum++;
if(RandNum == 180){
attack_state = 1; switch_state = 0; crab_stopped = 30;
}
}
if((this_ffc->X > Link->X)&&(this_ffc->Y >= Link->Y-8)){ this_ffc->Vx = -crabspeed-0.2; crab_stopped = 0; movement_state = 1;}
if((this_ffc->X < Link->X)&&(this_ffc->Y >= Link->Y-8)){ this_ffc->Vx = crabspeed+0.2; crab_stopped = 0; movement_state = 0;}
//===========================
//ENEMY FIRE
//===========================
if(crablife->HP > enemyHP*0.8){
if((delay == 15)||(delay == 45)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble_ffc++; }
if(delay == 30){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = bubblespeed*0.8;
bubble_ffc++;}
if(delay == 60){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = -bubblespeed*0.8;
bubble_ffc++;}
}
if((crablife->HP <= enemyHP*0.8)&&(crablife->HP > enemyHP*0.35)){
if((delay == 10)||(delay == 50 )||(delay == 90)||(delay == 130)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = 0;
bubble_ffc++; }
if((delay == 20)||(delay == 40 )||(delay == 100)||(delay == 120)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = bubblespeed*0.6;
bubble_ffc++; }
if((delay == 30)||(delay == 110 )){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed*0.8;
bubble->Vx = bubblespeed;
bubble_ffc++; }
if((delay == 60)||(delay == 80 )||(delay == 140)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = -bubblespeed*0.6;
bubble_ffc++; }
if((delay == 70)||(delay == 150 )){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed*0.8;
bubble->Vx = -bubblespeed;
bubble_ffc++; }
}
if(crablife->HP <= enemyHP*0.35){
if((delay == 7)||(delay == 49 )||(delay == 91)||(delay == 133)||(delay == 175)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = 0;
bubble_ffc++; }
if((delay == 14)||(delay == 42 )||(delay == 98)||(delay == 126)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = bubblespeed*0.4;
bubble_ffc++; }
if((delay == 21)||(delay == 35 )||(delay == 105)||(delay == 119)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = bubblespeed*0.8;
bubble_ffc++; }
if((delay == 28)||(delay == 112)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed*0.9;
bubble->Vx = bubblespeed*1.2;
bubble_ffc++; }
if((delay == 56)||(delay == 84 )||(delay == 140)||(delay == 168)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = -bubblespeed*0.4;
bubble_ffc++; }
if((delay == 63)||(delay == 77 )||(delay == 147)||(delay == 161)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = -bubblespeed*0.8;
bubble_ffc++; }
if((delay == 70)||(delay == 154 )){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed*0.9;
bubble->Vx = -bubblespeed*1.2;
bubble_ffc++; }
}
Waitframe();
}
}
}
=================***READ***==================
I do some things a little different than you may be used to. First is this script does not create an enemy. It assumes you have a screen enemy set and enemies->secrets is probably enabled. It then uses this enemy for fuel, increasing it's HP and such. DO NOT USE "ENTER FROM SIDES'.
Next: Do NOT use FFC's 10-23 for anything! don't even set anything on them. The script does all the work and will use these for it's own twisted scheme.
-Variables-
//D0 the number of this ffc : You can blame C- for this. ;) I got used to reading through his stuff a while back, so I'll accidentally type this_ffc instead of this, and then it won't compile, so now I just add this by default.
//D1 enemy HP
//D2 enemy speed
//D3 bubble speed : I'd test this at 1 before you set it any higher than that.
//D4 the combos to be used as bubble projectiles
//D5 the cset of the bubble projectiles
//D6 0=constant movement, 1=randomly stops for a short time
Others self explanitory.
-Oh, and if anyone is wondering why there's no demo it's because there's a bug with damage combo's in 635. *hint* devs fix pwease...
Have fun.
http://i233.photobucket.com/albums/ee49/Gleeok9/zelda025.png
This is my first fully completed boss script, but not to be the last! ..Anyway most of you will have no use for this script because, well...It's designed to kill you. :eyebrow: But that's why there's variables I guess. So you can set 'em up however you like. Although I guess you could give Link more equipment too...I'm mostly posting this for simplicity and learning purposes for future scripters. But if anyone actually uses it then that's great too. :D
//================================================== =========================
// ***FFC SCRIPT CRAB BOSS***
// Link FFC's to this ffc to make it any way you like. :D
// this ffc expects to be in the upper part of the screen. It will move left and right
// and fire projectiles at downward angles.
//D0 the number of this ffc
//D1 enemy HP
//D2 enemy speed
//D3 bubble speed
//D4 the combos to be used as bubble projectiles
//D5 the cset of the bubble projectiles
//D6 0=constant movement, 1=randomly stops for a short time
//================================================== =========================
ffc script Crab_boss{
void run(int this_ffc_number, int enemyHP, int crabspeed, int bubblespeed, int bubble_combo, int cset, int constant){
ffc this_ffc = Screen->LoadFFC(this_ffc_number);
if(this_ffc_number == 0){ this_ffc_number = 1; }
if(enemyHP == 0){ enemyHP = 100; }
if(bubblespeed == 0){ bubblespeed = 1; }
int delay = 0;
int attack_state = 0; // 0=moving, 1=standing still
int movement_state = 0; // 0=right, 1=left
int switch_state = 0;
int bubble_ffc = 10;
int crab_stopped = 0;
int RandNum;
int screen_enemy_number = Screen->NumNPCs();
ffc bubble;
Waitframes(4);
npc crablife = Screen->LoadNPC(1);
crablife->HP = enemyHP;
while(true){
if((delay == 60) && (crablife->HP > enemyHP*0.8)){ delay = 0;}
if((delay == 150)&&(crablife->HP <= enemyHP*0.8)&&(crablife->HP > enemyHP*0.35)){ delay = 0;}
if((delay == 200) && (crablife->HP <= enemyHP*0.35)){ delay = 0;}
delay++;
if(bubble_ffc >= 23){ bubble_ffc = 10;}
crablife->X = this->X; crablife->Y = this->Y;
if(this_ffc->X <= 64){ movement_state = 0;}
if(this_ffc->X >= 180){ movement_state = 1;}
//===========================
//ENEMY MOVEMENT
//===========================
if(crab_stopped > 0){ crab_stopped--;}
if(crab_stopped == 0){ attack_state = 0;}
if(movement_state == 0 && attack_state == 0){this_ffc->Vx = crabspeed;}
if(movement_state == 1 && attack_state == 0){this_ffc->Vx = -crabspeed;}
if(movement_state == 0 && attack_state == 1){this_ffc->Vx = 0;}
if(movement_state == 1 && attack_state == 1){this_ffc->Vx = 0;}
if((constant == 1)&&(switch_state == 0)){RandNum = Rand(180);switch_state = 1;}
if((constant == 1)&&(switch_state == 1)){
RandNum++;
if(RandNum == 180){
attack_state = 1; switch_state = 0; crab_stopped = 30;
}
}
if((this_ffc->X > Link->X)&&(this_ffc->Y >= Link->Y-8)){ this_ffc->Vx = -crabspeed-0.2; crab_stopped = 0; movement_state = 1;}
if((this_ffc->X < Link->X)&&(this_ffc->Y >= Link->Y-8)){ this_ffc->Vx = crabspeed+0.2; crab_stopped = 0; movement_state = 0;}
//===========================
//ENEMY FIRE
//===========================
if(crablife->HP > enemyHP*0.8){
if((delay == 15)||(delay == 45)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble_ffc++; }
if(delay == 30){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = bubblespeed*0.8;
bubble_ffc++;}
if(delay == 60){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = -bubblespeed*0.8;
bubble_ffc++;}
}
if((crablife->HP <= enemyHP*0.8)&&(crablife->HP > enemyHP*0.35)){
if((delay == 10)||(delay == 50 )||(delay == 90)||(delay == 130)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = 0;
bubble_ffc++; }
if((delay == 20)||(delay == 40 )||(delay == 100)||(delay == 120)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = bubblespeed*0.6;
bubble_ffc++; }
if((delay == 30)||(delay == 110 )){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed*0.8;
bubble->Vx = bubblespeed;
bubble_ffc++; }
if((delay == 60)||(delay == 80 )||(delay == 140)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = -bubblespeed*0.6;
bubble_ffc++; }
if((delay == 70)||(delay == 150 )){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed*0.8;
bubble->Vx = -bubblespeed;
bubble_ffc++; }
}
if(crablife->HP <= enemyHP*0.35){
if((delay == 7)||(delay == 49 )||(delay == 91)||(delay == 133)||(delay == 175)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = 0;
bubble_ffc++; }
if((delay == 14)||(delay == 42 )||(delay == 98)||(delay == 126)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = bubblespeed*0.4;
bubble_ffc++; }
if((delay == 21)||(delay == 35 )||(delay == 105)||(delay == 119)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = bubblespeed*0.8;
bubble_ffc++; }
if((delay == 28)||(delay == 112)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed*0.9;
bubble->Vx = bubblespeed*1.2;
bubble_ffc++; }
if((delay == 56)||(delay == 84 )||(delay == 140)||(delay == 168)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = -bubblespeed*0.4;
bubble_ffc++; }
if((delay == 63)||(delay == 77 )||(delay == 147)||(delay == 161)){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed;
bubble->Vx = -bubblespeed*0.8;
bubble_ffc++; }
if((delay == 70)||(delay == 154 )){
bubble = Screen->LoadFFC(bubble_ffc);
bubble->Data = bubble_combo;
bubble->CSet = cset;
bubble->X = this->X;
bubble->Y = this->Y + 8;
bubble->Vy = bubblespeed*0.9;
bubble->Vx = -bubblespeed*1.2;
bubble_ffc++; }
}
Waitframe();
}
}
}
=================***READ***==================
I do some things a little different than you may be used to. First is this script does not create an enemy. It assumes you have a screen enemy set and enemies->secrets is probably enabled. It then uses this enemy for fuel, increasing it's HP and such. DO NOT USE "ENTER FROM SIDES'.
Next: Do NOT use FFC's 10-23 for anything! don't even set anything on them. The script does all the work and will use these for it's own twisted scheme.
-Variables-
//D0 the number of this ffc : You can blame C- for this. ;) I got used to reading through his stuff a while back, so I'll accidentally type this_ffc instead of this, and then it won't compile, so now I just add this by default.
//D1 enemy HP
//D2 enemy speed
//D3 bubble speed : I'd test this at 1 before you set it any higher than that.
//D4 the combos to be used as bubble projectiles
//D5 the cset of the bubble projectiles
//D6 0=constant movement, 1=randomly stops for a short time
Others self explanitory.
-Oh, and if anyone is wondering why there's no demo it's because there's a bug with damage combo's in 635. *hint* devs fix pwease...
Have fun.